College Logo

Installing MailScanner

First you install MailScanner

cd /usr/ports/mail/mailscanner
make install
make initial-config

The make initial-config stage copies a set of basic config files into the correct places. The MailScanner web site has a section on configuring it to work with PostFix (http://www.sng.ecs.soton.ac.uk/mailscanner/install/postfix.shtml) but most of the file locations are different on FreeBSD. The configuration files are going to be under /usr/local/etc/MailScanner (don't forget - Unix is case sensitive so you won't find much if you try looking for mailscanner!)

The changes I made to mailscanner.conf are:

%org-name% = CNWL
%org-long-name% = College of North West London
%web-site% = www.cnwl.ac.uk/mailscanner.htm
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 Permissions = 0640
Virus Scanners = clamav
Quarantine Infections = no
Deliver Cleaned Messages = no
Spam List = ORDB-RBL SBL+XBL MAPS-RBL+ #costs money (except .ac.uk)
Use SpamAssassin = yes
Log Spam = yes
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin
Sign Clean Messages = no
# Enable Spam Bounce = %rules-dir%/bounce.rules

Note that the last line adds a comment so that Spam Bounce won't be enabled

You will need to make the folders used above and give the postfix user ownership so that it can write to them:

mkdir -p /var/spool/MailScanner/incoming
mkdir -p /var/spool/MailScanner/quarantine

chown postfix:postfix /var/spool/MailScanner/incoming
chown postfix:postfix /var/spool/MailScanner/quarantine
mkdir -p /var/spool/mqueue

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

MailScanner uses a script called check_mailscanner which checks to see if the process is running and starts it if it isn't. The FreeBSD port doesn't seem to install this so:

cp /usr/ports/mail/mailscanner/work/MailScanner-install-4.43.8/bin/check_mailscanner /usr/local/sbin

Note that the number shown will be different for your install - it's the current version number - but the folder will be under the port's work folder

Edit this file and make the changes shown:

msbindir=/usr/local/libexec/MailScanner
config=/usr/local/etc/MailScanner/MailScanner.conf

Create the file edit /usr/local/etc/MailScanner/mcp/mcp.spam.assassin.prefs.conf (there's a .sample file in the same folder which you can copy; at the moment you don't need anything other than the stuff in the sample file).

Copy the file /usr/local/etc/rc.d/mailscanner.sh.sample to mailscanner.sh in the same folder. Make it executable -

chmod +x /usr/local/etc/rc.d/mailscanner.sh