Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- while;;
- do
- for ip in `lsof -ni | grep httpd | grep -iv listen | awk '{print $8}' | cut -d : -f 2 | sort | uniq | sed s/"http->"//`;
- do
- noconns=`lsof -ni | grep $ip | wc -l`;
- echo $ip : $noconns;
- if [ "$noconns" -gt "20" ];
- then
- iptables -I INPUT -s $ip -p tcp -j REJECT --reject-with tcp-reset
- else
- fi;
- done
- sleep 60
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement