fail2ban.action 错误 iptables -w -N f2b-<jail-name>

Gre*_*ech 4 linux iptables centos fail2ban

我一直在使用fail2ban 没有任何问题。

前几天,我决定停止 fail2ban 以从我的默认 iptables 中删除一个规则。当我启动fail2ban时,它启动正常(根据命令:service fail2ban start)。

但是,当我检查 iptables 时,我没有看到添加了 fail2ban 链。我检查了fail2ban日志,发现了几个这样的错误:

fail2ban.action [32091]: 错误 iptables -w -N f2b- iptables -w -I INPUT -p tcp -m multiport --dports 0:65535 -j f2b- -- stderr: "iptables v1.4.7: option -w' requires an argument\nTryiptables - h' 或 'iptables --help' 获取更多信息。\niptables v1.4.7:选项-w' requires an argument\nTryiptables -h' 或 'iptables --help' 获取更多信息。\niptables v1.4.7:选项-w' requires an argument\nTryiptables -h' 或 'iptables - -help' 了解更多信息。\n"

从这个日志来看,fail2ban 似乎正在尝试使用-w不存在的选项运行 iptables 。我检查了所有的 fail2ban 配置文件,特别是在 action.d 目录下,没有一行包含该-w选项。这有多奇怪?

我不知道这里发生了什么,因此我无法使用 fail2ban。

我感谢您的帮助。

use*_*517 7

-w选项不在您的 iptables 1.4.7 版本中,它的用法在 /etc/fail2ban/action.d/iptables-common.conf 文件中说明

# Option:  lockingopt
# Notes.:  Option was introduced to iptables to prevent multiple instances from
#          running concurrently and causing irratic behavior.  -w was introduced
#          in iptables 1.4.20, so might be absent on older systems
#          See https://github.com/fail2ban/fail2ban/issues/1122
# Values:  STRING
lockingopt = -w
Run Code Online (Sandbox Code Playgroud)

我很想从上面的声明中删除 -w,甚至将其注释掉,看看发生了什么。


检查您的 yum.log 以查看最近是否更新了 fail2ban。如果是这样,请查看它何时发生并检查您是否有 yumcron 作业正在运行。