如何在 CentOS 6/7 上移除被 Fail2ban 禁止的 IP
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 地址,运行下面的命令:
<span class="com">#</span><span class="pln"> iptables </span><span class="pun">-</span><span class="pln">L</span>
<span class="typ">Chain</span><span class="pln"> INPUT </span><span class="pun">(</span><span class="pln">policy ACCEPT</span><span class="pun">)</span>
<span class="pln">target prot opt source destination</span>
<span class="pln">f2b</span><span class="pun">-</span><span class="typ">AccessForbidden</span><span class="pln"> tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere tcp dpt</span><span class="pun">:</span><span class="pln">http</span>
<span class="pln">f2b</span><span class="pun">-</span><span class="typ">WPLogin</span><span class="pln"> tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere tcp dpt</span><span class="pun">:</span><span class="pln">http</span>
<span class="pln">f2b</span><span class="pun">-</span><span class="typ">ConnLimit</span><span class="pln"> tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere tcp dpt</span><span class="pun">:</span><span class="pln">http</span>
<span class="pln">f2b</span><span class="pun">-</span><span class="typ">ReqLimit</span><span class="pln"> tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere tcp dpt</span><span class="pun">:</span><span class="pln">http</span>
<span class="pln">f2b</span><span class="pun">-</span><span class="typ">NoAuthFailures</span><span class="pln"> tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere tcp dpt</span><span class="pun">:</span><span class="pln">http</span>
<span class="pln">f2b</span><span class="pun">-</span><span class="pln">SSH tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere tcp dpt</span><span class="pun">:</span><span class="kwd">ssh</span>
<span class="pln">f2b</span><span class="pun">-</span><span class="pln">php</span><span class="pun">-</span><span class="pln">url</span><span class="pun">-</span><span class="pln">open tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere tcp dpt</span><span class="pun">:</span><span class="pln">http</span>
<span class="pln">f2b</span><span class="pun">-</span><span class="pln">nginx</span><span class="pun">-</span><span class="pln">http</span><span class="pun">-</span><span class="pln">auth tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere multiport dports http</span><span class="pun">,</span><span class="pln">https</span>
<span class="pln">ACCEPT all </span><span class="pun">--</span><span class="pln"> anywhere anywhere state RELATED</span><span class="pun">,</span><span class="pln">ESTABLISHED</span>
<span class="pln">ACCEPT icmp </span><span class="pun">--</span><span class="pln"> anywhere anywhere</span>
<span class="pln">ACCEPT all </span><span class="pun">--</span><span class="pln"> anywhere anywhere</span>
<span class="pln">ACCEPT tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere tcp dpt</span><span class="pun">:</span><span class="typ">EtherNet</span><span class="pun">/</span><span class="pln">IP</span><span class="pun">-</span><span class="lit">1</span>
<span class="pln">ACCEPT tcp </span><span class="pun">--</span><span class="pln"> anywhere anywhere tcp dpt</span><span class="pun">:</span><span class="pln">http</span>
<span class="pln">REJECT all </span><span class="pun">--</span><span class="pln"> anywhere anywhere reject</span><span class="pun">-</span><span class="kwd">with</span><span class="pln"> icmp</span><span class="pun">-</span><span class="pln">host</span><span class="pun">-</span><span class="pln">prohibited</span>
<span class="typ">Chain</span><span class="pln"> FORWARD </span><span class="pun">(</span><span class="pln">policy ACCEPT</span><span class="pun">)</span>
<span class="pln">target prot opt source destination</span>
<span class="pln">REJECT all </span><span class="pun">--</span><span class="pln"> anywhere anywhere reject</span><span class="pun">-</span><span class="kwd">with</span><span class="pln"> icmp</span><span class="pun">-</span><span class="pln">host</span><span class="pun">-</span><span class="pln">prohibited</span>
<span class="typ">Chain</span><span class="pln"> OUTPUT </span><span class="pun">(</span><span class="pln">policy ACCEPT</span><span class="pun">)</span>
<span class="pln">target prot opt source destination</span>
<span class="typ">Chain</span><span class="pln"> f2b</span><span class="pun">-</span><span class="typ">NoAuthFailures</span><span class="pun">(</span><span class="lit">1</span><span class="pln"> references</span><span class="pun">)</span>
<span class="pln">target prot opt source destination</span>
<span class="pln">REJECT all </span><span class="pun">--</span><span class="lit">64.68</span><span class="pun">.</span><span class="lit">50.128</span><span class="pln"> anywhere reject</span><span class="pun">-</span><span class="kwd">with</span><span class="pln"> icmp</span><span class="pun">-</span><span class="pln">port</span><span class="pun">-</span><span class="pln">unreachable</span>
<span class="pln">REJECT all </span><span class="pun">--</span><span class="lit">104.194</span><span class="pun">.</span><span class="lit">26.205</span><span class="pln"> anywhere reject</span><span class="pun">-</span><span class="kwd">with</span><span class="pln"> icmp</span><span class="pun">-</span><span class="pln">port</span><span class="pun">-</span><span class="pln">unreachable</span>
<span class="pln">RETURN all </span><span class="pun">--</span><span class="pln"> anywhere anywhere</span>
如何从 Fail2ban 中移除 IP
<span class="com">#</span><span class="pln"> iptables </span><span class="pun">-</span><span class="pln">D f2b</span><span class="pun">-</span><span class="typ">NoAuthFailures</span><span class="pun">-</span><span class="pln">s banned_ip </span><span class="pun">-</span><span class="pln">j REJECT</span>
我希望这篇教程可以给你在 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/
相关推荐
changecan 2020-11-19
ECSHOP专属建设 2020-11-13
88427810 2020-11-02
步知道 2020-10-27
Junzizhiai 2020-10-10
jackalwb 2020-10-05
小网管 2020-09-03
shiwenqiang 2020-09-14
85251846 2020-09-14
summerinsist 2020-08-21
87901735 2020-08-19
PinkBean 2020-08-11
85407718 2020-08-09
MichelinMessi 2020-07-30
suosuo 2020-07-28
CARBON 2020-07-28
lizhengfa 2020-07-27
88427810 2020-07-26