[Mailman-Users] Reject non-members at SMTP time

Mark Sapiro mark at msapiro.net
Wed May 19 17:15:53 CEST 2010


glen at prideaux.id.au wrote:

>Is there a way to reject non-subscribers at the time of their initial SMTP
>conversation, as opposed to either rejecting them later (with an
>associated bounce message) or silently discarding them?


Maybe.


>I don't want to generate bounce messages because of the back-scatter they
>generate, but silently discarding is also bad: non-spam senders should get
>some notification that their message has failed.


Right.


>I'm using exim4 and it seems likely that there is a way to have exim check
>whether mailman is willing to accept the message at SMTP time.
>
>Is this something that others have done? I thought it would have been a
>fairly common requirement but I haven't been able to find any clear notes
>on how to do it.


I am not aware of anyone who has done this either in Exim or other MTAs.

My first thought is it would be fairly easy to create a script to test
for list membership that Exim could use in either the router or
transport or possibly an acl to do this, but I don't know enough Exim
to say exactly how to do the Exim part of this.

However, this is problematic because Exim only knows the envelope
sender and recipient, and tests for Mailman's tests for list
membership and ability to post are based on much more than just
envelope sender.

Another way to do this would be to modify Mailman's scripts/post script
to do the tests and return a failure exit code if posting isn't
allowed. This would work with any MTA and would cause the pipe to
mailman to fail which should be reported to the sending MTA.

The problem with this approach is circumstances such as a very large
list or perhaps a list lock could cause the post script to be timed
out by the MTA. Ideally, this would be reported back to the sending
MTA as a retryable (4xx) status, but maybe not.

The issue is to do the test correctly, you have to look at all the
headers that Mailman/Handlers/Moderate.py looks at to determine
membership, and then look also at *_these_nonmembers and
generic_nonmember_action.

In other words, what post would need to do is parse the message into a
Mailman.Message.Message() object, instantiate the list, possibly call
Mailman.Handlers.Approve.process() to look for an Approved: header,
call Mailman.Handlers.Moderate.process() and process the various
exceptions it raises for Reject, Hold or Discard, and then either
queue the post or exit with failure. That's a lot of extra work for
something that now only queues the post.

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