1. 错误登陆IP降序排列
lastb | awk '{a[$3]++}END{for(i in a){print i,a[i] | "sort -k 2 -rn"}}'|head -50|awk '{print $1}'|sed 's/^/sshd,vsftpd : &/g' >> /etc/hosts.deny
cat /etc/hosts.deny | sort | uniq >tmp
cat tmp > /etc/hosts.deny
2. crontab
0 * * * * /root/ban_ip.sh
阅读(582) | 评论(0) | 转发(0) |