User specific SPF receiver policy.

This commit is contained in:
Stuart Gathman
2006-02-16 02:16:36 +00:00
parent 18759c3698
commit 8d02ab1771
2 changed files with 31 additions and 6 deletions
+18
View File
@@ -1,3 +1,21 @@
Allow verified hostnames for trusted_relay. E.g. HELO name that
passes SPF.
Table of sendmail macros for documentation.
When do we get two hello calls? STARTTLS is one reason.
Option: accept mail from auto-whitelisted senders even with spf-fail,
but do not update dspam. This can be done for individual senders or domains
using the access file.
pysrs: SRS doesn't get applied to proper recipients when there are
multiple recipients. This requires debugging cf scripts - yuk.
auto_whitelist false_positives from quarantine - perhaps only when
user selects special button (use special header to communicate
that from dspamcgi.py to milter.)
Use send_dsn.log for blacklist also. AddrCache needs localpart Use send_dsn.log for blacklist also. AddrCache needs localpart
wildcard (e.g. empty localpart). wildcard (e.g. empty localpart).
+10 -3
View File
@@ -1,6 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
# A simple milter that has grown quite a bit. # A simple milter that has grown quite a bit.
# $Log$ # $Log$
# Revision 1.53 2006/02/12 04:15:01 customdesigned
# Remove spf dependency for iniplist
#
# Revision 1.52 2006/02/12 02:12:08 customdesigned # Revision 1.52 2006/02/12 02:12:08 customdesigned
# Use CIDR notation for internal connect list. # Use CIDR notation for internal connect list.
# #
@@ -492,8 +495,9 @@ def parse_header(val):
class SPFPolicy(object): class SPFPolicy(object):
"Get SPF policy by result, defaulting to classic policy from pymilter.cfg" "Get SPF policy by result, defaulting to classic policy from pymilter.cfg"
def __init__(self,domain): def __init__(self,sender):
self.domain = domain.lower() self.sender = sender
self.domain = sender.split('@')[-1].lower()
if access_file: if access_file:
try: acf = anydbm.open(access_file,'r') try: acf = anydbm.open(access_file,'r')
except: acf = None except: acf = None
@@ -503,6 +507,9 @@ class SPFPolicy(object):
def getPolicy(self,pfx): def getPolicy(self,pfx):
acf = self.acf acf = self.acf
if not acf: return None if not acf: return None
try:
return acf[pfx + self.sender]
except KeyError:
try: try:
return acf[pfx + self.domain] return acf[pfx + self.domain]
except KeyError: except KeyError:
@@ -895,7 +902,7 @@ class bmsMilter(Milter.Milter):
self.cbv_needed = (q,res) # report SPF syntax error to sender self.cbv_needed = (q,res) # report SPF syntax error to sender
res,code,txt = q.perm_error.ext # extended (lax processing) result res,code,txt = q.perm_error.ext # extended (lax processing) result
txt = 'EXT: ' + txt txt = 'EXT: ' + txt
p = SPFPolicy(q.o) p = SPFPolicy(q.s)
if res not in ('pass','error','temperror'): if res not in ('pass','error','temperror'):
if self.mailfrom != '<>': if self.mailfrom != '<>':
# check hello name via spf unless spf pass # check hello name via spf unless spf pass