Use re to recognize failure DSNs.

This commit is contained in:
Stuart Gathman
2006-03-10 20:52:49 +00:00
parent d69b805690
commit 6102d641c5
3 changed files with 30 additions and 7 deletions
+12 -1
View File
@@ -1,6 +1,17 @@
Here is a history of user visible changes to Python milter.
0.8.6
0.8.6 Delay reject of unsigned RCPT for postmaster and abuse only
Fix dsn reporting of hard permerror
Resolve FIXME for wrap_close in miltermodule.c
Add Message-ID to DSNs
Use signed Message-ID in delayed reject to blacklist senders
Auto-train via blacklist and auto-whitelist
Don't check userlist for signed MFROM
Accept but skip DSPAM training for whitelisted senders without SPF PASS
Report GC stats
Support CIDR matching for IP lists
Support pysrs sign feature
Support localpart specific SPF policy in access file
0.8.5 Simple trusted_forwarder implementation.
Fix access_file neutral policy
Move Received-SPF header to beginning of headers
+3
View File
@@ -1,3 +1,6 @@
Make all dictionaries work like honeypot. Do not train as ham unless
whitelisted. Train on blacklisted messages, or spam feedback.
Allow unsigned DSNs from selected domains (that don't accept signed MFROM,
e.g. verizon.net).
+12 -3
View File
@@ -1,6 +1,9 @@
#!/usr/bin/env python
# A simple milter that has grown quite a bit.
# $Log$
# Revision 1.57 2006/03/07 20:50:54 customdesigned
# Use signed Message-ID in delayed reject to blacklist senders
#
# Revision 1.56 2006/02/24 02:12:54 customdesigned
# Properly report hard PermError (lax mode fails also) by always setting
# perm_error attribute with PermError exception. Improve reporting of
@@ -222,6 +225,14 @@ try: import spf
except: spf = None
ip4re = re.compile(r'^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$')
subjpats = (
r'^failure notice',
r'^returned mail',
r'^undeliverable',
r'^delivery\b.*\bfailure',
r'^delivery problem',
)
refaildsn = re.compile('|'.join(subjpats),re.IGNORECASE)
import logging
# Thanks to Chris Liechti for config parsing suggestions
@@ -1168,9 +1179,7 @@ class bmsMilter(Milter.Milter):
# check for delayed bounce of CBV
if self.is_bounce and srs:
for w in ("delivery failure", "failure notice",
"returned mail", "undeliverable"):
if lval.startswith(w):
if refaildsn.match(lval):
self.delayed_failure = val.strip()
# if confirmed by finding our signed Message-ID,
# original sender (encoded in Message-ID) is blacklisted