[Mailman-Users] generic_nonmember_action and header_filter_rules

Mark Sapiro mark at msapiro.net
Mon Oct 13 02:55:08 CEST 2008


Russell Clemings wrote:

>I have generic_nonmember_action set to "reject." I also have
>header_filter_rules set to "hold" if an incoming message has
>"X-Spam-Flag: YES" in its headers.
>
>My current problem is the second test overrides the first -- i.e., if
>a non-member tries to post a message flagged as spam, it is held
>rather than rejected. As you might imagine, this happens rather often.
>
>Is there a way to change the order of operations on these filters? I'd
>like to have posts from non-members rejected every time, whether they
>match the spam filter or not.
>
>This is cPanel's hack of Mailman (version 2.1.11.cp2), not the real mccoy, fwiw.


Do you have access to mm_cfg.py? That's what's required to change this.

IncomingRunner passes the message througe a pipeline of handler
modules. The first one that says hold|reject|discard this message
determins what is done.  The default pipeline is

GLOBAL_PIPELINE = [
    # These are the modules that do tasks common to all delivery paths.
    'SpamDetect',
    'Approve',
    'Replybot',
    'Moderate',
    'Hold',
    'MimeDel',
    'Scrubber',
    'Emergency',
    'Tagger',
    'CalcRecips',
    'AvoidDuplicates',
    'Cleanse',
    'CleanseDKIM',
    'CookHeaders',
    # And now we send the message to the digest mbox file, and to the
arch and
    # news queues.  Runners will provide further processing of the
message,
    # specific to those delivery paths.
    'ToDigest',
    'ToArchive',
    'ToUsenet',
    # Now we'll do a few extra things specific to the member delivery
    # (outgoing) path, finally leaving the message in the outgoing
queue.
    'AfterDelivery',
    'Acknowledge',
    'ToOutgoing',
    ]


SpamDetect does header_filter_rules; Moderate does member moderation
and non-member actions, and Hold does several miscellaneous holds.

To do what you want, you need to reorder the pipeline so that
SpamDetect comes after Moderate.

You could do this by putting the following in mm_cfg.py

GLOBAL_PIPELINE.remove('SpamDetect')
GLOBAL_PIPELINE.insert(GLOBAL_PIPELINE.index('Hold'), 'SpamDetect')

which would remove SpamDetect from the pipeline and then insert it
between Moderate and Hold.

-- 
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