Home > Web Application Hosting > Quick Way to Update Fail2ban jail.conf file

Quick Way to Update Fail2ban jail.conf file

September 3rd, 2009

There are plenty of settings in that file, especially if you are running CentOS 5.3 with latest patches and fail2ban from atomic repository. Here is a short list of steps that I follow when setting up new servers:

1. Setup sendmail to start on boot. Make sure it can send emails correctly (Reverse DNS records, hostname config, etc).

2. Make sure that fail2ban starts on boot (I use ntsysv for that).

3. Edit the jail.conf file, type vi /etc/fail2ban/jail.conf

4. Change the time for increased security:

bantime = 86400
findtime = 3600

5. After you save and exit, change all the destination emails to go to root which will then be forwarded to you:

sed -i 's/you@mail.com/root/g' /etc/fail2ban/jail.conf

6. Add a forward for all emails to root to your email:

echo "myemailaddress@mydomain.com" > ~/.forward

7. Restart fail2ban:

service fail2ban restart

Web Application Hosting ,

Comments are closed.