OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Problem setting up Postfix with Spamassassin

From: Alex Wong (alw1746yahoo.com.au)
Date: Mon Apr 26 2004 - 07:22:35 CDT


Hi,

I'm trying to set up Postfix to use Spamassassin and
Anomy Sanitizer using the example from
http://www.advosys.ca/papers/postfix-filtering.html.
Unfortunately, my test mail just loops endlessly after
the filter script reinjects the mail back into
Postfix(using sendmail). Has anyone come across this
problem?

Mail delivery works fine once the filter is disabled.
Shell test of filter.sh also works fine. It looks like
mail sent to localhost is also handled by the inet
daemon and I cannot find a way of telling Postfix not
to process filtered mail again.
 
RH 9,Postfix-2.0.19-2, Spamasassin 2.63,Anomy 1.67
 
master.cf
---------
smtp inet n - n - -
 smtpd
    -o content_filter=filter:dummy
filter unix - n n - -
 pipe
  flags=Rq user=filter argv=/usr/local/anomy/filter.sh
-f ${sender} -- ${recipient}
 
filter.sh
---------
INSPECT_DIR=/var/spool/filter
SENDMAIL="/usr/sbin/sendmail -i"
ANOMY=/usr/local/anomy
SANITIZER=/usr/local/anomy/bin/sanitizer.pl
ANOMY_CONF=/usr/local/anomy/anomy.conf
ANOMY_LOG=/dev/null
SPAMASSASSIN=/usr/bin/spamassassin
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 "rm -f out.$$" 0 1 2 3 15
cat | $SPAMASSASSIN -x | $SANITIZER \
   $ANOMY_CONF 2>>$ANOMY_LOG > out.$$ || \
   { echo Message content rejected; exit
$EX_UNAVAILABLE; }
$SENDMAIL "$" < out.$$
exit $?

maillog
-------
Apr 22 21:43:00 inv01 sendmail[9771]: i3MBh0K2009771:
Authentication-Warning: inv01.innovia.com.au: filter
set sender to alexwinnovia.com.au using -f
Apr 22 21:43:00 inv01 sendmail[9771]: i3MBh0K2009771:
from=alexwinnovia.com.au, size=4335, class=0,
nrcpts=1,
msgid=<LDEPLLAHMEGPEMIMLPKOGEBBCAAA.alexwinnovia.com.au>,
relay=filterlocalhost
Apr 22 21:43:00 inv01 postfix/smtpd[9702]: connect
from localhost.localdomain[127.0.0.1]
Apr 22 21:43:00 inv01 postfix/smtpd[9702]: 3CFF25AB66:
client=localhost.localdomain[127.0.0.1]
Apr 22 21:43:00 inv01 postfix/cleanup[9704]:
3CFF25AB66:
message-id=<LDEPLLAHMEGPEMIMLPKOGEBBCAAA.alexwinnovia.com.au>
Apr 22 21:43:00 inv01 postfix/qmgr[9700]: 3CFF25AB66:
from=<alexwinnovia.com.au>, size=4841, nrcpt=1 (queue
active)
Apr 22 21:43:00 inv01 sendmail[9771]: i3MBh0K2009771:
to=alexwinnovia.com.au, ctladdr=alexwinnovia.com.au
(501/500), delay=00:00:00, xdelay=00:00:00,
mailer=relay, pri=34327, relay=[127.0.0.1]
[127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as
3CFF25AB66)
Apr 22 21:43:01 inv01 postfix/smtpd[9702]: disconnect
from localhost.localdomain[127.0.0.1]
Apr 22 21:43:01 inv01 postfix/pipe[9713]: 865865AB69:
to=<alexwinnovia.com.au>, relay=filter, delay=4,
status=sent (dummy)

postconf -n
-----------
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain
$mydomain
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /etc/postfix/README_FILES
sample_directory = /etc/postfix/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 450

Any help much appreciated, I'm going nuts.
rgds,
Alex Wong

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com