Allow explicitly whitelisted email from banned_users.
This commit is contained in:
+20
-12
@@ -10,6 +10,11 @@
|
|||||||
# CBV results.
|
# CBV results.
|
||||||
#
|
#
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.8 2007/09/03 16:18:45 customdesigned
|
||||||
|
# Delete unparseable timestamps when loading address cache. These have
|
||||||
|
# arisen because of failure to parse MAIL FROM properly. Will have to
|
||||||
|
# tighten up MAIL FROM parsing to match RFC.
|
||||||
|
#
|
||||||
# Revision 1.7 2007/01/25 22:47:26 customdesigned
|
# Revision 1.7 2007/01/25 22:47:26 customdesigned
|
||||||
# Persist blacklisting from delayed DSNs.
|
# Persist blacklisting from delayed DSNs.
|
||||||
#
|
#
|
||||||
@@ -89,8 +94,10 @@ class AddrCache(object):
|
|||||||
except IOError:
|
except IOError:
|
||||||
lock.unlock()
|
lock.unlock()
|
||||||
|
|
||||||
def has_key(self,sender):
|
def has_precise_key(self,sender):
|
||||||
"True if sender is cached and has not expired."
|
"""True if precise sender is cached and has not expired. Don't
|
||||||
|
try looking up wildcard entries.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
lsender = sender and sender.lower()
|
lsender = sender and sender.lower()
|
||||||
ts,res = self.cache[lsender]
|
ts,res = self.cache[lsender]
|
||||||
@@ -98,16 +105,17 @@ class AddrCache(object):
|
|||||||
if not ts or ts > too_old:
|
if not ts or ts > too_old:
|
||||||
return True
|
return True
|
||||||
del self.cache[lsender]
|
del self.cache[lsender]
|
||||||
try:
|
except KeyError: pass
|
||||||
user,host = sender.split('@',1)
|
return False
|
||||||
return self.has_key(host)
|
|
||||||
except ValueError:
|
def has_key(self,sender):
|
||||||
pass
|
"True if sender is cached and has not expired."
|
||||||
except KeyError:
|
if self.has_precise_key(sender):
|
||||||
try:
|
return True
|
||||||
user,host = sender.split('@',1)
|
try:
|
||||||
return self.has_key(host)
|
user,host = sender.split('@',1)
|
||||||
except: pass
|
return self.has_precise_key(host)
|
||||||
|
except: pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
__contains__ = has_key
|
__contains__ = has_key
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
Add parseaddr test case for 'foo@bar.com <baz@barf.biz>'
|
|
||||||
|
|
||||||
Check ESMTP NOTIFY before sending real DSNs. Just use CBV if DSNs are
|
Check ESMTP NOTIFY before sending real DSNs. Just use CBV if DSNs are
|
||||||
not wanted.
|
not wanted.
|
||||||
|
|
||||||
@@ -22,7 +20,8 @@ MTA. The mail is flagged external, so we don't list example.com in
|
|||||||
internal_domains (or we would get "spam from self"). But, if we try to do a
|
internal_domains (or we would get "spam from self"). But, if we try to do a
|
||||||
CBV, we get "fraudulent MX", because the MX is ourself! So we need to
|
CBV, we get "fraudulent MX", because the MX is ourself! So we need to
|
||||||
avoid doing CBV on such domains. Currently, we try to make sure the SPF
|
avoid doing CBV on such domains. Currently, we try to make sure the SPF
|
||||||
policies don't do CBV.
|
policies don't do CBV. The real solution is for users to use SMTP AUTH,
|
||||||
|
but some of them are stubborn.
|
||||||
|
|
||||||
We now don't check internal domains for incoming mail if there is an
|
We now don't check internal domains for incoming mail if there is an
|
||||||
SPF record.
|
SPF record.
|
||||||
@@ -190,6 +189,8 @@ Need a test module to feed sample messages to a milter though a live
|
|||||||
sendmail and SMTP. The mockup currently used is probably not very accurate,
|
sendmail and SMTP. The mockup currently used is probably not very accurate,
|
||||||
and doesn't test the threading code.
|
and doesn't test the threading code.
|
||||||
|
|
||||||
|
DONE Add parseaddr test case for 'foo@bar.com <baz@barf.biz>'
|
||||||
|
|
||||||
DONE Require signed MFROM for all incoming bounces when signing all outgoing
|
DONE Require signed MFROM for all incoming bounces when signing all outgoing
|
||||||
mail - except from trusted relays.
|
mail - except from trusted relays.
|
||||||
|
|
||||||
|
|||||||
@@ -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.121 2008/04/10 14:59:35 customdesigned
|
||||||
|
# Configure gossip TTL.
|
||||||
|
#
|
||||||
# Revision 1.120 2008/04/02 18:59:14 customdesigned
|
# Revision 1.120 2008/04/02 18:59:14 customdesigned
|
||||||
# Release 0.8.10
|
# Release 0.8.10
|
||||||
#
|
#
|
||||||
@@ -1112,10 +1115,13 @@ class bmsMilter(Milter.Milter):
|
|||||||
self.setreply('550','5.7.1','Invalid SES signature')
|
self.setreply('550','5.7.1','Invalid SES signature')
|
||||||
return Milter.REJECT
|
return Milter.REJECT
|
||||||
# reject for certain recipients are delayed until after DATA
|
# reject for certain recipients are delayed until after DATA
|
||||||
if srs_reject_spoofed \
|
if auto_whitelist.has_precise_key(self.canon_from):
|
||||||
and not user.lower() in ('postmaster','abuse'):
|
self.log("WHITELIST: DSN from",self.canon_from)
|
||||||
return self.forged_bounce()
|
else:
|
||||||
self.data_allowed = not srs_reject_spoofed
|
if srs_reject_spoofed \
|
||||||
|
and user.lower() not in ('postmaster','abuse'):
|
||||||
|
return self.forged_bounce()
|
||||||
|
self.data_allowed = not srs_reject_spoofed
|
||||||
|
|
||||||
if not self.internal_connection and domain in private_relay:
|
if not self.internal_connection and domain in private_relay:
|
||||||
self.log('REJECT: RELAY:',to)
|
self.log('REJECT: RELAY:',to)
|
||||||
|
|||||||
Reference in New Issue
Block a user