Proftp bruteforce attacks, and the remedy
I recently noticed some script-kiddies had tried extensively to hack into my fpt server running proftp. Annoying to say the least, especially since the logfile ended up beeing 250MB+. I scowered the internet and did not find a simple solution. I ended up compiling in support for iptables in my server, the alpha architecture is a bit different than a regular pc, so I was quite nervous rebooting the machine, however all went well and the machine came back up with a whole new set of opportunities. From here I installed fail2ban, a really nice autoban utility to add rules to the firewall when the server gets attacked by kids. Fail2ban sports a whole plethora of options for software such as apache, a number of ftpservers and mail, ssh and all the usual. I simply typed:
apt-get install fail2ban (iptables required) (check with iptables –list)
I then went to /etc/fail2ban/jail.conf and enabled the proftpd service.
[proftpd]
enabled = true
port = ftp,ftp-data,ftps,ftps-data
filter = proftpd
logpath = /var/log/proftpd/proftpd.log
maxretry = 3
Here I encountered a problem, the thing would not ban me while trying to abuse the ftp-server, and after som reading up, I found out that debian has an error in the regexpline making no matches from the target logfile. Easy enough, add this line to your /etc/fail2ban/filter.d/proftpd.conf under the three similar ones.
\(\S+\[
\]\)[: -]+ USER \S+: no such user found from \S+ \[\S+\] to \S+:\S+
Restart the fail2ban service, with /etc/init.d/fail2ban restart
If you have a couple of static IP-numbers you frequently access your server from you can also add them to your ignorelist. Change the line ignoreip = 127.0.0.1 in /etc/fail2ban/jail.conf to
ignoreip = 127.0.0.1 x.x.x.x y.y.y.y
Where x and y denotes your IP-numbers
Enjoy and may death, torment and destruction rain heavily on the repulsive script-kiddies.









