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 "$(date +"%b %d")" /var/log/secure | grep "Failed password" | 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]