CentOS 7 - Fail2Ban

Install & Configure

# yum -y install fail2ban
# systemctl enable fail2ban
# vim /etc/fail2ban/jail.local
[DEFAULT]
# Ban hosts for one hour:
bantime = 3600

# whitelist, ip addresses separated by space, e.g:
# ignoreip = 127.0.0.1 192.168.1.0/24 8.8.8.8

[sshd]
enabled = true

# systemctl restart fail2ban

Check if IP banned:

# vim /var/log/fail2ban.log
# fail2ban-client status sshd

Unban IP address

Find out jail name:

# fail2ban-client status

Unban IP:

# fail2ban-client set YOURJAILNAMEHERE unbanip IPADDRESSHERE

Older fail2ban (before 0.8.8):

# fail2ban-client get <JAIL_NAME> actionunban <IP_ADDRESS>