QmailtoasterMain Page | About | Help | FAQ | Special pages | Log in

Printable version | Disclaimers | Privacy policy

Fail2ban Centos6

From Qmailtoaster

Fail2ban install for Cento6 qmail

Download the repo: from here


Pick correct version 32bit or 64 bit

CentOS/RHEL 6, 32 Bit (i386):

  1. rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

CentOS/RHEL 6, 64 Bit x86_64):

  1. rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum install fail2ban

modify anything you want to activate, ie: change "false" to " true ", in the config file, best to copy the jail.conf to jail.local and modify the jail.local

Run chkconfig fail2ban on run service fail2ban start

Check your logs : /var/log/fail2ban.log

If you see these errors in the logs:

The jail SSH has been started successfully.\n Regards,\n Fail2Ban" | /usr/sbin/sendmail -f fail2ban@mail.mydomain.com admin@mydomain.com returned 7f00 2014-05-07 08:28:04,142 fail2ban.actions.action: INFO HINT on 7f00: "Command not found". Make sure that all commands in 'printf %b "Subject: [Fail2Ban] SSH: started\nDate: `LC_TIME=C date -u +"%a, %d %h %Y %T +0000"`\nFrom: Fail2Ban <fail2ban@mail.mydomain.com>\nTo: admin@mydomain.com\\n\nHi,\\n\nThe jail SSH has been started successfully.\\n\nRegards,\\n\nFail2Ban" | /usr/sbin/sendmail -f fail2ban@mail.mydomain.com admin@mydomain.comare in the PATH of fail2ban-server process (grep -a PATH= /proc/`pidof -x fail2ban-server`/environ). You may want to start "fail2ban-server -f" separately, initiate it with "fail2ban-client reload" in another shell session and observe if additional informative error messages appear in the terminals. 2014-05-07 08:28:34,888 fail2ban.server : INFO Stopping all jails

The path is wrong to sendmail, so we create a symlink ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

Restart fail2ban service fail2ban restart Check the status: As you will see I have setup 7 Jails service fail2ban status

fail2ban-server (pid 24261) is running... Status |- Number of jail: 7 `- Jail list: qmail-iptables, squirrelmail-iptables, fail2ban, ssh-iptables, dos-hosts, password-fail, username-notfound

Further Help in setting up Jails can be found here:


Retrieved from "http://wiki.qmailtoaster.com/index.php/Fail2ban_Centos6"

This page has been accessed 5,933 times. This page was last modified on 7 May 2014, at 15:33. Content is available under GNU Free Documentation License 1.2.


Main page
Community portal
Current events
Recent changes
Random page
View source
Editing help
This page
Discuss this page
New section
Printable version
Page history
What links here
Related changes
My pages
Log in / create account
Special pages
New pages
File list