| 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 |