This is an alternative to the instructions at
FilterMailWithSpamAssassinAndProcMail.
The general theory is that incoming mail will be piped through a
SendMail "milter", or mail filter, before delivery.
The milter I recommend has the nice feature that it only processes mail bound for local delivery, and
not mail passing
through the server as an intermediate hop in a relay chain. That is, if you're running a backup MX for an associate, mail
that is eventually bound for delivery at their server will
not be processed. This saves resources on your server and
gives your associate the ability to
not use
SpamAssassin if they chose not to.
Advantages:
- It doesn't require an installation of ProcMail?.
- It's much simpler than installing and configuring ProcMail?.
Disadvantages:
2. Install the milter
gcc -L/usr/obj/usr/src/lib/libsm -lsm -lmilter -pthread spamassassin_milter.c -o spamassassin_milter
- Install it:
cp spamassassin_milter /usr/local/sbin
- Make an rc.d script to run it automatically at boot. I've named mine
/usr/local/etc/rc.d/spamassassin_milter.sh.
#!/bin/sh
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
echo "$0: Cannot determine the PREFIX" >&2
exit 1
fi
case "$1" in
start)
if [ -x ${PREFIX}/sbin/spamassassin_milter ]; then
${PREFIX}/sbin/spamassassin_milter -p unix:/var/run/spamassassin_milter.sock &
echo -n ' spamassassin_milter'
fi
;;
stop)
killall spamassassin_milter && echo -n ' spamassassin_milter'
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac
exit 0
- Make the rc.d script executable:
chmod a+x /usr/local/etc/rc.d/spamassassin_milter.sh
- Start the milter:
/usr/local/etc/rc.d/spamassassin_milter.sh start
Add this near the end of your
LocalSendmailConfiguration:
INPUT_MAIL_FILTER(`SpamAssassinFilter', `S=unix:/var/run/spamassassin_milter.sock')
define(`confMILTER_LOG_LEVEL', 7)
--
KirkStrauser - 03 Jul 2003