Created
September 30, 2014 11:47
-
-
Save SVilgelm/3c373f846ad7b0441c17 to your computer and use it in GitHub Desktop.
server hints
This file contains hidden or 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
#/etc/rc.local | |
ipset create black_ips hash:ip | |
iptables -A INPUT -m set --match-set black_ips src -j DROP | |
grep "Failed password for" /var/log/auth.log | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort | uniq -c | awk '$1 > 5 { print $2}' | xargs -I{} ipset add black_ips {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment