procmail
[Top] [All Lists]

Spamassassin + procmail setup

2001-12-30 07:07:11
Hi all,

After being hit with annoying spam for the unfth time, I'm working on
implementing spamassassin, since I've heard quite some good sounds about
it. I've put together this recipe for it, and I'd like to share it with
you for discussion, improvements etc.

PASSPASSWD=somepassword
SABOUNCE="${HOME}/path-to/spamassassin-text"
SPAMTRAP_FROM="spamtrap(_at_)my(_dot_)dom(_dot_)ain"
# Fire off SpamAssassin (SA)
# Skip executing on:
# 1) Loop detection
# 2) Mailer daemon
# 3) Supplied bypass password (incase someone is fasely tagged as
# spammer my spamassassin

:0fw:SA.lock
* !^X-Loop: ${LOGNAME}(_at_){$HOST}
* !^FROM_DAEMON
* $ !^Subject:.*${PASSPASSWD}
| spamassassin -P

# Error handling
:0e
{
        EXITCODE=$?
}

# Now lets see what SA found

:0:
* !^X-Loop: ${LOGNAME}(_at_){$HOST}
* !^FROM_DAEMON
* $ !^Subject:.*${PASSPASSWD}
* ^X-Spam-Flag: YES
{
        # copy all spam to a folder we never check, just in case.
        :0 c
        $HOME/mail/sa-trapped

        # create a copy we can work with
        :0 c
          spamtemp

        # There we go. Create the reply, add antiloop features,
        # add bounce message, make spamassassin generate the original
message
        # remove temporary files, fire off the email
        :0 fhw

        {
          :0 c: spamtemp.lock
          | ( formail -rt \
              -I"From: ${SPAMTRAP_FROM}" \
              -A"X-Loop: ${LOGNAME}(_at_)${HOST}"; \
              cat ${SABOUNCE} ;\
              echo "************** The password is ${PASSPASSWD}
**************";\
              echo " ";\
              echo "--------------[ original message follows
]--------------";\
              echo " ";\
              spamassassin -d spamtemp ;\
              rm -f spamtemp ) \
              | ${SENDMAIL} -oi -t
        }
        # Force delivery to /dev/null so that additional rules are not
        # processed.
        :0 ah
        /dev/null
}

If you have any comments, please let me know :-)

Greetings,

-- 
Nils Vogels             PGP:0xC26BD15F Available on keyservers.
S(_at_)H:2657WU/3.963yr --> setiathome.ssl.berkeley.edu. Will you find
aliens?
Every OS sucks!         http://www.yuckfou.org/every_os_sucks.mp3

Why did it happen ? BOFH Excuse:
            Your EMAIL is now being delivered by the USPS.

_______________________________________________
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>
  • Spamassassin + procmail setup, Nils Vogels <=