The last thing to do when adding clamav and spamassassin to the mail server is to tell postfix to use them. What we are going to do is tell postfix to send any new mails it receives to amavisd, then, once amavisd has run the mail through mail and spam checks, to re-inject that mail into the mail queue.
It is very easy to tell postfix to use amavisd. We need to edit main.cf and master.cf. Firstly we should edit main.cf. In your favorite editor open up
/etc/postfix/main.cf. Add the following 2 lines to the end of the file.
strict_rfc821_envelopes = yes
This tells postfix that amavisd is listening on port 10024 for mails. It also tells postfix to make sure that the mails conform to rfc 821. Next we need to add to the master.cf file. Open up
/etc/postfix/master.cf in your favorite editor and add the following lines to the end of the file.
This tells postfix to listen on 10025 for mails from amavisd to be re-injected into the mail queue. But we need to also tell postfix to send mail that has arrived to amavisd for processing. We do that by adding the following code to the end of the file.
This tells postfix to send incoming mails through amavisd for content checks.
Now we should have amavisd using clamav and spamassassin performing virus and spam checks on all incoming mails. There are a great many options to amavisd and spamassassin. If you would like to extend your usage of these packages, please read the documentation that comes with the source files.