BSD PF Firewall Block FTP Bruteforce Attacks

BSD PF Firewall Block FTP Bruteforce Attacks

To block FTP bruteforce attacks using the PF firewall on a BSD system (such as FreeBSD or OpenBSD), you can use the following steps:

  1. Create a table to hold the IP addresses of attackers:
table <bruteforce> persist
Source:‮www‬.lautturi.com
  1. Use a PF rule to block incoming connections from IP addresses that have made more than a certain number of failed login attempts within a certain time period:
block in quick on $ext_if from <bruteforce>
  1. Use another PF rule to add IP addresses to the bruteforce table when they make a certain number of failed login attempts within a certain time period:
pass in on $ext_if proto tcp to port ftp \
    flags S/SA keep state \
    (max-src-conn-rate 3/30, \
     overload <bruteforce> flush global)

This will block incoming FTP connections from IP addresses that have made more than 3 failed login attempts within a 30-second time period. You can adjust these thresholds to fit your needs.

It's important to note that this solution is just one way to block FTP bruteforce attacks and may not be suitable for all environments. You should consider the specific needs of your system and the potential impact on legitimate users when implementing firewall rules to block bruteforce attacks.

Created Time:2017-10-27 14:56:34  Author:lautturi