Configuring fail2ban With SquirrelMail On Debian Lenny 5.0/ISPConfig 3
|
Submitted by CubAfull (Contact Author) (Forums) on Fri, 2009-08-28 16:01. :: Linux | Email | Security
Configuring fail2ban With SquirrelMail On Debian Lenny 5.0/ISPConfig 3In this article I will show how to prevent brute force attacks with Fail2ban against your SquirrelMail Web login using the Squirrel Logger plugin.
1. RequirementsEnsure that fail2ban and SquirrelMail are installed on a Debian Lenny/ISPConfig 3 machine.
2. Squirrel LoggerDownload and install Squirrel Logger:
cd /usr/share/squirrelmail/plugins Configure Squirrel Logger: vi config.php If your server doesn't use the GTM local time, please change $sl_use_GMT = 1 to $sl_use_GMT = 0 : ... Change the location of your log file from $sl_logfile = $data_dir . 'squirrelmail_access_log'; to $sl_logfile = '/var/log/squirrelmail.log'; : ... Change the date format to match the fail2ban regex from $sl_dateformat = 'm/d/Y H:i:s'; to $sl_dateformat = 'M j H:i:s'; : ... Create a new squirrelmail.log file in /var/log/: touch /var/log/squirrelmail.log Clean the installation: cd .. Configure SquirrelMail to use the Squirrel Logger plugin: squirrelmail-configure ... Select "Plugins", in my case, number 8. ... Select squirrel_logger, in my case, number 19. ... Now squirrel_logger is part of the Installed Plugins.
3. Fail2ban ConfigurationConfigure fail2ban to use the SquirrelMail Log: cd /etc/fail2ban Open and add the following lines to the jail.local file. If you don't have this file, use the default jail.conf. vi jail.local [squirrelmail] Please ensure that bantime (in seconds) and maxretry are set to your requirements. In the filter.d directory, create a squirrelmail.conf file with the following contents: cd filter.d # Fail2Ban configuration file IMPORTANT: if you are using another language than English, please change the line "failregex" with the text that squirrelmail.log shows you in point 5. Example: with the Spanish language, I get this in the log file. Aug 20 15:26:06 [LOGIN_ERROR] user@domain.com (server.domain.com) from XXX.XXX.XX.XX: Usuario o contraseña incorrecto.
So, I make this change: failregex = \[LOGIN_ERROR\].*from <HOST>: Usuario o contraseña incorrecto
...and restart fail2ban. /etc/init.d/fail2ban restart
5. Testing the installationcd /var/log Log in "3" times to the SquirrelMail Web interface using "incorrect passwords". Aug 19 13:57:20 [LOGIN_ERROR] user@domain.com (server.domain.com) from XXX.XXX.XX.XX: Unknown user or password incorrect. Close the squirrelmail.log file: Ctrl-c Verify that fail2ban-regex can trap these errors: fail2ban-regex /var/log/squirrelmail.log /etc/fail2ban/filter.d/squirrelmail.conf Running tests If you see this line, everything is ok: Success, the total number of match is 3
6. Let's test our Fail2banLog in "4" times (or more, depending of your maxretry setup) to the SquirrelMail Web interface using "incorrect passwords". When you get blocked, that means that you can't see the login page, please execute: iptables -L Now you can see your blocked IP xxx-xxx-xxx-xxx in the iptables output. Chain fail2ban-squirrelmail (1 references) Good luck ;)
|
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning







Recent comments
14 hours 22 min ago
16 hours 23 min ago
19 hours 35 min ago
21 hours 54 min ago
23 hours 4 min ago
1 day 22 min ago
1 day 4 hours ago
1 day 7 hours ago
1 day 8 hours ago
1 day 23 hours ago