yum install epel-release
yum install fail2ban fail2ban-systemd
yum update -y selinux-policy*
cp -pf /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
nano /etc/fail2ban/jail.local
nano /etc/fail2ban/jail.d/sshd.local
[sshd]
enabled = true
port = ssh
#action = firewallcmd-ipset
logpath = %(sshd_log)s
maxretry = 5
bantime = 86400
systemctl enable firewalld
systemctl start firewalld
systemctl enable fail2ban
systemctl start fail2ban
cat /var/log/secure | grep 'Failed password'
Checking the banned IPs by Fail2Ban
iptables -L -n
Check the Fal2Ban Status
fail2ban-client status
fail2ban-client set sshd unbanip IPADDRESS