# Install the extra packages repo if you haven't already
$ sudo yum install epel-release
# Install fail2ban
$ sudo yum install fail2ban
# Configure fail2ban
$ sudo vim /etc/fail2ban/jail.local
Paste this content:
[DEFAULT]
# Ban hosts for one hour:
bantime = 3600
# Override /etc/fail2ban/jail.d/00-firewalld.conf:
banaction = iptables-multiport
[sshd]
enabled = true
Start fail2ban and enable it so it’ll start automatically on boot.
$ sudo systemctl enable fail2ban
$ sudo systemctl start fail2ban