
On 10/12/2017 12:37 PM, Lindsay Haisley wrote:
So, if someone could give me a few pointers to the relevant code in Mailman 2, and any suggestions which might save me some time, I can take it from there. I'm python-literate and have hacked our copy of Mailman here in the past - perhaps more than is wise since every time I upgrade I need to apply a number of patches to bring my mods along with the upgrade :)
There are two pieces to this in Mailman (both 2.1 and 3.1). One piece is determining the DMARC policy of the From: domain. In MM 2, the code that does this is in Mailman/Utils.py beginning with the comments
# The next functions read data from # https://publicsuffix.org/list/public_suffix_list.dat and implement the # algorithm at https://publicsuffix.org/list/ to find the "Organizational # Domain corresponding to a From: domain.
and extending through the end of the
def _DMARCProhibited(mlist, email, dmarc_domain, org=False):
function. There are recent changes for MM 2.1.25. See <http://bazaar.launchpad.net/~mailman-coders/mailman/2.1/revision/1724> or just look at <http://bazaar.launchpad.net/~mailman-coders/mailman/2.1/view/head:/Mailman/U...>
This code is improved for MM 3. Most of the changes have to do with the organizational domain data from <https://publicsuffix.org/list/public_suffix_list.dat>. in MM 2.1, this is retrieved once when first needed (first post after a (re)start of Mailman) and kept in core until the next restart which could be a long time. In MM 3 the data are cached, but the cache has a lifetime after which it is reloaded.
See <https://gitlab.com/mailman/mailman/blob/master/src/mailman/rules/dmarc.py> for the MM 3 code.
The second part is the actual From: header munging. In MM 3 that's done by <https://gitlab.com/mailman/mailman/blob/master/src/mailman/handlers/dmarc.py>. In MM 2.1 it's in multiple places, but the meat is in Mailman/Handlers/CookHeaders.py. There's more to it because the actual transformations aren't done to the message until after it's been queued for the digest and the archiver, but CookHeaders.py is where the work is done.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan