fail2ban

1,安装fail2ban,首先安装一下epel-release
[root@localhost~]# yum -y install epel-release
[root@localhost~]# yum -y install fail2ban
2,启动fail2ban
[root@localhost~]# systemctl start fail2ban

3,修改防爆力破解的配置文件
[root@localhost~]# vim /etc/fail2ban/jail.d/jail.local
[DEFAULT]
ignoreip=127.0.0.1/24
bantime=3600 ##非法ip被屏蔽时间(秒)
findtime=600
maxretry=2 ##最大尝试次数

[ssh-iptables]
enabled=true ##是否开启防护
filter=sshd ##过滤规则filter名称, 对应的目录为sshd.conf
action=iptables[name=SSH,port=ssh,portocol=tcp] ##动作参数
logpath=/var/log/secure

添加这些参数,保存退出

4,生效fail2ban
[root@localhost~]# fail2ban-client reload
[root@localhost~]# systemctl start fail2ban
[root@localhost~]# systemctl enable fail2ban
查看当前被禁止登陆的ip:fail2ban-client status ssh-iptables
添加禁止ip: fail2ban-client set ssh-iptables banip 192.168.1.77
删除禁止ip: fail2ban-client set ssh-iptables unbanip 192.168.0.142

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值