rfc2822
February 17, 2009
Network Services
Tags: email, Postfix, spam
Many people use AMaViS or amavisd-new to combine Postfix with ClamAV and SpamAssassin. However, Amavis takes huge amounts of CPU time and memory. Also, it’s quite slow and difficult to configure, so another solution without Amavis would be interesting.
In this article, I will only discuss server-wide solutions without procmail because it can’t be used with virtual domain mailboxes.
It’s possible to use a shell script that calls ClamAV and SpamAssassin as a Postfix content filter:
/opt/mail-scanner
#!/bin/sh
EX_OK=0
EX_BOUNCE=69
EX_DEFER=75
SENDMAIL=”/usr/sbin/sendmail -G -i”
SPAM_DIR=/home/mailscan/spam
VIRUS_DIR=/home/mailscan/viruses
function cleanup {
for fname in ${tmpfile[@]}
do
rm -f $fname
done
}
for ((i=0;i<2;i++))
do
fname=`mktemp -p /tmp mail-scanner.XXXXXXXX`
if [ “$?” != 0 ]; then
logger … Continue Reading