Hi,

On Mon, 16 Jun 2003 10:26:28 +0200 Buscema Guido
<[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I'm trying to set up spamc/spamd with postfix by piping a shell script
> inside master.cf file of postfix.
> I created a user "filter" and a directory /var/spool/filter.
> I also created a directory ( /opt/spamfilter ) with the following shell
> script (filter.sh)
> 
> SENDMAIL="/usr/lib/sendmail -i"
> SPAMASSASSIN=/usr/bin/spamc
> # Exit codes from <sysexits.h>
> EX_TEMPFAIL=75
> EX_UNAVAILABLE=69
> 
> cat | $SPAMASSASSIN -f -u filter 2>/dev/null | $SENDMAIL "$@" ||
>    { echo Message content rejected; exit $EX_UNAVAILABLE; }
> 
> exit 0

I've had similar problems. I'm no postfix filter expert but I'm
currently using the following to process mail through Amavis, Anomy
Sanitizer, and SpamAssassin:

#!/bin/sh
#
INSPECT_DIR=/var/spool/spamassassin
SENDMAIL="/usr/sbin/sendmail -i"
AMAVIS=/usr/sbin/amavis
SPAMASSASSIN=/usr/bin/spamc
ANOMY=/usr/local/anomy
SANITIZER=$ANOMY/bin/sanitizer.pl
export ANOMY
 
# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69
 
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL ; }
 
# Clean up when done or when aborting
trap "/bin/rm -f in.$$; rm -f out.$$" 0 1 2 3 15
 
# SpamAssassin uses a safe failover mode. If you do not want
# emails to be delivered when SpamAssassin doesn't run, remove
# the comments
 
cat | $SPAMASSASSIN -f | $SANITIZER > out.$$ # || \
# cat | $SPAMASSASSIN -f > out.$$ # || \
# { echo Message content rejected; exit $EX_UNAVAILABLE ; }
 
# $SENDMAIL "$@" < out.$$
$AMAVIS "$@" < out.$$
 
exit $?
 
# __END__

> I added in the master.cf file the following line
> 
> filter unix    -       n       n       -       -       pipe
>   Flags=Rq user=filter argv=/opt/spamfilter/filter.sh -f ${sender} --
> ${recipient}

Mine looks like:

#this_loops-woo!  localhost:10025 inet n  -       n       -       -       smtpd -o 
content_filter=spamassassin:

localhost:10025 inet n  -       n       -       -       smtpd -o content_filter=
spamassassin      unix  -       n       n       -       10      pipe
    flags=Rq user=vscan argv=/usr/local/bin/spamc_amavis_filter.sh ${sender} -- 
${recipient}

Also, in /etc/postfix/main.cf I have:

content_filter=spamassassin:

The 'vscan' account is created under SuSE 8.2 to run Amavis so I just
used that (I started creating the 'filter' account on my own but
realized it may be easier to use the existing account Amavis was using.)

I can't guarantee this is the most efficient or correct way of doing
things but it seems to work.

> It's working fine, but a few bad events happens
> 
> 1) The message incoming appears to be repeatedly processed by
> spamc/spamd and filter.sh
> 
> 2) processes (spamc e filter.sh) are duplicated all time a message has
> processed and they stay in memory for several time increasing the
> processing time for new messages.
> 
> 3) The Subject of the email delivered say:"Undisclosed Recipient"; while
> without Spamassassin the postfix agent has worked fine.

What happens if you change:

  cat | $SPAMASSASSIN -f -u filter 2>/dev/null | $SENDMAIL "$@" ||
     { echo Message content rejected; exit $EX_UNAVAILABLE; }

to

  cat | $SPAMASSASSIN -f -u filter 2>/dev/null

hth,

-- 
Bob Apthorpe


-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to