Hi Matus,

Am 09.09.2015 um 15:01 schrieb Matus UHLAR - fantomas:
On 09.09.15 13:47, Marc Richter wrote:
Regardless if it's necessary or not, I have done so. It also happens
regularly by cron (all 3 hours), along with other jobs like sa-learn,
sa-update and sa-compile.

reload should be enough, restart is rarely necessary.
Also, why do you check oftern than once a day?

You are right, this can be made more clever. I made it that way when I started with my server to make sure the frequently changed configs are reloaded often automatically. I left it that way since then. It can be optimized for sure, but I doubt it has something to do with my actual troubles.

how do you plug spamassassin into your mail flow? How do you call
spamassassin? mta, mail client ... ?

I'm running postfix as my MTA. In it's master.cf there is configured to pipe my mail through a script:

smtp   inet  n  -  n  -  -  smtpd -o content_filter=spamassassin
spamassassin
   unix  -  n  n  -  -  pipe
flags=Rq user=spamd argv=/var/lib/spamassassin/filter.sh -oi -f ${sender} ${recipient}

In the script filter.sh spamc is invoked:

#!/bin/sh

SENDMAIL="/usr/sbin/sendmail -i"
SPAMASSASSIN=/usr/bin/vendor_perl/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 SIGTERM

$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 return $return)"
 exit $EX_TEMPFAIL
fi

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


Thus, in effect, mail is filtered as this command would have been executed:

spamc -x -E -u ww < MAILINPUT

Best regards,
Marc

Reply via email to