This page will guide you in configuring MailScanner, ClamAV and SpamAssassin to work in Postfix. Before proceeding, please make sure that all of the above components are already installed.

Here are the installation guides for the above components.

SpamAssassin is included in Red Hat Enterprise Linux 5 and CentOS 5 and it’s ready to go out of the box. Just add it using the Package Manager tool if you haven’t done so during installation.

Configuring MailScanner

MailScanner Config1. Edit the file /etc/MailScanner/MailScanner.conf
Find the following keys and change the values as follows
%org-name% = your organization name
%org-long-name% = your full organization name
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
Incoming Work Group = clamav
Incoming Work Permissions = 0640
MTA = postfix
Virus Scanners = clamd
Clamd Socket = /tmp/clamd.socket
Use SpamAssassin = yes
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
MailScanner Spool Directory2. Click Applications and click File Browser to launch the File Browser window and go to the /var/spool/MailScanner directory.
MailScanner Spool Directory3. In the File Browser window, click File and click Create Folder. Name the new folder spamassassin.
MailScanner Spool Directory4. Right click on the folder incoming and click Properties.
MailScanner Directory Permission
5. In the Properties window, click the Permissions tab. In the Permissions page, set the Owner as postfix and its Folder Access as Create and delete files. Set the Group as clamav and its Folder Access as Access files. Finally, set the Folder Access of Others as None. Click Close when you are done. Repeat this for the quarantine and spamassassin folders.
Terminal
6. From a terminal window, type in
ln -s /usr/bin/freshclam /usr/local/bin/freshclam
MailScanner will be looking for freshclam in the /usr/local/bin directory so we’ll create a symbolic link to it in that directory.

Integrating MailScanner into Postfix

Postfix Configuration1. Edit the file /etc/postfix/main.cf and remove the # in front of the line below
header_checks = regexp:/etc/postfix/header_checks
Header Checks2. Edit the file /etc/postfix/header_checks and add the line below to the bottom of the file
/^Received:/ HOLD
This will now place all incoming mail into the holding area until released by MailScanner.
CentOS 4 Service Configuration3. MailScanner should now be the one to start the Postfix service. Stop the Postfix service and start the MailScanner service in that order. Learn how to stop and start services here.
Terminal4. Test if Postfix is still working. See Test Postfix using Telnet.

Congratulations

Congratulations, your mails are now checked for spam and viruses. Each mail you send or receive will now contain the lines below to indicate that MailScanner is doing its job.

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

NoteIf you would like to change the inline signature above or any MailScanner email templates, go to /etc/MailScanner/reports/en for the English templates.

«« Previous: How to Install ClamAV
 

***
Posted on 4/25/2007 and last updated on 5/1/2008
Filed under Anti-spam/Anti-virus , CentOS 5 , MailScanner , Postfix , Red Hat Enterprise Linux 5


Share This