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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章