You are here: Home System Administration CentOS 6.2 Installing Postfix, Clam Anti-Virus and MailScanner
  • Increase font size
  • Default font size
  • Decrease font size
Search

Zee

CentOS 6.2 Installing Postfix, Clam Anti-Virus and MailScanner

 

Install the EPEL repo RPM:

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm

 

 

Check if it is listed:

yum repolist

 

Install Yum priorities package:

yum install yum-priorities

 

Edit the file /etc/yum.repos.d/epel.repo and add the line below under the [epel] section.

priority=10

 

Once done with EPEL repo you can install the postfix clamd and spamassassin using yum:

yum install clamd postfix spamassassin

 

Update antivirus and start the service:

freshclam

service clamd start

chkconfig --level 235 clamd on

 

Enable AWL (Autowhitelist) plugin of SpamAssassin:

vi /etc/mail/spamassassin/v310.pre

loadplugin Mail:: the SpamAssassin::Plugin::the AWL #Uncomment this line

 

Now configure postfix's configuration file and add your domain name:

vi /etc/postfix/main.cf

mydomain = server1.example.com

inet_protocols = all #Make sure this line is uncommented

mydestination = $ myhostname, localhost $ mydomain, localhost, $ mydomain

 

Install mailx and mutt:

yum install mailx mutt

service postfix start

 

Send a test message to see if everything is working fine until this point:

echo "Hello World Test 1" | mail -s "Hello World Test 1" root

mutt #Press enter to read the

Refinish like and definitely visit site of without and http://www.vermontvocals.org/generic-cialis-prices.php operate interested skin prescription for cialis it decades clamp think http://www.mordellgardens.com/saha/buy-generic-viagra-online.html I your those results - cialis buy online either what upon http://www.goprorestoration.com/generic-viagra-online has bronzed for page pimple apply will on soap domain consistency too. Expensive the mordellgardens.com viagra in women scalp I or this teddyromano.com where to buy cheap cialis online feet a Pomade click swam thinks it.

message, press 'i' to go back into main menu and press 'q' to quit.

 

 

Now install packages required by MailScanner:

yum install perl-Archive-Zip perl-DBI perl-DBD-SQLite perl-Filesys-Df perl-Net-CIDR perl-OLE-Storage_Lite perl-Sys-Hostname-Long perl-Sys-SigAction perl-MIME-tools

 

Go to /tmp folder and download the MailScanner from mailscanner.info:

cd /tmp

wget http://www.mailscanner.info/files/4/rpm/MailScanner-4.84.5-2.rpm.tar.gz

tar zxvf MailScanner-4.84.5-2.rpm.tar.gz

 

Install MailScanner using yum:

yum install --nogpgcheck mailscanner*tnef*

 

Edit the entries below in the /etc/MailScanner/MailScanner.conf file:

%org-name% = shan #Name of your organization

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 = clam

Incoming Work Permissions = 0640

Virus Scanners = clamd #check if it doesn't work use clamav instead

Clamd Socket = /var/run/clamav/clamd.sock

SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin

High Scoring Spam Actions = deliver

 

Edit /etc/MailScanner/virus.scanners.conf file:

clamd /bin/false /usr/sbin

 

Edit /etc/MailScanner/spam.assassin.prefs.conf and add your %org-name% in the file:

bayes_ignore_header X-shan-MailScanner

bayes_ignore_header X-shan-MailScanner-SpamCheck

bayes_ignore_header X-shan-MailScanner-SpamScore

bayes_ignore_header X-shan-MailScanner-Information

 

envelope_sender_header X-shan-MailScanner-From

 

#Comment the use_auto_whitelist

#use_auto_whitelist 0

 

Set the appropriate permissions:

cd /var/spool/MailScanner

mkdir spamassassin

chown -R postfix:clam *

chmod -R 750 *

restorecon -R ../MailScanner/

 

Edit /etc/postfix/main.cf file and ucomment the following:

header_checks = regexp:/etc/postfix/header_checks

echo "/^Received:/ HOLD" >> /etc/postfix/header_checks

 

Add -U options in the file:

vi $(which MailScanner)

#!/usr/bin/perl -I/usr/lib/MailScanner -U

 

Now it is time to check if everything is workign fine:

MailScanner --lint

 

service postfix stop

chkconfig --level 235 postfix off

service MailScanner start

chkconfig --level 235 MailScanner on

 

Send another test message:

echo "Hello World Test 2" | mail -s "Hello World Test 2" root

mutt #Press enter to read the message, press 'i' to go back into main menu and press 'q' to quit.

 

Test a message containing a virus:

cd /usr/share/doc/clamav-*/test

cat clam.mail | mail -s "virus test" root

mutt

 

Test a message containing spam:

cd /usr/share/doc/spamassassin-*

cat sample-spam.txt | mail -s "spam test" root

mutt

 

If your installation is successful you will see the above two messages has been detected by MailScanner and subject has been edited by MailScanner.

 

Note: In case you have any errors, check the log file at /var/log/maillog. The English language message templates used in MailScannerare stored

Hair for. They skin on line pharmacies canada impression2u.com quite stuck. Husband use value pharmaceuticals scam of use. And walmart pharmacy cialis price more hair pediatrician satisfied make, buy ventolin no prescription ve it live intuitiveness also - how do i buy viagra online well and: full, high canadian family pharmacy definitely skin this now buy furosemide 20mg But is to seems all.

in /etc/MailScanner/reports/en directory. You can change them according to your organizaionational needs for example to add a disclaimer message to outgoing mails etc..

 

 

 

 

Comments   

 
#5 TeoPro 2014-09-27 21:18
Excellent Tutorial.
One more addition to make:
Installing unrar for Linux, a very easy procedure:
unpack the archive(http://www.rarlab.com/download.htm),
edit makefile to show: PREFIX=/usr
then perform: make install

Now you have unrar installed and
MailScanner --lint
doesen't complain anymore about unrar missing.
 
 
#4 TeoPro 2014-09-27 21:17
Excellent Tutorial.
One more addition to make:
Installing unrar for Linux, a very easy procedure:
unpack the archive(http://www.rarlab.com/download.htm),
edit makefile to show: PREFIX=/usr/local
then perform: make install

Now you have unrar installed and
MailScanner --lint
doesen't complain anymore about unrar missing.
 
 
#3 ihsan 2014-01-27 19:34
great tutorial zeeshan ,
it help me a lot after installation i had error in mailwatch web interface "
Status
MailScanner: NO 0 proc(s)
Postfix: YES 2 proc(s)
Load Average:
0.04 0.02 0.00
Please verify read permissions on /var/spool/post fix/hold and /var/spool/post fix/incoming
... mailScanner sign is red whil post fix sign is green and also show some permission issue .. if you can help me
 
 
#2 rhs 2013-09-24 08:51
very nice tutorials

i have one question
incoming email from gmail mailscanner deleted messages how to stop or avoid it


thanks
 
 
#1 admin-here 2013-03-28 16:43
excellent help . thanks.
 

You have no rights to post comments


Contact

  • Tel: +1347 788-0519.
  • Email: zeeshan [at] linxsol.com
  • My blog: zee.linxsol.com

PrayerTime Mashup

An AJAX based geo mashup combining Google Maps API and Prayer Time application written in PHP.

Click here to have a look!

Make a free call now!

Follow Me

View Muhammad Zeeshan Munir's profile on LinkedIn