postfix+spamassassin help
trevorelbourne_at_gmail.com
Date: 04/26/05
- Next message: Peter T. Breuer: "Re: postfix+spamassassin help"
- Previous message: Peter T. Breuer: "Re: How to kill child & parent process simulanteously"
- Next in thread: Peter T. Breuer: "Re: postfix+spamassassin help"
- Reply: Peter T. Breuer: "Re: postfix+spamassassin help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Apr 2005 00:17:55 -0700
Hi everyone,
I am having some trouble getting postfix and spamassassin working
together.
Spamassassin is working well, and I have written a script (which works)
that I want to use as a postfix filter. The problem I am having is that
when I enable the filter, postfix goes into what seems to be a loop.
The filter script forwards spam to an off-site email account for later
human processing, and deilvers non-spam locally via sendmail.
What seems to happen is that when mail comes in, if it's not spam, the
script uses sendmail to deliver locally, and this causes a loop. It
appears that the filter script is called over, and over again. Each
time the script tries to deliver locally with sendmail, the filter gets
invoked, and thus a loop is created.
What am I doing wrong?!
Any help greatfully received.
Regards,
Trevor.
PS - The master.cf file and filter script are below.
#!/bin/sh
TEMPDIR=/home/spamfilter
# Variables
SENDMAIL="/usr/sbin/sendmail -i"
EGREP=/bin/egrep
# Exit codes from <sysexits.h>
EX_UNAVAILABLE=69
# Number of *'s in X-Spam-level header needed to sideline message:
# (Eg. Score of 5.5 = "*****" )
SPAMLIMIT=5
# Clean up when done or when aborting.
trap "rm -f $TEMPDIR/out.$$" 0 1 2 3 15
# Pipe message to spamc
cat | /usr/bin/spamc -u spamfilter > $TEMPDIR/out.$$
# Are there more than $SPAMLIMIT stars in X-Spam-Level header? :
if $EGREP -q "^X-Spam-Level: \*{$SPAMLIMIT,}" < $TEMPDIR/out.$$
then
# Option 1: Move high scoring messages to sideline dir so
# a human can look at them later:
# mv out.$$ $SIDELINE_DIR/`date +%Y-%m-%d_%R`-$$
# Option 2: Divert to an alternate e-mail address:
$SENDMAIL ourspamaccount@gmail.com < $TEMPDIR/out.$$
# Option 3: Delete the message
# rm -f $TEMPDIR/out.$$
else
$SENDMAIL "$@" < $TEMPDIR/out.$$
fi
# Postfix returns the exit status of the Postfix sendmail command.
exit $?
###################################################################
And here's our master.cf file:
###################################################################
#
==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
#
==========================================================================
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
smtp unix - - n - - smtp
smtp inet n - n - - smtpd
-o content_filter=spamfilter:dummy
relay unix - - n - - smtp
showq unix n - n - - showq
error unix - - n - - error
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
#
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
spamfilter unix - n n - 10 pipe
flags=Rq user=spamfilter argv=/usr/sbin/spamfilter ${recipient}
# maildrop. See the Postfix MAILDROP_README file for details.
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
old-cyrus unix - n n - - pipe
flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
cyrus unix - n n - - pipe
user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension}
${user}
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail
($recipient)
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop
$recipient
###################################################################
- Next message: Peter T. Breuer: "Re: postfix+spamassassin help"
- Previous message: Peter T. Breuer: "Re: How to kill child & parent process simulanteously"
- Next in thread: Peter T. Breuer: "Re: postfix+spamassassin help"
- Reply: Peter T. Breuer: "Re: postfix+spamassassin help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|