bash script to rewrite spam method
This is a simple method to integrate SpamAssassin.  All spam e-mail will still come through to your address(es), but it will be clearly marked as spam.
1) Create a bash script to receive e-mail from Postfix and pipe it to SpamAssassin for rewriting.  Then forward the rewritten version to Postfix's sendmail implementation:
{{{#!highlight bash
#!/bin/bash
# 
# spamfilter.sh
# 
# Simple filter to plug SpamAssassin into the Postfix MTA
# 
# Modified by Jeremy Morton
# 
# This script should probably live at /usr/bin/spamfilter.sh
# ... and have 'chown root:root' and 'chmod 755' applied to it.
# 
# For use with:
#     Postfix 20010228 or later
#     SpamAssassin 2.42 or later
# Note: Modify the file locations to suit your particular
#       server and installation of SpamAssassin.
# File locations:
# (CHANGE AS REQUIRED TO SUIT YOUR SERVER) SENDMAIL=/usr/sbin/sendmail SPAMASSASSIN=/usr/bin/spamc
logger <<<"Spam filter piping to SpamAssassin, then to: $SENDMAIL $@"
${SPAMASSASSIN} | ${SENDMAIL} "$@"
exit $?
}}}
This, of course, assumes you're using the spamd/spamc implementation of SpamAssassin
 to improve performance - spamc is the command you'll want to invoke to 
check an e-mail (by setting SPAMASSASSIN to its location).
2) Ensure the newly-created /usr/bin/spamfilter.sh has correct permissions (0755), and is owned by root:root.
3) Modify the /etc/postfix/master.cf file; first, change the first 'smtp' line of the file to:
Then, add the following (a call to our newly-created spamfilter script) at the end:
This setup assumes you have a 'spamd' user for the script to be run 
as.  If you wish to run it as a different user, modify the 'user' 
argument above.
4) Restart the Postfix service.
Now, Postfix should be sending every incoming e-mail through the spamfilter.sh script (which means it's going through SpamAssassin),
 with the e-mail headers (and maybe the rest of the e-mail, if it's 
spam) being rewritten before being delivered to the target mailbox.  
Optionally, you may wish to tweak SpamAssassin's
 configuration to cause it to rewrite the e-mails in a more useful way 
(only rewrite spam mail subject but not whole e-mail, add a 'ham' header
 to give detailed info on even non-spam, etc.)
5) (optional) Tweak SpamAssasin's configuration.  Ensure that the below is in /etc/mail/spamassassin/local.cf and then restart SpamAssassin: