Linux 防火墙 阻止ssh暴力测试

Fedora CentOS 系统下有效

安装fail2ban服务

dnf install fail2ban -y

设置开机启动

systemctl enable fail2ban

启动服务

systemctl start fail2ban

编辑文件

vim /etc/fail2ban/jail.conf

...
...
...

[ssh]
enabled = true
filter   = sshd
logpath = /var/log/secure
maxretry = 1
findtime = 300
bantime = 86400
ignoreip = 192.168.1.1/24,192.168.0.1/24

重启fail2ban

systemctl restart fail2ban