Instructions for Installing MailScanner 4.68-8 on Ubuntu 8.04

Mohammed Alli malli at
Wed Apr 30 03:16:12 IST 2008

Instructions to install MailScanner 4.68-8 on Ubuntu 8.04


These instructions serves as a guide for setting up MailScanner 4.68-8 on Ubuntu 8.04 with a working Postfix configuration.  I cannot provide any guarantee that this will work for you.


Install MailScanner 

Install MailScanner Dependencies by doing the following:

apt-get install libconvert-tnef-perl libdbd-sqlite3-perl libfilesys-df-perl libmailtools-perl libmime-tools-perl libmime-perl libnet-cidr-perl libsys-syslog-perl libio-stringy-perl libfile-temp-perl


Install MailScanner from the Debian .deb Source:


dpkg -i mailscanner_4.68.8-1_all.deb


Configuring MailScanner and ClamAV


Stop Postfix:

postfix stop


Install the packages:

apt-get install clamav clamav-daemon


Update ClamAV virus definitions:



Once that is done, we need to make a directory for SpamAssassin in the spool and give postfix permissions to it:

mkdir /var/spool/MailScanner/spamassassin


Backup your MailScanner.conf file:

cp /etc/MailScanner/MailScanner.conf /etc/MailScanner/MailScanner.conf.back


Edit MailScanner.conf:

vi /etc/MailScanner/MailScanner.conf


Change the following parameters in MailScanner.conf:

%org-name% = ORGNAME
%org-long-name% = ORGFULLNAME
%web-site% = ORGWEBSITE
Run As User = postfix
Run As Group = postfix                            
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix
Virus Scanners = clamav
Spam Subject Text = ***SPAM***
Send Notices = no
Spam List = SBL+XBL 
Required SpamAssassin Score = 6            
High SpamAssassin Score = 10                
Spam Actions = deliver             
High Scoring Spam Actions = delete          
Rebuild Bayes Every = 0                           
Wait During Bayes Rebuild = no 
SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin


header_checks & body_checks

Let's go ahead and put this in header_checks is required because it allows us to hold all incoming email in order for MailScanner to do it's thing:

postconf -e "header_checks = regexp:/etc/postfix/header_checks"


Edit header_checks:

vi /etc/postfix/header_checks


Add this line to the header_checks file, without it MailScanner will not work:

/^Received:/ HOLD


 Fix to Disable Permission Checks on MailScanner Directories:

*	Comment out the lines that check directory permissions on /var/* in /etc/rc2.d/S20mailscanner

 In the file /etc/default/mailscanner, make sure this parameter is at 1: 




You can now start the system:

/etc/init.d/mailscanner start

/etc/init.d/postfix start


Fix for Ubuntu 8.04 (kept removing directories upon reboot) - May or may not be needed

Edit /etc/rc.local and add the following before the exit line:

mkdir /var/run/MailScanner

mkdir /var/lock/subsys

mkdir /var/lock/subsys/MailScanner

chown -R postfix:postfix /var/run/MailScanner

chown -R postfix:postfix /var/lock/subsys/MailScanner

/etc/init.d/postfix restart

/etc/init.d/mailscanner restart.



That's it!





Mohammed Alli


From: mailscanner-bounces at on behalf of Julian Field
Sent: Tue 4/29/2008 5:55 PM
To: MailScanner discussion
Subject: Re: Ubuntu - sendmail problem

Mohammed Alli wrote:
> To try to shed some light on this issue, ill throw in my 2cents.  I have successfully setup ubuntu 8.04 with mailscanner (Debian .deb 4.68.8) and postfix.  It was easy and didn't require me to do anything fancy.
In which case, please can you give us detailed instructions on how to do it?
And can you then write it up in the wiki for us as well please?

> -----Original Message-----
> From: "Andrei Caraman" <adc at>
> To: "MailScanner discussion" <mailscanner at>
> Sent: 4/29/08    5:49 PM
> Subject: Re: Ubuntu - sendmail problem
> On Mon, Apr 28, 2008 at 06:18:03PM +0100, Julian Field wrote:
>> Your best method for getting MailScanner working on Ubuntu is probably
>> to use the Debian package, which should just drop in and run. Doing this
>> will save you an awful lot of grief.
> that just might be easier said than done.  yes, ubuntu uses the debian
> package management, but that doesn't necessarily mean the same packages.
> using a debian .deb on ubuntu or viceversa may work, but i don't think
> anyone can guarantee it.  mailscanner might work - perl is perl is perl, to
> quote someone, but on the other hand, it may not, as it will pull in a lot
> of other debs on which it depends.  one may end up with a messy mix of
> ubuntul and debian packages.
> that being said,...
>> I'm new to Ubuntu as well, so I don't know how to install the Debian
>> package, hopefully someone else here can enlighten both of us on this
>> subject?
>> Someone?
> i run mailscanner and sendmail on debian.  while i'm not a guru on the
> subject, i do know a few things about this combo.
>> Rick Bragg wrote:
>> [...]
>>> I followed this page for direction:
> for debian (and probably ubuntu too), you want to make your local
> customization in config files that won't get automatically overwritten on
> upgrades.  hence you'll want to translate the instructions above in
> debian-speak:
> 1.  the privacy options can go in, like this (wrapped for
>     readability):
>       define(`confPRIVACY_FLAGS',`noetrn,needmailhelo,noexpn,novrfy,
>       restrictqrun,restrictexpand,nobodyreturn,authwarnings')dnl
> 2.  in sendmail.conf you'll need (again, wrapped):
>       DAEMON_PARMS="-bd -ODeliveryMode=queueonly
>       -OQueueDirectory=/var/spool/";
>     if i remember correctly, the debian default is
>       DAEMON_PARMS="-bd";
> that should take care of your sendmail configuration, without touching the
> init.d start/stop script.  your sendmail should start upon boot, accept
> messages and queue them under /var/spool/  it's the job of
> mailscanner to examine the messages from and move them to
> /var/spool/mqueue (if it decides to let them pass).
> one thing to keep in mind is sendmail and mailscanner are supposed to be
> started and/or stopped independently with this setup. 
> the other thing about being unable to remove the mailscanner package prior
> to an upgrade has to do with the init.d script returning 1 (instead of 0) on
> stop (and on start too, actually).  i suppose that's a bug that went away in
> debian/lenny, mailscanner 4.68.8.  the workaround i've used for that was to
> first stop mailscanner, then to comment out the run_mailscanner line in
> /etc/default/mailscanner (then the init script woulr return 0).
> i will be happy to share my experience with this setup.  if this so specific
> to make it off topic for the list, ask privately, and i shall answer
> privately.
> one last thing here:  my impression is that debian keeps better pace with
> new software versions than ubuntu does.  would a switch to debian be
> concevable for that particular box?
> adc


Julian Field MEng CITP CEng
Buy the MailScanner book at

MailScanner customisation, or any advanced system administration help?
Contact me at Jules at Jules.FM

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
PGP public key:

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

MailScanner mailing list
mailscanner at

Before posting, read

Support MailScanner development - buy the book off the website!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 20111 bytes
Desc: not available
Url :

More information about the MailScanner mailing list