MailScanner Spamassasin ClamAV install

download mailscanner

wget https://s3.amazonaws.com/msv5/release/MailScanner-5.1.1-1.deb.tar.gz
cd ~
tar -zvf MailScanner-5.1.1-1.deb.tar.gz
cd MailScanner-5.1.1-1
source install.sh

Edit the file /etc/MailScanner/virus.scanners.conf and change the path of clamav to /usr..

Edit the file /etc/MailScanner/MailScanner.conf and update the lines below..

%org-name% = your organization name
%org-long-name% = your full organization name
%web-site% = your mail support website or company website
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
Virus Scanners = clamav  ## <---*** #remarks1  use clamav instand of clamd this to  remove the permission error!!**
Use SpamAssassin = yes
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
#remarks 1
Sep 19 13:17:06 ip-10-0-0-4 MailScanner[1166]: Clamd::ERROR:: UNKNOWN CLAMD RETURN ./lstat() failed: Permission denied. ERROR :: /var/spool/MailScanner/incoming/1166

Edit the file /etc/mailScanner/defaults and update the line below

run_mailscanner=1

Edit the file /usr/sbin/mailscanner and add a -U parameter on the first line..

Integrating MailScanner into Postfix

Edit the file /etc/postfix/main.cf and add the line below

header_checks = regexp:/etc/postfix/header_checks

Create the file /etc/postfix/header_checks and add the line below

/^Received:/ HOLD

This will now place all incoming mail into the holding area until released by MailScanner. .

Use the commands below to start MailScanner

sudo service postfix restart
sudo service clamav-daemon start
sudo service mailscanner start