Created
February 13, 2015 16:38
-
-
Save rhenning/fccfad3dace3375ac2e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
awk '/proftp.*successful/ { print $7 }' /var/log/secure{,.?} \ | |
| cut -f1 -d\[ \ | |
| tr -d '(' \ | |
| sort \ | |
| uniq \ | |
| while read ip ; do | |
echo flushing $ip from banlist... | |
for chain in fail2ban-{,REPEAT-}SFTP ; do | |
/sbin/iptables -D $chain -s $ip -j DROP 2>/dev/null | |
done | |
sed -i "/${ip}/d" /etc/fail2ban/ip.blocklist.SFTP | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment