[Mailman-Users] Manually treat certain domains as if they have restrictive DMARC policy

Mark Sapiro mark at msapiro.net
Tue Jan 29 12:40:12 EST 2019


On 1/29/19 6:55 AM, David Gibbs via Mailman-Users wrote:
> 
> I'm by no means a Python expert (far from it), but I hacked this
> together...
> 
> === modified file 'Mailman/Defaults.py.in'
> --- Mailman/Defaults.py.in      2018-07-12 03:14:02 +0000
> +++ Mailman/Defaults.py.in      2019-01-29 14:27:59 +0000
> @@ -145,6 +145,11 @@
>  # GLOBAL_BAN_LIST = ['xxx at aol\.com', '^yyy.*@gmail\.com$']
>  GLOBAL_BAN_LIST = []
> 
> +# Installation wide DMARC list.  This is a list of email addresses and
> +# regexp patterns (beginning with ^) that will be treated as if they
> +# have a restrictive DMARC policy. Same examples as GLOBAL_BAN_LIST
> +GLOBAL_DMARC_LIST = []
> +
>  # If the following is set to Yes, and a web subscribe comes from an IPv4
>  # address and the IP is listed in Spamhaus SBL, CSS or XBL, the subscription
>  # will be blocked.  It will work with IPv6 addresses if Python's py2-ipaddress


The above is good, but you will have to run 'configure' with appropriate
options to propagate that to Defaults.py and then add your actual list
by setting GLOBAL_DMARC_LIST in mm_cfg.py.


> === modified file 'Mailman/Handlers/SpamDetect.py'
> --- Mailman/Handlers/SpamDetect.py      2018-12-01 04:13:12 +0000
> +++ Mailman/Handlers/SpamDetect.py      2019-01-29 14:24:26 +0000
> @@ -110,6 +110,7 @@
>          dn, addr = parseaddr(msg.get('from'))
>          if addr and mlist.dmarc_moderation_action > 0:
>              if (mlist.GetPattern(addr, mlist.dmarc_moderation_addresses) or
> +                mlist.getPattern(addr, mm_cfg.GLOBAL_DMARC_LIST) or

GetPattern, not getPattern. Otherwise good.

>                  Utils.IsDMARCProhibited(mlist, addr)):
>                  # Note that for dmarc_moderation_action, 0 = Accept,
>                  #    1 = Munge, 2 = Wrap, 3 = Reject, 4 = Discard
> 


-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan


More information about the Mailman-Users mailing list