I'm seeing these entries in my maillog:

May 19 18:16:41 anduril postfix/qmgr[10162]: warning: connect to transport spamfilter: No such file or directory May 19 18:16:42 anduril postfix/qmgr[10162]: warning: connect to transport spamassassin: Connection refused

which leads me to believe Spamassassin isn't working. I'm not sure if all my mail is coming through so please hit reply all to send to my yahoo account as well. :-) Thank you in advance for help.

So here's the bullet:

I installed SpamAssassin via cpan and followed the instructions from "IndegratedDpamdinPostfix" (http://wiki.apache.org/spamassassin/IntegratedSpamdInPostfix )

I added this:

        smtp      inet  n       -       n       -       -       smtpd
                -o content_filter=spamassassin

and this

        spamassassin       unix  -       n       n       -       -       pipe
flags=Rq user=nobody argv=/usr/local/bin/spamfilter.sh -oi -f $ {sender} ${recipient}

to my master.cf

I added a user called spamfilter and created this spamfilter.sh

Permissions for spamfilter

[EMAIL PROTECTED] postfix]# ls -la /usr/local/bin/spamfilter.sh
-rwxr-xr-x 1 spamfilt spamfilt 1036 May 19 09:09 /usr/local/bin/ spamfilter.sh


spamfilter.sh:

#!/bin/sh

# spamfilter.sh
#
 This script redirects mail flagged as spam to a separate account
# You must first create a user account named "spamfilter" to hold the flagged mail

SENDMAIL="/usr/sbin/sendmail -i"
SPAMASSASSIN=/usr/bin/spamc
COMMAND="$SENDMAIL $@"
USER=`echo $COMMAND | awk '{ print $NF }' | sed 's/@.*$//'`
NEW_COMMAND=`echo $COMMAND | awk '{ $6 = "spamfilter"; NF = 6; print }'`

# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

umask 077

OUTPUT="`mktemp /tmp/mailfilter.XXXXXXXXXX`"

if [ "$?" != 0 ]; then
/usr/bin/logger -s -p mail.warning -t filter "Unable to create temporary file."
    exit $EX_TEMPFAIL
fi

# Clean up when done or when aborting.
trap "rm -f $OUTPUT" EXIT TERM

$SPAMASSASSIN -x -E -u $USER > $OUTPUT
return="$?"
if [ "$return" = 1 ]; then
    $NEW_COMMAND < $OUTPUT
    exit $?
elif [ "$return" != 0 ]; then
/usr/bin/logger -s -p mail.warning -t filter "Temporary SpamAssassin failure (spamc returned $return)"
    exit $EX_TEMPFAIL
fi

$SENDMAIL "$@" < $OUTPUT
exit $?

Reply via email to