[Mailman-Users] spam checks before membership checks

Mark Sapiro msapiro at value.net
Fri Jun 3 06:37:35 CEST 2005


Colby Walsworth wrote:
>
>So all our emails go throug spamassasin and get tagged with a certain 
>line if they are spam. I have this filter on all our lists:
>
>header_filter_rules = [('X-NCEAS-Mercury-MailScanner-SpamCheck: spam', 
>3, 0)]
>
>This is a header line that is in an email that made it through:
>X-NCEAS-Mercury-MailScanner-SpamCheck: spam, SBL+XBL,
>    SpamAssassin (score=1.897, required 3, HTML_40_50 0.09,
>    HTML_MESSAGE 0.00, MIME_BOUND_NEXTPART 0.11, MSGID_FROM_MTA_ID 1.70)
>
>Am I doing something wrong on the filtering? Why does it seem to 
>moderate as non member before it does the header_filter_rule ?
>Any suggestions are appreciated.

It should work. I don't know why it doesn't assuming the
X-NCEAS-Mercury-MailScanner-SpamCheck: header gets added before the
message gets delivered to Mailman.

Have you made any changes to GLOBAL_PIPELINE in mm_cfg.py or added a
pipeline attribute to the lists. If not,
Mailman/Handlers/SpamDetect.py is the first thing invoked to process
the message and if there is a match on header_filter_rules with an
action of DISCARD (= 3), the message is discarded. You might try

X-NCEAS-Mercury-MailScanner-SpamCheck:[ \t]*spam

as the pattern in header_filter_rules instead of

X-NCEAS-Mercury-MailScanner-SpamCheck: spam

but that probably won't help.

You might consider adding

from Mailman.Logging.Syslog import syslog

to the beginning of SpamDetect.py and then add some logging, e.g. change


    for patterns, action, empty in mlist.header_filter_rules:
        if action == mm_cfg.DEFER:
            continue
        for pattern in patterns.splitlines():
            if pattern.startswith('#'):
                continue
            if re.search(pattern, headers, re.IGNORECASE):
                if action == mm_cfg.DISCARD:


to

    for patterns, action, empty in mlist.header_filter_rules:
        if action == mm_cfg.DEFER:
            continue
        for pattern in patterns.splitlines():
            if pattern.startswith('#'):
                continue
            syslog('debug', 'pattern->%s\nheaders->%s', pattern,
                   headers)
            if re.search(pattern, headers, re.IGNORECASE):
                if action == mm_cfg.DISCARD:

Which will write the pattern and headers to a 'debug' log file in
Mailman's log directory.

--
Mark Sapiro <msapiro at value.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