我已经配置了 fail2ban 来监控我收到的某种恶意流量模式并禁止关联的 IP 地址。
一切似乎都运行良好——正则表达式正在适当地匹配模式,并且问题 IP 地址正在添加到 iptables。
但是,当我检查 Apache 日志时,我仍然收到来自被禁止的 IP 地址的点击。就好像 iptables 根本没有运行一样。
所以让我分享一些细节只是为了确认一切都配置正确。
首先,我将清除并重新加载 iptables 规则:
$ sudo iptables -F
$ cat /etc/iptables.firewall.rules
*filter
# Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT -d 127.0.0.0/8 -j REJECT
# Accept all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all outbound traffic - you can …
Run Code Online (Sandbox Code Playgroud)