Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Look for "already" banned IP
- if tail -n 1 /var/log/fail2ban.log | grep -q already
- then
- IP=$(awk -F' ' 'END{print $6}' /var/log/fail2ban.log)
- else
- exit
- fi
- #Look if IP is already in hosts.deny
- if grep -q $IP /etc/hosts.deny
- then
- exit
- else
- echo ALL: $IP >> /etc/hosts.deny
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement