diff options
author | Jim Popovitch <jimpop@gmail.com> | 2013-03-03 03:04:37 -0500 |
---|---|---|
committer | Jim Popovitch <jimpop@gmail.com> | 2013-03-03 03:04:37 -0500 |
commit | 990f7226da9deb667e6b026ba7ae24ef728900c4 (patch) | |
tree | 380bac0ae34e7f0a02a84f0ad36b96bba425a1f4 /Mailman/Handlers | |
parent | ee4bef0ca47fa6c7b5f1874d254572667c12f164 (diff) | |
download | mailman2-990f7226da9deb667e6b026ba7ae24ef728900c4.tar.gz mailman2-990f7226da9deb667e6b026ba7ae24ef728900c4.tar.xz mailman2-990f7226da9deb667e6b026ba7ae24ef728900c4.zip |
Hold/Reject/Discard moderation support for Senders with a DMARC p=reject policy
Diffstat (limited to 'Mailman/Handlers')
-rw-r--r-- | Mailman/Handlers/Moderate.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Mailman/Handlers/Moderate.py b/Mailman/Handlers/Moderate.py index 199c97ac..81b554e4 100644 --- a/Mailman/Handlers/Moderate.py +++ b/Mailman/Handlers/Moderate.py @@ -56,6 +56,31 @@ def process(mlist, msg, msgdata): else: sender = None if sender: + if Utils.IsDmarcProhibited(sender): + # Note that for dmarc_moderation_action, 0==Hold, 1=Reject, + # 2==Discard + if mlist.dmarc_moderation_action == 0: + msgdata['sender'] = sender + Hold.hold_for_approval(mlist, msg, msgdata, + ModeratedMemberPost) + elif mlist.dmarc_moderation_action == 1: + # Reject + text = mlist.dmarc_moderation_notice + if text: + text = Utils.wrap(text) + else: + # Use the default RejectMessage notice string + text = None + raise Errors.RejectMessage, text + elif mlist.dmarc_moderation_action == 2: + raise Errors.DiscardMessage + else: + assert 0, 'bad dmarc_moderation_action' + + # sender's domain has a 'p=reject' _dmarc TXT record, + # we should NOT automatically reflect this email + return + # If the member's moderation flag is on, then perform the moderation # action. if mlist.getMemberOption(sender, mm_cfg.Moderate): |