Centos下安装fail2ban:
#epel库里就有fail2ban 直接安装epel库就可以使用
#安装fail2ban
yum -y install epel-release
yum -y install fail2ban
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
编辑fail2ban配置文件:
vim /etc/fail2ban/jail.local
保护ssh服务:
[sshd]
enabled = true
maxretry = 3
[default]
ignoreip = 不封堵的IP地址段(白名单),使用空格分隔,例如:192.168.0.0/24 192.168.1.0/24
开机启动fail2ban:
systemctl enable fail2ban
启动fail2ban:
systemctl start fail2ban