Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: SpamAssassin: users

Not sure if its working

 

 

SpamAssassin users RSS feed   Index | Next | Previous | View Threaded


bob at mojotools

May 19, 2008, 3:31 PM

Post #1 of 2 (122 views)
Permalink
Not sure if its working

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

[root[at]anduril 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 $?


mouss at netoyen

May 20, 2008, 1:07 AM

Post #2 of 2 (104 views)
Permalink
Re: Not sure if its working [In reply to]

Bob Cohen wrote:
> 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.


This is a postfix confirguration problem.
>
> 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
>
> [root[at]anduril 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 $?

SpamAssassin users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.