============= fail2ban install =============
yum update && yum install epel-release
yum -y install fail2ban
============= fail2ban config =============
cp /etc/fail2ban/jail.conf jail.local
// 修改默认配置
[DEFAULT]
# "bantime" is the number of seconds that a host is banned.
bantime = 259200
# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime = 120
# "maxretry" is the number of failures before a host get banned.
maxretry = 3
// 防护指定应用
[sshd]
enabled = true
============= fail2ban status =============
fail2ban-client -i
status
status sshd
fail2ban-client set sshd unbanip IPADDRESS