所以我在我的Debian 7服务器上设置了fail2ban,但是我一直受到很多打击,我不知道为什么不能正确阻塞。 正则expression式的工作,它承认尝试,但它似乎插入的iptables规则不会工作,这是它看起来如何iptables输出看起来fail2ban试图阻止。
Chain INPUT (policy ACCEPT) num target prot opt source destination 1 fail2ban-courierauth tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 2 fail2ban-couriersmtp tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 3 sshguard all -- 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination Chain fail2ban-courierauth (1 references) num target prot opt source destination 1 DROP all -- 216.xyz 0.0.0.0/0 2 RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain fail2ban-courierimap (0 references) num target prot opt source destination 1 RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain fail2ban-courierpop3 (0 references) num target prot opt source destination 1 RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain fail2ban-couriersmtp (1 references) num target prot opt source destination 1 RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain fail2ban-postfix (0 references) num target prot opt source destination 1 RETURN all -- 0.0.0.0/0 0.0.0.0/0 Chain fail2ban-sasl (0 references) num target prot opt source destination 1 RETURN all -- 0.0.0.0/0 0.0.0.0/0
在上面的iptables中,你可以看到“链fail2ban-courierauth”规则,添加了ip的丢弃规则,但我仍然能够连接!
我仍然可以连接到服务器,为什么不阻塞?
(我会发表这个主要是要求澄清作为一个评论,但我没有足够的噶做评论呢| |)
有风险陈述明显 – 当你说你“仍然可以连接到服务器”; 你的意思是25号港口吗? 因为你所configuration的iptables规则只会匹配(和阻止)你对25端口的访问,假设你到端口25的服务器的连接来自你已经列为阻塞的216.xyz IP。
你的iptables链configuration方式和我的一样(也是使用Debian),我的工作可以阻止对特定服务的访问 – 所以我不认为这是必须指责的iptablesconfiguration,只要你只是期待它只是阻止端口25,而不是整个服务器,你没有什么奇怪的PREROUTING,可能会转移stream量远离在INPUT处理。