1. 파일작성
vi /etc/cron.hourly/block_sshd_failed_user
2. 파일내용
#!/bin/bash
# Script-x by Yunkiman
days=`date +%d`
for i in $( cat /var/log/secure | grep "Failed password for" | awk '$2 = $days {print $13}' | sort | uniq -c | awk '$1 > 5 {print $2}'); do
iptables -I INPUT -s $i -j DROP
done
3. 권한설정
chmod 755 /etc/cron.hourly/block_sshd_failed_user
...[더 보기]