Virtual Users And Domains With Postfix, MailScanner, Mailwatch & MySQL On CentOS 5.1

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Submitted by o.meyer (Contact Author) (Forums) on Thu, 2008-03-06 17:59. :: Anti-Spam/Virus | CentOS | Email | Postfix

Virtual Users And Domains With Postfix, MailScanner, Mailwatch & MySQL On CentOS 5.1

Version 1.0
Author: Oliver Meyer <o [dot] meyer [at] projektfarm [dot] de>
Last edited 03/05/2008

This document describes how to customize Falko's "Virtual Users And Domains" - setup for CentOS 5.1 so that it works with MailScanner and Mailwatch. The resulting system provides a web interface (Mailwatch) where you can manage quarantined emails, train SpamAssassin, edit the white- and blacklist, view configuration files and the detailed MySQL database status ...

This howto is a practical guide without any warranty - it doesn't cover the theoretical backgrounds. There are many ways to set up such a system - this is the way I chose.

 

1 Preparation Part I

Open http://www.howtoforge.com/virtual-users-and-domains-postfix-courier-mysql-centos5.1 and follow steps 1 - 10.

 

2 Preparation Part II

2.1 Install ClamAV

yum -y install clamav clamd unrar

 

2.2 Language Configuration

vi /etc/sysconfig/i18n

Change:

LANG="en_US.UTF-8"

To:

LANG="en_US"

 

2.3 Get Mailscanner

Please have a look at http://www.mailscanner.info/downloads.html to find out which is the latest version. When I was writing this howto, it was version 4.66.5-3.

cd /tmp/
wget http://www.mailscanner.info/files/4/rpm/MailScanner-4.66.5-3.rpm.tar.gz
tar xvf MailScanner-4.66.5-3.rpm.tar.gz

 

3 Install Mailscanner

cd /tmp/MailScanner-4.66.5-3
./install.sh

This will take a while...

 

4 Mailscanner Configuration

mv MailScanner.conf MailScanner.conf.orig
cat MailScanner.conf.orig | egrep ^[^#] > MailScanner.conf
vi /etc/MailScanner/MailScanner.conf

Change some parameters so that they look like this:

Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix
Incoming Work Group = clamav
Incoming Work Permissions = 0640
Virus Scanners = clamd
Clamd Socket = /tmp/clamd.socket
Clamd Lock File = /var/lock/subsys/clamd
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
Quarantine User = root
Quarantine Group = apache
Quarantine Permissions = 0660
Quarantine Whole Message = yes
Quarantine Whole Message As Queue Files = no
Detailed Spam Report = yes
Include Scores In SpamAssassin Report = yes
Spam Actions = store
High Scoring Spam Actions = store
Always Looked Up Last = &MailWatchLogging
Is Definitely Not Spam = &SQLWhitelist
Is Definitely Spam = &SQLBlacklist
Filename Rules = %etc-dir%/filename.rules
Filetype Rules = %etc-dir%/filetype.rules
Dangerous Content Scanning = %rules-dir%/content.scanning.rules

mkdir /var/spool/MailScanner/spamassassin/
chown -R postfix:postfix /var/spool/MailScanner/

 

5 Install Spamassassin

The MailScanner manual recommends to install spamassassin from .tar.gz or via perl shell. Some users reported problems with the .rpm-version.

perl -MCPAN -e shell

Answer "no" when you're asked if you are ready for manual configuration.

Enter the following within the perl shell:

o conf prerequisites_policy ask
install Net::DNS

Answer "no" when you're asked if you want to enable the online tests.

install Mail::SpamAssassin
quit

 

6 Postfix Configuration

touch /etc/postfix/header_checks
echo "/^Received:/ HOLD" > /etc/postfix/header_checks
vi /etc/postfix/main.cf

Add the following line:

header_checks = regexp:/etc/postfix/header_checks

Afterwards stop postfix & sendmail and start ClamAV.

chkconfig postfix off
/etc/init.d/postfix stop
chkconfig sendmail off
service sendmail stop
chkconfig clamd on
/etc/init.d/clamd start


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Sponsored Links: Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com

One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com

One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com

One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com

AT&T Synaptic Compute as a Service. Boost your power on demand.

Trial: IBM Cognos Express Reporting, Analysis & Planning