姜立伟 發表於 2017-3-30 13:35:08

CentOS下iptables封IP的命令讲解

<p>查看<strong>当天登陆</strong>未成功的IP</p>
<p style="text-align: center"><img alt="" src="https://img.jbzj.com/file_images/article/201703/2017033013291316.png" /></p>
<p>一条命令把这些IP全部封掉:</p>
<p>for i in `grep &quot;$(date +&quot;%b %d&quot;)&quot; /var/log/secure | grep &quot;Failed password&quot; | awk '{print $(NF-3)}' | sort | uniq -c | sort -nr| awk '{print $2}'` ;do iptables -A INPUT -s $i -j DROP; done</p>
<p><strong>效果:</strong></p>
<p style="text-align: center"><img alt="" src="https://img.jbzj.com/file_images/article/201703/2017033013291317.png" /></p>
頁: [1]
查看完整版本: CentOS下iptables封IP的命令讲解