From 82cf5b72e4893036ce175480b49171c4dcebfbcf Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Fri, 21 Nov 2014 16:30:12 +0000 Subject: [PATCH] simplify some output in the work-in-progress mail log scanner --- management/mail_log.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/management/mail_log.py b/management/mail_log.py index 7dac7c73..1d8d1299 100755 --- a/management/mail_log.py +++ b/management/mail_log.py @@ -96,6 +96,21 @@ def scan_postfix_smtpd_line(date, log, collector): message, sender, recipient = m.groups() if recipient in collector["real_mail_addresses"]: # only log mail to real recipients + + # skip this, is reported in the greylisting report + if "Recipient address rejected: Greylisted" in message: + return + + # simplify this one + m = re.search(r"Client host \[(.*?)\] blocked using zen.spamhaus.org; (.*)", message) + if m: + message = "ip blocked: " + m.group(2) + + # simplify this one too + m = re.search(r"Sender address \[.*@(.*)\] blocked using dbl.spamhaus.org; (.*)", message) + if m: + message = "domain blocked: " + m.group(2) + collector["rejected-mail"].setdefault(recipient, []).append( (date, sender, message) )