如何在 CentOS 6/7 上移除被 Fail2ban 禁止的 IP

贊 回覆發表於2015-12-09

fail2ban 是一款用於保護你的伺服器免於暴力攻擊的入侵保護軟體。fail2ban 用 python 寫成,並廣泛用於很多伺服器上。fail2ban 會掃描日誌檔案和 IP 黑名單來顯示惡意軟體、過多的密碼失敗嘗試、web 伺服器利用、wordpress 外掛攻擊和其他漏洞。如果你已經安裝並使用了 fail2ban 來保護你的 web 伺服器,你也許會想知道如何在 CentOS 6、CentOS 7、RHEL 6、RHEL 7 和 Oracle Linux 6/7 中找到被 fail2ban 阻止的 IP,或者你想將 ip 從 fail2ban 監獄中移除。

如何列出被禁止的 IP

要檢視所有被禁止的 ip 地址,執行下面的命令:

# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
f2b-AccessForbidden  tcp  --  anywhere             anywhere            tcp dpt:http
f2b-WPLogin  tcp  --  anywhere             anywhere            tcp dpt:http
f2b-ConnLimit  tcp  --  anywhere             anywhere            tcp dpt:http
f2b-ReqLimit  tcp  --  anywhere             anywhere            tcp dpt:http
f2b-NoAuthFailures  tcp  --  anywhere             anywhere            tcp dpt:http
f2b-SSH    tcp  --  anywhere             anywhere            tcp dpt:ssh
f2b-php-url-open  tcp  --  anywhere             anywhere            tcp dpt:http
f2b-nginx-http-auth  tcp  --  anywhere             anywhere            multiport dports http,https
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:EtherNet/IP-1
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination


Chain f2b-NoAuthFailures (1 references)
target     prot opt source               destination
REJECT     all  --  64.68.50.128         anywhere            reject-with icmp-port-unreachable
REJECT     all  --  104.194.26.205       anywhere            reject-with icmp-port-unreachable
RETURN     all  --  anywhere             anywhere

如何從 Fail2ban 中移除 IP

# iptables -D f2b-NoAuthFailures -s banned_ip -j REJECT

我希望這篇教程可以給你在 CentOS 6、CentOS 7、RHEL 6、RHEL 7 和 Oracle Linux 6/7 中移除被禁止的 ip 一些指導。


via: http://www.ehowstuff.com/how-to-remove-banned-ip-from-fail2ban-on-centos/

作者:skytech 譯者:geekpi 校對:wxy

本文由 LCTT 原創編譯,Linux中國 榮譽推出

相關文章