procmail
[Top] [All Lists]

Re: Recipe woes

2003-05-29 16:08:32
Thanks for the replies.  My recipe has evolved overnight to encompass the 
simple quoting and forwarding from one account to also include the 
auto-reporting to Pyzor and Razor of another account.  The recipe 
in its current state follows:

VERBOSE=on
PMDIR=$HOME/.procmail
MAILDIR=$HOME/mail
LOGFILE=$PMDIR/log
ARCHIVE_DIR=$MAILDIR/archive
BOUNCER=this-account-will-bounce-$SECONDS(_at_)BOGUS(_dot_)com
#BOUNCER="Spammer Torture Tool 
<this-account-will-bounce-$SECONDS(_at_)BOGUS(_dot_)com>"
AUTOREPLY=$MAILDIR/autoreplies

## Archive spam with complete SA and MD headers
:0
{
        :0c:
        $ARCHIVE_DIR/$YYYY$MM
}

# Extract subject and assign it to SUBJECT
:0
* ^Subject:[    ]*\/[^  ].*
{
        SUBJECT=$MATCH
}



## Report spam to Pyzor, Razor, the FTC, and NANAS.
:0 BH
# Hopefully this will prevent mail loops.
* $ ! ^X-Spam-Loop: $BOUNCER
* !   ^FROM_DAEMON
{
        :0f
        # Clean up the spam by removing the SA headers, Subject change
        # and other misc headers.
        | spamassassin -d \
        | sed -e "s/^Subject: \*\*\*SPAM\*\*\*/Subject:/" \
        | $FORMAIL -I ReSent \
                   -I X-Envelope-To: \
                   -I X-Scanned-By:

        # Report to Pyzor
#       :0 Wc
#       | /usr/bin/pyzor report

        # Report to Razor
#       :0 Wc
#       | spamassassin -r

        # Testing mbox
        :0c:
        reported

        # Munge some strings
        :0f
        | sed -e "s/a-provider.net/BOGUS.com/gi" \
              -e "s/spamtrap/spamhole/gi" \
              -e "s/rathole/spamhole/gi" \
              -e "s/numbnuts.net/BOGUS.com/gi" \
              -e "s/flubber/pedro/gi" 
#       | $FORMAIL -I ReSent \
#                  -I X-Authentication-Warning: \
#                  -I X-Envelope-To: \
#                  -I X-Scanned-By:

        # Forward to the FTC and NANAS
        # Also set X-No-Confirm so Bob, the NANAS Bot won't auto-ack me.
        # Also add a X-Spam-Loop header to *hopefully* stop loops.
        :0
        | ( cat $AUTOREPLY/this-is-spam.txt - \
                | $FORMAIL -I"Subject: [email]  $SUBJECT" \
                           -I"X-Spam-Loop: $BOUNCER" \
                           -I"X-No-Confirm: yes" \
                           -I"From: Spammer Torture Tool <$BOUNCER>" ) \
                | $SENDMAIL -f $BOUNCER spampit(_at_)numbnuts(_dot_)net

        # Another testing mbox
        :0:
        wip
}


I'm happy to report that it's working pretty well.  I've disabled the 
reporting to pyzor and razor options while I test the recipe.  I haven't 
had time to try out the sandbox approach yet.  It's on my to do list.

I've munged the domains and userids to help disguise the spamtrap 
information (I don't want to be list-washed after all the work I did last 
night :).

The only problem I'm having at the moment (and it's not really a problem, 
just something I can't figure out) is how to eliminate the ***SPAM*** from 
the message that gets forwarded to the FTC and NANAS.  That string is 
removed from the Subject of the quoted message as expected but $SUBJECT 
that I extract at the beginning still contains the ***SPAM*** string.  Can 
anyone think of a good way to remove that string?

The recipe appears to be working other than that one small glitch above.  
I believe I've eliminated the things that could create a mail loop, I
hope.  I had a nasty mail loop when $BOUNCER included the text "Spammer
Torture Tool" before the actual email address.  I fixed that though.  I 
need to think of a good way to ensure that this user never receives mail 
from the outside world, that it can only receive mail from spamtraps.  I 
think that could help prevent loops.  If the FTC runs out of drive space 
again, would this recipe prevent a loop?  Bob the NANAS Bot shouldn't ever 
reply to me.  I suppose I could make sure that the From: didn't contain 
"nanas-req(_at_)cybernothing(_dot_)org" or that the message didn't contain the 
X-Loop 
that's used in Bob's auto-acks.  Any other ideas to make this recipe 
better?  I hope my formatting was alright.

Thanks again for the replies
 Justin


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>