Comments on How to install Fail2Ban on CentOS 7

Most Linux servers offer an SSH login via Port 22 for remote administration purposes. This port is a well-known port, therefore, it is often attacked by brute force attacks. Fail2ban is a software that scans log files for brute force login attempts in real-time and bans the attackers with firewalld or iptables. This tutorial shows the installation and configuration of Fail2Ban with firewalld on CentOS 7.

11 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Cee O2

Hi there. Thanks a lot for this tutorial.

By: Charles

Excellent article, thanks very much !  ;)

By: A fan

awesome, you are a true lord sir!

By: Jeff

No mention of why the action line in the sshd jail is commented out. As long as it is commented, the whole rule is useless.

By: koffi

 

How to install fail2ban on CentOS 7 (Minima)

 

A/ First. Install fail2ban 0.8.14:

 

 1. su -c 'yum install ed gamin gamin-python python-inotify mailx whois perl ipset epel-release -y'

 

 2. a)

 

 2. b) Install fail2ban 0.8.14:

 

rpm -Uvh ftp://rpmfind.net/linux/epel/5/x86_64/fail2ban-0.8.14-1.el5.noarch.rpm

 

 3. Edit jail.local file:

 

cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

 

cp /etc/fail2ban/jail.local /etc/fail2ban/jail.local_copy

 

vi /etc/fail2ban/jail.local

 

change backend = auto to backend = gamin

 

#              pyinotify, gamin, polling.

 

backend = gamin

 

 4. Start fail2ban:

 

systemctl start fail2ban

 

 5. Make it start at boot time:

 

/sbin/chkconfig fail2ban on

 

 

 

B/ Update fail2ban

 

su -c 'yum install fail2ban -y'

 

systemctl enable fail2ban

 

systemctl restart fail2ban 

 

By: behtash

very goood thank you

By: Edy SS

Thank you for your kind assistance

By: Mark

Hey great article. So many articles had "unban" in the command and not "unbanip" which gave me some grief for 10 mins until I came across your article. Thanks.

fail2ban-client set sshd unbanip IPADDRESS

By: Bill

This was a great guide, thank you very much for writing!!

By: LP

6704 intentos fallidos desde 222.186.15.246 China Beijing en menos de 24, gracias a tu tutorial lo volvera a intentar dentro de un año jiji. Gracias

By: Sotmlac

thank you