1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
Integration SpamAssassin with Postfix
This file contains information on how to integrate SpamAssassin with Postfix
for incoming mails.
1. Set SpamAssassin to start after booting the system
Edit /etc/defaults/spamassassin and set SpamAssassin to start after a reboot.
2. Start SpamAssassin
/etc/init.d/spamassassin start
3. Create a filter user.
adduser --disabled-password --disabled-login --gecos "Postfix Filter User" filter
4. Create the filter script.
Under ~filter, create filter.sh:
#!/bin/sh
/bin/cat | /usr/bin/spamc -f | /usr/sbin/sendmail -i "$@"
exit $?
Be sure to chmod it to 750, at least.
A more complete example can be found under /usr/share/doc/spamassassin/examples
5. Set /etc/postfix/master.cf
It must contain the following lines:
localhost:smtp inet n - - - - smtpd
<external.ip>:smtp inet n - - - - smtpd
-o content_filter=filter:
[...]
filter unix - n n - - pipe
flags=Rq user=filter argv=/home/filter/filter.sh -f ${sender} -- ${recipient}
6. Reload postfix
As root, exec:
#> postfix reload
That should be it.
Aug 2003, Jesus Climent
|