aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Popovitch <jimpop@domainmail.org>2018-11-30 22:53:02 +0000
committerJim Popovitch <jimpop@domainmail.org>2018-11-30 22:53:02 +0000
commita6a9e9960a6e300630ee46b04831850d0bfec50d (patch)
treef1005e523d0598e6cd5e6ba1cccf39df8c4dcab5
parentd03507def644416adf753098173220be6f75c137 (diff)
downloadmailman2-a6a9e9960a6e300630ee46b04831850d0bfec50d.tar.gz
mailman2-a6a9e9960a6e300630ee46b04831850d0bfec50d.tar.xz
mailman2-a6a9e9960a6e300630ee46b04831850d0bfec50d.zip
Patch for dmarc_moderation_addresses to automatically apply dmarc_moderation_action against a regexp of addresess
-rw-r--r--Mailman/Gui/Privacy.py12
-rw-r--r--Mailman/Handlers/SpamDetect.py2
-rw-r--r--Mailman/MailList.py1
-rw-r--r--Mailman/Version.py2
-rw-r--r--Mailman/versions.py1
5 files changed, 16 insertions, 2 deletions
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
+ <a href="?VARHELP=privacy/sender/dmarc_moderation_action"
+ >dmarc_moderation_action</a>
+ regardless of any domain specific DMARC Policy."""),
+
+ _("""Postings from any of these members will automatically
+ apply DMARC action mitigation.
+
+ <p>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',