配置复杂
- 发行版不一样,基本原理应该差不多
- 版本不一样,配置略有差异
~ > fail2ban-client --version took 39s with hty30917@archlinux at 11:33:36
Fail2Ban v1.0.2
- 配置文件在/etc/fail2ban目录中,优先级如下,右边大于左边
fail2ban<模块(比如jail)<filter<action
*.conf<同名.local
错误现象
发现fail2ban显示ip已经banned,但实际却没有屏蔽
这现象用systemctl status和fail2ban-client status命令都不会报错.
查看日志,有 iptables: No chain/target/match by that name 等前后一串错误.
原因是fail2ban的规则没有插入iptables里,正确的如下:
~ > sudo iptables -L took 31s with hty30917@archlinux at 11:31:32
Chain INPUT (policy ACCEPT)
target prot opt source destination
f2b-sshd tcp -- anywhere anywhere tcp dpt:ssh
可能是内核版本问题,我是重新启机就有了.
如果发现fail2ban显示ip已经banned,但实际却没有,很有可能是这个问题.具体看log!!!