Created
January 24, 2011 18:03
-
-
Save pbalduino/793621 to your computer and use it in GitHub Desktop.
Script to autoblock break attempts via SSH with UFW
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
#!/bin/sh | |
USER=johndoe | |
echo "[Running: $(date)]" >> /var/log/autoblock.log | |
grep -a -E -e 'Failed password for' /var/log/auth.log | awk '$9 != "$USER" && $9 != "invalid" {print "ufw deny from "$11}' | sh | grep -vi "skipping" >> /var/log/autoblock.log | |
grep -a -E -e 'Failed password for invalid' /var/log/auth.log | awk '$11 != "$USER" {print "ufw deny from "$13}' | sh | grep -vi "skipping" >> /var/log/autoblock.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment