- 工信部备案号 滇ICP备05000110号-1
- 滇公安备案 滇53010302000111
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
#!/bin/bash
#Denyhosts SHELL SCRIPT
#2017-01-24
#
#When a IP is accessed 50 times through sshd, it is written to the hosts.deny file,
#which prohibits the IP from connecting to the host via sshd
#
#Add to timing task
cat /var/log/secure | awk '/Failed/{print $(NF-3)}' | sort | uniq -c | awk '{print $2"="$1;}' > /root/black.txt
DEFINE=50
for i in $(cat /root/black.txt)
do
IP=$( $i | awk -F'=' '{print $1}')
NUM=$( $i | awk -F'=' '{print $2}')
if [$NUM -gt $DEFINE]; then
grep $IP /etc/hosts.deny > /dev/null
if [$? -gt 0];then
echo "sshd:$IP" >> /etc/hosts.deny
fi
fi
done
售前咨询
售后咨询
备案咨询
二维码
TOP