shell脚本精华----在10秒内SSH登录失败次数超过3次就使用iptables/tcpwrappers拒绝

#!/bin/bash


while true

do

badip=$(lastb -i -a | awk ‘/ssh:notty/ {print $NF}‘|sort|uniq -c|awk ‘($1>3) {print $2}‘)


for i in $badip

do

iptables -t filter -I INPUT -s $i -p tcp --dport 22 -j DROP

done


: > /var/log/btmp

sleep 10s

done


本文出自 “运维!解放!” 博客,谢绝转载!

shell脚本精华----在10秒内SSH登录失败次数超过3次就使用iptables/tcpwrappers拒绝,布布扣,bubuko.com

shell脚本精华----在10秒内SSH登录失败次数超过3次就使用iptables/tcpwrappers拒绝

上一篇:看大师讲解移动互联网前端开发流程


下一篇:iOS 不定参数方法,类似UIAlertView的方法