POSTFIX AND SPAMASSASSIN INSTALL (EASY)
by Alan Fullmer
Please note: File locations are based on my own install. Yours
may be different, and should be checked and appropriate changes made. This document assumes you have already installed Postfix and Spamassassin, it only covers the scope of how to get them to play nicely with each other after the install.
If you see something in red, this means it's up to your system settings of where the file may be located.
1. Install postfix and get it working for your domain. See http://www.postfix.org for details.
2. Install SpamAssassin. The easiest way to do this is with the command "perl -MCPAN -e 'install Mail::SpamAssassin'" OR you can compile it. Another way is to use an RPM (RedHat or Fedora) or "apt-get install postfix spamassassin spamc" (if you have debian)
3. As root, create a file at /usr/local/bin/spamfilter.sh with the
following content:
#!/bin/bash
/usr/local/bin/spamc | /usr/sbin/sendmail -i "$@"
exit $?
4. Run "chmod 755 /usr/local/bin/spamfilter.sh" then make sure you have it executable: "chmod -x /usr/local/bin/spamfilter.sh"
5. Create a user called 'spamfilter'. Make it a complete user, with home directory and shell. (I prefer setting the shell to false.) example: useradd -d /home/spamfilter -s /bin/false spamfilter
6. Run "chown spamfilter:spamfilter /usr/local/bin/spamfilter.sh"
7. In /etc/postfix/master.cf in the
"Services" section, alter the 'smtp' line as follows (the " -o con..." SHOULD be
on the next line: NOTE: there are two lines that have smtp.
Make sure it is the inet line. Usually the first line.
# -----------------------------------------------------------------------------------
smtp inet n - n - - smtpd
-o content_filter=spamfilter:dummy
# -----------------------------------------------------------------------------------
8. In /etc/postfix/master.cf in the
"Interfaces to non-Postfix software" section add:
# -----------------------------------------------------------------------------------
spamfilter unix - n n - - pipe
flags=Rq user=spamfilter argv=/usr/local/bin/spamfilter.sh -f ${sender} -- ${recipient}
# -----------------------------------------------------------------------------------
9. Restart postfix and make sure you can still get email. Send a fake spam through the system (from an outside address) to verify that spam is marked as spam. For information on configuring SpamAssassin, go to http://www.spamassassin.org.
If you need help with this stuff, you can post in the forum thread and i'll try to help you out. http://www.xnote.com/forums/viewthread.php?tid=4