From a6a9e9960a6e300630ee46b04831850d0bfec50d Mon Sep 17 00:00:00 2001 From: Jim Popovitch Date: Fri, 30 Nov 2018 22:53:02 +0000 Subject: Patch for dmarc_moderation_addresses to automatically apply dmarc_moderation_action against a regexp of addresess --- Mailman/Gui/Privacy.py | 12 ++++++++++++ Mailman/Handlers/SpamDetect.py | 2 +- Mailman/MailList.py | 1 + Mailman/Version.py | 2 +- Mailman/versions.py | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) (limited to 'Mailman') diff --git a/Mailman/Gui/Privacy.py b/Mailman/Gui/Privacy.py index 4df63da1..e171389f 100644 --- a/Mailman/Gui/Privacy.py +++ b/Mailman/Gui/Privacy.py @@ -356,6 +356,18 @@ class Privacy(GUIBase): be sent to anyone who posts to this list from a domain with a DMARC Reject%(quarantine)s Policy.""")), + ('dmarc_moderation_addresses', mm_cfg.EmailListEx, (10, WIDTH), 1, + _("""List of addresses (or regexps) whose posts should always apply + dmarc_moderation_action + regardless of any domain specific DMARC Policy."""), + + _("""Postings from any of these members will automatically + apply DMARC action mitigation. + +

Add member addresses one per line; start the line with a ^ + character to designate a regular expression match.""")), + ('dmarc_wrapped_message_text', mm_cfg.Text, (10, WIDTH), 1, _("""If dmarc_moderation_action applies and is Wrap Message, and this text is provided, the text will be placed in a diff --git a/Mailman/Handlers/SpamDetect.py b/Mailman/Handlers/SpamDetect.py index 7e035184..73fc758f 100644 --- a/Mailman/Handlers/SpamDetect.py +++ b/Mailman/Handlers/SpamDetect.py @@ -109,7 +109,7 @@ def process(mlist, msg, msgdata): msgdata['from_is_list'] = 0 dn, addr = parseaddr(msg.get('from')) if addr and mlist.dmarc_moderation_action > 0: - if Utils.IsDMARCProhibited(mlist, addr): + if mlist.GetPattern(addr, mlist.dmarc_moderation_addresses, at_list='dmarc_moderation_addresses') or Utils.IsDMARCProhibited(mlist, addr): # Note that for dmarc_moderation_action, 0 = Accept, # 1 = Munge, 2 = Wrap, 3 = Reject, 4 = Discard if mlist.dmarc_moderation_action == 1: diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 8e2518c5..d74978af 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -424,6 +424,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, self.dmarc_none_moderation_action = ( mm_cfg.DEFAULT_DMARC_NONE_MODERATION_ACTION) self.dmarc_moderation_notice = '' + self.dmarc_moderation_addresses = [] self.dmarc_wrapped_message_text = ( mm_cfg.DEFAULT_DMARC_WRAPPED_MESSAGE_TEXT) self.equivalent_domains = ( diff --git a/Mailman/Version.py b/Mailman/Version.py index da704882..f607c126 100644 --- a/Mailman/Version.py +++ b/Mailman/Version.py @@ -37,7 +37,7 @@ HEX_VERSION = ((MAJOR_REV << 24) | (MINOR_REV << 16) | (MICRO_REV << 8) | (REL_LEVEL << 4) | (REL_SERIAL << 0)) # config.pck schema version number -DATA_FILE_VERSION = 110 +DATA_FILE_VERSION = 111 # qfile/*.db schema version number QFILE_SCHEMA_VERSION = 3 diff --git a/Mailman/versions.py b/Mailman/versions.py index 428bb0af..d317a46d 100644 --- a/Mailman/versions.py +++ b/Mailman/versions.py @@ -497,6 +497,7 @@ def NewVars(l): add_only_if_missing('dmarc_none_moderation_action', mm_cfg.DEFAULT_DMARC_NONE_MODERATION_ACTION) add_only_if_missing('dmarc_moderation_notice', '') + add_only_if_missing('dmarc_moderation_addresses', []) add_only_if_missing('dmarc_wrapped_message_text', mm_cfg.DEFAULT_DMARC_WRAPPED_MESSAGE_TEXT) add_only_if_missing('member_verbosity_threshold', -- cgit v1.2.3 From 3242707ec3214cb0ca9c639b99617f69f94f0d05 Mon Sep 17 00:00:00 2001 From: Jim Popovitch Date: Sat, 1 Dec 2018 04:13:12 +0000 Subject: Updated SpamDetect.py and VARHELP based on feedback from Mark S. --- Mailman/Gui/Privacy.py | 6 ++++-- Mailman/Handlers/SpamDetect.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'Mailman') diff --git a/Mailman/Gui/Privacy.py b/Mailman/Gui/Privacy.py index e171389f..13d1f2e8 100644 --- a/Mailman/Gui/Privacy.py +++ b/Mailman/Gui/Privacy.py @@ -362,8 +362,10 @@ class Privacy(GUIBase): >dmarc_moderation_action regardless of any domain specific DMARC Policy."""), - _("""Postings from any of these members will automatically - apply DMARC action mitigation. + _("""Postings from any of these addresses will automatically + apply any DMARC action mitigation. This can be utilized to + automatically wrap or munge postings from known addresses or + domains such as internal domains.

Add member addresses one per line; start the line with a ^ character to designate a regular expression match.""")), diff --git a/Mailman/Handlers/SpamDetect.py b/Mailman/Handlers/SpamDetect.py index 73fc758f..cf41303f 100644 --- a/Mailman/Handlers/SpamDetect.py +++ b/Mailman/Handlers/SpamDetect.py @@ -109,7 +109,8 @@ def process(mlist, msg, msgdata): msgdata['from_is_list'] = 0 dn, addr = parseaddr(msg.get('from')) if addr and mlist.dmarc_moderation_action > 0: - if mlist.GetPattern(addr, mlist.dmarc_moderation_addresses, at_list='dmarc_moderation_addresses') or Utils.IsDMARCProhibited(mlist, addr): + if (mlist.GetPattern(addr, mlist.dmarc_moderation_addresses) or + Utils.IsDMARCProhibited(mlist, addr)): # Note that for dmarc_moderation_action, 0 = Accept, # 1 = Munge, 2 = Wrap, 3 = Reject, 4 = Discard if mlist.dmarc_moderation_action == 1: -- cgit v1.2.3