#!/bin/bash
cat /var/log/secure | awk '/Failed/{print $11}' >> ip.txt
for i in
do
x=
if [ $x -gt 5 ];then
firewall-cmd --zone=drop --add-source=$i
fi
done
cat /var/log/secure | awk '/Failed/{print $11}' >> ip.txt
for i in
cat ip.txt
do
x=
awk '{ip[$1]++} END{for (i in ip){print i,ip[i]}}' /ip.txt | awk '{print $2}'
if [ $x -gt 5 ];then
firewall-cmd --zone=drop --add-source=$i
fi
done
本文转自 英强云计算 51CTO博客,原文链接:http://blog.51cto.com/13404755/2051150,如需转载请自行联系原作者