From 96f5b6e9dcfcc92eade81026923d86ea1b8015a5 Mon Sep 17 00:00:00 2001 From: Stuart Gathman Date: Sat, 11 Oct 2008 15:45:46 +0000 Subject: [PATCH] Don't greylist DSNs. --- ban2zone.py | 16 ++++++++++++++++ bms.py | 6 +++++- milter.cfg | 6 +++--- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 ban2zone.py diff --git a/ban2zone.py b/ban2zone.py new file mode 100644 index 0000000..ec0e31e --- /dev/null +++ b/ban2zone.py @@ -0,0 +1,16 @@ +#!/usr/bin/python2.4 + +# Convert banned ip list to zonefile data suitable for use as a +# DNS blacklist with BIND. This is a way to share your banned ips +# with friends. + +import socket +import sys +from glob import glob + +banned_ips = [socket.inet_aton(ip) for fn in sys.argv[1:] for ip in open(fn)] +banned_ips.sort() +for ip in banned_ips: + a = socket.inet_ntoa(ip).split('.') + a.reverse() + print "%s\tIN A 127.0.0.2"%('.'.join(a)) diff --git a/bms.py b/bms.py index 1985e40..fcd31dd 100644 --- a/bms.py +++ b/bms.py @@ -1,6 +1,9 @@ #!/usr/bin/env python # A simple milter that has grown quite a bit. # $Log$ +# Revision 1.133 2008/10/09 18:44:54 customdesigned +# Skip greylisting for good reputation. +# # Revision 1.132 2008/10/09 00:55:13 customdesigned # Don't reset greylist timer on early retries. # @@ -1163,6 +1166,7 @@ class bmsMilter(Milter.Milter): self.log("srs rcpt:",newaddr) self.dspam = False # verified as reply to mail we sent self.blacklist = False + self.greylist = False self.delayed_failure = False except: if not (self.internal_connection or self.trusted_relay): @@ -1231,7 +1235,7 @@ class bmsMilter(Milter.Milter): except: self.log("rcpt to",to,str) raise - if self.greylist and greylist: + if self.greylist and greylist and self.canon_from: # no policy for trusted or internal rc = greylist.check(self.connectip,self.canon_from,canon_to) if rc == 0: diff --git a/milter.cfg b/milter.cfg index f6c9213..544eca9 100644 --- a/milter.cfg +++ b/milter.cfg @@ -230,6 +230,6 @@ blind = 1 [greylist] dbfile=greylist.db -grey_time=10 # mins -grey_expire=4 # hours -grey_retain=36 # days +grey_time=5 # mins (Google retries in 5 mins) +grey_expire=6 # hours (some legit sites don't retry for 6 hours) +grey_retain=36 # days (keep "first monday" type mailings on file)