15.1 Fail2Ban(基于 IPFW、PF 与 IPF)
安装 Fail2Ban
# pkg install security/py-fail2ban# cd /usr/ports/security/py-fail2ban/
# make install clean# service fail2ban enable查看 fail2ban 安装后说明
# pkg info -D security/py-fail2ban
py311-fail2ban-1.1.0_1:
On install:
Please do not edit the fail2ban.conf, jail.conf, or any other
files in the distributen as they will be overwritten upon each
upgrade of the port. Instead, create new files named *.local e.g.
fail2ban.local or jail.local.
# 请不要直接修改 fail2ban.conf、jail.conf 或其他官方提供的配置文件
# 因为它们在每次升级软件包时会被覆盖
# 应该创建 *.local 文件,如 fail2ban.local 或 jail.local,来自定义配置。
For more information, see the official manual:
http://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Configuration
# 更多信息可参见官方手册。
If you have custom filters or actions and you are upgrading from
0.9.x please check them.
# 如果你定义了自定义过滤器或操作,且从 0.9.x 升级而来,请检查其兼容性。
Users of pf: please read the notes in action.d/pf.conf and the
discussion at https://github.com/fail2ban/fail2ban/pull/1925
# 使用 pf 防火墙的用户请阅读 action.d/pf.conf 中的注释,
# 以及上面 GitHub 讨论链接中的相关说明。
Please note that fail2ban will put curly braces '{}' around the
ports in the action so you shouldn't do it yourself.
# 注意:fail2ban 会自动在动作命令中将端口号用大括号 {} 包裹,
# 因此你自己不需要再加。Fail2Ban 配置解释
Fail2Ban 封禁配置
配置防火墙
IPFW
配置自启服务
修改 IPFW 默认规则
参考文献
PF
fail2ban 配置文件
修改 PF 配置文件
服务
IPFILTER (IPF)
fail2ban 配置文件
服务
测试效果
查看状态
解禁 IP
故障排除与未竟事宜
最后更新于