Re: dropping rejects

Cary Coutant <[email protected]> Thu, 28 Aug 2008 14:33:14 -0700
Newsgroups gmane.mail.smartlist.user
Message-ID <[email protected]>
> Can I configure smartlist to *not* send rejected messages to the list
> maintainer?  I am getting a *lot* of spam rejected from a list, that
> is filling up my mailbox every few days.

If your list is configured to reject foreign submissions, just add the
following to your rc.local.r00:

:0 h
* ^X-Diagnostic: Not on the accept list
/dev/null

Ideally, it would be nice to continue to receive the rejected messages
and deal with them, but the volume of spam today makes this totally
impractical. The spam completely overwhelms the occasional legit
message that someone accidentally sends from one of their other
personal addresses. I've tried to accumulate all those additional
addresses in the accept2 file to mitigate this problem.

If your incoming mail service provides SPF authentication, you could
try something like this:

:0 h
* ^X-Diagnostic: Not on the accept list
* ! ^Authentication-Results: *mx.google.com;.*spf=pass
/dev/null

(Be sure to change "*mx.google.com" to a pattern that matches your
incoming mail servers.) Given the sparse support for SPF so far, this
is probably still a bit too drastic, though not as drastic as the
first solution.

Here's something else I've tried to at least eliminate forged from addresses:

# (Extracted and simplified from some more complicated code, so this
is untested.)
# Extract the envelope-from address...
:0 h
X_ENV_FROM=| formail -c -x "From " | sed -e 's/^ *//' -e 's/ .*$//'
# ... and match it with the From: address.
:0 h
* X_ENV_FROM ?? ^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9_.-]+$
* ! $ ^From: .*${X_ENV_FROM}
/dev/null

This is also a bit overzealous, as many people have legitimate reasons
for non-matching envelope-from and from addresses, but it should still
let the majority of non-spam-but-still-foreign submissions through,
while dropping much of the spam.

-cary