Suppose Fail2Ban is already installed, if not, then see my article – Installing and Configuring Fail2ban.
In Fail2Ban by default, there are already filters for ProFTPd and it knows that the log file is located at /var/log/proftpd/proftpd.log, so it’s enough to create the file:
sudo nano /etc/fail2ban/jail.d/proftpd.local
And enter the data below, thereby activating the check of the log file /var/log/proftpd/proftpd.log:
[proftpd]
enabled = true
bantime = 86400
Restart Fail2Ban to apply the changes:
sudo service fail2ban restart
You can check the status:
sudo fail2ban-client status proftpd
Let’s add our IP address to the ignoreip list, try connecting with an incorrect password, and make sure the filter sees it (there should be “matches”):
fail2ban-client get proftpd ignoreip
fail2ban-regex /var/log/proftpd/proftpd.log /etc/fail2ban/filter.d/proftpd.conf
Example of manual locking or unlocking:
fail2ban-client set proftpd banip 192.168.77.77
fail2ban-client set proftpd unbanip 192.168.77.77
