procmail
[Top] [All Lists]

Re: dealing with anti-spam bounces?

1997-04-22 13:35:00
I'd like to know if anybody has any good ideas for handling spam bounces.
ie. bounce messages from my auto-responder hitting bogus addresses.

Do I have to keep track of every spammer I've responded to and trash any
incoming spam bounces?

I my auto reply daemon adds headers in it's responds are any of those
headers guarantted to be returned by the bounce message?

While there is no guarantee that an autoreply will preserve an
"X-Loop" header (spammers are notorious for ignoring the rules of
the road even in this), here's how I handle this:

First, I set these variable at the top of my .procmailrc:

NOLOOP=sakeneko(_at_)hotmail(_dot_)com   #Use a valid email address belonging 
to you
SPAMFOLDER=/dev/null          #Change this to a folder if you want to 
                               keep copies of the stuff.

Now, =BEFORE= you filter for spam, include a couple of recipes like
this:

:0
* ^FROM_MAILER
mailer.incoming

:0
* $ ^X-Loop: ${NOLOOP}
mailer.incoming

This filters out any autoresponse to a bounce sent by you, and any
mail from an "administrative" account like root, postmaster, or
sysadmin, and puts it in a separate folder called mailer.incoming
where you can deal with it appropriately.

Then, I use this recipe for filtering spam of different types:

# Generic spam filter
:0
* ^(From.|Reply-To:|Message-ID:|Received:).*[^0-9A-Za-z](camelot\.net|\
          cyberpromo\.com|\
          nancynet\.com|\
          quantcom\.net|\
          sallynet\.com)
* $ !^X-Loop: ${NOLOOP}
{
:0 c
$SPAMFOLDER

:0 c
spamtemp

:0
| (formail -rt \
    -A"X-Loop: ${NOLOOP}";\
    cat $SBDIR/junk;\
    cat spamtemp;\
    rm -f spamtemp) \
    | $SENDMAIL -oi -t
}

This recipe checks to be sure the message does not contain your 
"X-Loop" header, and adds your "X-Loop" header to any autoreply.
The "checking" portion is redundant if you have the other recipe
set up to filter this mail out before it gets to your spam filter,
but I include it just in case someone doesn't install the spam 
filter correctly.

This prevents mail loops -- your filter talking to the spammer's
autoreply address.  And I have known spammers -- ISP Internet
notorious among them -- who set up their postmaster addresses
as autoresponders.  So be ready for almost anything from them. :(

Catherine