add failed IMAP login script

This commit is contained in:
Oliver Ladner 2017-04-28 20:21:08 +02:00
commit 2ab2381680

9
mail_failed_login.sh Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Author: Oliver Ladner <oli@lugh.ch>
# License: LGPL
#
# Displays a summary of failed IMAP login attempts by country
postfix_logfile='/var/log/mail.log'
for ip in $(grep 'auth failed' $postfix_logfile | awk {'print $17'} | sed 's/,//' | awk -F'=' {'print $2'} | sort -n | uniq); do geoiplookup $ip; done | sort | uniq -c | sort -n | tail -10