if [ `grep $ip /root/iplist | awk '{print $1}'` -gt $LIMIT ]
then
echo "15 connection from $ip... `grep $ip /root/iplist | awk '{print $1}'` number of connections... Blocking $ip";
#Blocking the ip ...
CHECK_IF_LOCALIP=0;
/sbin/ifconfig | grep $ip > /dev/null;
if [ $? -ne $CHECK_IF_LOCALIP ]
then {
FLAG=0;
grep $ip /etc/csf/csf.deny > /dev/null;
if [ $? -ne $FLAG ]
then
iptables -I INPUT -s $ip -j DROP;
echo "deny $ip;" >> /usr/local/nginx/conf/vhost/block.conf;
/usr/sbin/csf -d $ip;
~/lnmp reload;
else
echo " Ipaddress $ip is already blocked ";
fi
}
else
echo " Sorry, the ip $ip cannot be blocked since this is a local ip of the server ";
fi
fi
done