The Perfect SpamSnake - Ubuntu Jeos 12.04 LTS Precise Pangolin - Page 2

7. Install MailScanner (Apparmor, Clamav, DCC, Pyzor, Razor and Spamassassin)

apt-get install razor pyzor clamav-daemon libclamav6 apparmor -y


Apparmor configuration for Clamav

Add clamav to the www-data group so that it can access the directory:

usermod -a -G www-data clamav

Now edit the profile for clamd:

vi /etc/apparmor.d/usr.sbin.clamd

and add the following to the list of folders:

   /var/spool/MailScanner/** rw,
   /var/spool/MailScanner/incoming/** rw,

Reload apparmor:

/etc/init.d/apparmor reload


DCC 32bit/64bit Configuration

Install DCC from .deb source:

cd /tmp
wget$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb && dpkg -i dcc-common_1.3.130-0ubuntu1~ppa2~quantal1_$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb
wget$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb && dpkg -i dcc-client_1.3.130-0ubuntu1~ppa2~quantal1_$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb

Test our installation with:

cdcc info

You should get 'requests ok' from the servers.


Pyzor Configuration

Because pyzor doesn’t work with python2.6 very well, the workaround is to append the following to the first line of /usr/bin/pyzor to make it look like:

#!/usr/bin/python -Wignore::DeprecationWarning

Here we supply the IP address of the Pyzor server to Pyzor. This will create the server's IP address in a servers file therein. Then it will test the connection. If you are behind a firewall, open port 24441/udp in and out to your server. While you're at it also open up 6277/udp for DCC, 2703/tcp for Razor and 783/tcp for SpamAssassin:

mkdir /var/lib/MailScanner
pyzor --homedir=/var/lib/MailScanner discover
pyzor ping


Razor Configuration

Create the .razor configuration:

cd && rm /etc/razor/razor-agent.conf
mkdir /var/lib/MailScanner/.razor
razor-admin -home=/var/lib/MailScanner/.razor -create
razor-admin -home=/var/lib/MailScanner/.razor -discover
razor-admin -home=/var/lib/MailScanner/.razor -register

vi /var/lib/MailScanner/.razor/razor-agent.conf

and add/update the follwing

debuglevel      = 0
razorhome 	= /var/lib/MailScanner/.razor/


Install dependencies:

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 libole-storage-lite-perl libarchive-zip-perl libsys-hostname-long-perl libnet-cidr-lite-perl libhtml-parser-perl libdb-file-lock-perl libnet-dns-perl libncurses5-dev libdigest-hmac-perl libnet-ip-perl liburi-perl libfile-spec-perl spamassassin libnet-ident-perl libmail-spf-perl libmail-dkim-perl dnsutils libio-socket-ssl-perl gdebi-core -y
wget http$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb && dpkg -i libdigest-sha1-perl_2.13-2build2_$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb


Download and install the latest MailScanner:

cd /usr/src && wget
tar xvfz MailScanner-install-4.84.5-3.tar.gz && cd MailScanner-install-4.84.5

Add the following to cron:

37      5 * * *  /opt/MailScanner/bin/update_phishing_sites &> /dev/null
07      * * * *  /opt/MailScanner/bin/update_bad_phishing_sites &> /dev/null
58     23 * * * /opt/MailScanner/bin/clean.quarantine &> /dev/null
42      * * * *  /opt/MailScanner/bin/update_virus_scanners &> /dev/null
3,23,43 * * * *  /opt/MailScanner/bin/check_mailscanner &> /dev/null


Fix Clamav autoupdate

vi /opt/MailScanner/etc/virus.scanners.conf

and update the following to:
clamav          /opt/MailScanner/lib/clamav-wrapper     /usr/


First we need to disable the default SpamAssassin configuration file:

mv /etc/spamassassin/ /etc/spamassassin/

Now let's backup the SpamAssassin configuration file in MailScanner then edit:

cp /opt/MailScanner/etc/spam.assassin.prefs.conf /opt/MailScanner/etc/spam.assassin.prefs.conf.back


SpamAssassin SQL Bayes

Pre-requisities: You'll need the perl-DBI and perl-DBD-MySQL modules installed.

Assumptions and Variables:

SpamAssassin Bayes Database Name: sa_bayes
SpamAssassin Bayes Database UserName: sa_user
SpamAssassin Bayes Database Password: sa_password

Create the MySQL database on the server where you intend on storing the bayesian information.

mysql -u root -p
mysql> create database sa_bayes;
mysql> GRANT ALL ON sa_bayes.* TO sa_user@localhost IDENTIFIED BY 'sa_password';
mysql> flush privileges;

Import database structure:

mysql -u sa_user -p sa_bayes < /usr/share/doc/spamassassin/sql/bayes_mysql.sql

*Note: If errors about MyISAM appears, edit bayes_mysql.sql and change TYPE to ENGINE.

vi /etc/spamassassin/v310.pre

and enable DCC:

loadplugin  Mail::SpamAssassin::Plugin::DCC

Create the following to prevent an error in a lint test:

mkdir /var/www/.spamassassin

vi /opt/MailScanner/etc/spam.assassin.prefs.conf

and add the following to the top:

use_pyzor 1
pyzor_options --homedir /var/lib/MailScanner/
use_razor2 1
razor_config /var/lib/MailScanner/.razor/razor-agent.conf

Fix DCC path:

dcc_path /usr/bin/dccproc

Update header string:

bayes_ignore_header X-YOURDOMAIN-COM-MailScanner
bayes_ignore_header X-YOURDOMAIN-COM-MailScanner-SpamCheck
bayes_ignore_header X-YOURDOMAIN-COM-MailScanner-SpamScore
bayes_ignore_header X-YOURDOMAIN-COM-MailScanner-Information
#use_auto_whitelist 0

"YOURDOMAIN-COM" should be replaced with whatever you used for "%org-name%" in the MailScanner.conf file. Leave the "X-" in place. This is the same orgname used in the MailScanner.conf above.

Add sql connection string to bottom:

bayes_store_module Mail::SpamAssassin::BayesStore::SQL
bayes_sql_dsn DBI:mysql:sa_bayes:localhost
bayes_sql_username sa_user
bayes_sql_password sa_password
bayes_sql_override_username root

Add it to cron:

30 01 * * * /usr/bin/sa-learn --force-expire --sync -p /opt/MailScanner/etc/spam.assassin.prefs.conf 

Install missing perl packages:

perl -MCPAN -e shell
install IP::Country::Fast
install Encode::Detect
install Crypt::OpenSSL::RSA

Set permissions to bring it all together:

chown -R postfix:www-data /var/spool/postfix/hold
chmod -R ug+rwx /var/spool/postfix/hold

Test out the setup:

spamassassin -x -D -p /opt/MailScanner/etc/spam.assassin.prefs.conf --lint

Check for lines like:

debug: bayes: Database connection established
debug: bayes: found bayes db version 3
debug: bayes: Using userid: 2

You should see lines come up with DCC, Pyzor and Razor that say loading plugin and hopefully no errors.


MailScanner Configuration

We need to make a directory for SpamAssassin in the spool and give postfix permissions to it, if you run sa-learn --force as root, bayes databese that is stored in these directories will change to root:root and spamassassin will error looking at the db. Just keep an eye on the mail.log and you'll remember to change the permissions back. Also disable the MailScanner default configs:

mkdir /var/spool/MailScanner/spamassassin

Backup your MailScanner.conf file:

cp /opt/MailScanner/etc/MailScanner.conf /opt/MailScanner/etc/MailScanner.conf.dist

vi /usr/src/

with the following content:

*Note: This step populates the MailScanner.conf file.

sed -i "/^%org-name% =/ c\%org-name% =orgname" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^%org-long-name% =/ c\%org-long-name% = longorgname" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^%web-site% =/ c\%web-site% = www.domain.tld" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Run As User =/ c\Run As User = postfix" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Run As Group =/ c\Run As Group = www-data" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Incoming Work Group =/ c\Incoming Work Group = clamav" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Incoming Work Permissions =/ c\Incoming Work Permissions = 0640" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Incoming Queue Dir =/ c\Incoming Queue Dir = /var/spool/postfix/hold" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Outgoing Queue Dir =/ c\Outgoing Queue Dir = /var/spool/postfix/incoming" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^MTA =/ c\MTA = postfix" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Quarantine User =/ c\Quarantine User = root" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Quarantine Group =/ c\Quarantine Group = www-data" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Quarantine Permissions =/ c\Quarantine Permissions = 0660" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Quarantine Whole Message =/ c\Quarantine Whole Message = yes" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Virus Scanners =/ c\Virus Scanners = clamd" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Monitors for ClamAV Updates =/ c\Monitors for ClamAV Updates = /var/lib/clamav/*.cld /var/lib/clamav/*.cvd" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Clamd Socket =/ c\Clamd Socket = /var/run/clamav/clamd.ctl" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Clamd Lock File =/ c\Clamd Lock File = /var/run/clamav/" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Spam Subject Text =/ c\Spam Subject Text = ***SPAM***" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Spam Actions =/ c\Spam Actions = deliver store" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^High Scoring Spam Actions =/ c\High Scoring Spam Actions = store delete" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^Non Spam Actions =/ c\Non Spam Actions = deliver store" /opt/MailScanner/etc/MailScanner.conf
sed -i "/^SpamAssassin User State Dir =/ c\SpamAssassin User State Dir = /var/spool/MailScanner/spamassassin" /opt/MailScanner/etc/MailScanner.conf

*Note: Make sure to change the items in red before running the script.

Make it executable and run it:

chmod +x


MailScanner Startup Script:

vi /etc/init.d/mailscanner

with the following content:

#! /bin/sh
   # Provides:          MailScanner daemon
   # Required-Start:    $local_fs $remote_fs
   # Required-Stop:     $local_fs $remote_fs
   # Default-Start:     2 3 4 5
   # Default-Stop:      0 1 6
   # Short-Description: Controls mailscanner instances
   # Description:       MailScanner is a queue-based spam/virus filter
   # Author: Simon Walter <>
   # PATH should only include /usr/* if it runs after the script
   DESC="mail spam/virus scanner"
   # Exit if the package is not installed
   [ -x "$DAEMON" ] || exit 0
   # Read configuration variable file if it is present
   [ -r /etc/default/$PNAME ] && . /etc/default/$PNAME
   # Load the VERBOSE setting and other rcS variables
   . /lib/init/
   # Define LSB log_* functions.
   # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
   . /lib/lsb/init-functions
   # sanity check for permissions
   echo >&2 "$0: $1"
   exit 1
   if [ ! -d $1 ]; then
   mkdir -p "$1" || \
   fail "directory $1: does not exist and cannot be created"
   actual="$(stat -c %U $1)"
   if [ "$actual" != "$2" ]; then
   chown -R "$2" "$1" || \
   fail "directory $1: wrong owner (expected $2 but is $actual)"
   actual="$(stat -c %G $1)"
   if [ "$actual" != "$3" ]; then
   chgrp -R "$3" "$1" || \
   fail "directory $1: wrong group (expected $3 but is $actual)"
   user=$(echo $(awk -F= '/^Run As User/ {print $2; exit}' $CONFFILE))
   group=$(echo $(awk -F= '/^Run As Group/ {print $2; exit}' $CONFFILE))
   check_dir /var/spool/MailScanner       ${user:-postfix} ${group:-www-data}
   check_dir /var/lib/MailScanner         ${user:-postfix} ${group:-www-data}
   check_dir /var/run/MailScanner         ${user:-postfix} ${group:-www-data}
   check_dir /var/lock/subsys	${user:-root}	${group:-root} #Required to Create Folder
   check_dir /var/lock/subsys/MailScanner ${user:-postfix} ${group:-www-data}
   # Function that starts the daemon/service
   # Return
   #   0 if daemon has been started
   #   1 if daemon was already running
   #   2 if daemon could not be started
   start-stop-daemon --start --quiet --startas $STARTAS --name $NAME --test > /dev/null \
   || return 1
   start-stop-daemon --start --quiet --nicelevel $run_nice --chuid postfix:www-data --exec $DAEMON --name $NAME -- $DAEMON_ARGS \
   || return 2
   # Add code here, if necessary, that waits for the process to be ready
   # to handle requests from services started subsequently which depend
   # on this one.  As a last resort, sleep for some time.
   # Set lockfile to inform cronjobs about the running daemon
   if [ $RETVAL -eq 0 ]; then
   touch /var/lock/subsys/mailscanner
   rm -f $stopped_lockfile
   if [ $RETVAL -eq 0 ]; then
   echo "MailScanner Started"
   # Function that stops the daemon/service
   # Return
   #   0 if daemon has been stopped
   #   1 if daemon was already stopped
   #   2 if daemon could not be stopped
   #   other if a failure occurred
   start-stop-daemon --stop --retry=TERM/30 --name $NAME
   [ "$RETVAL" = 2 ] && return 2
   # Remove lockfile for cronjobs
   if [ $RETVAL -eq 0 ]; then
   rm -f /var/lock/subsys/mailscanner
   touch $stopped_lockfile
   if [ $RETVAL -eq 0 ]; then
   echo "MailScanner Stopped"
   # Function that sends a SIGHUP to the daemon/service
   do_reload() {
   start-stop-daemon --stop --signal 1 --quiet --name $NAME
   return 0
   case "$1" in
   [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
   case "$?" in
   0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
   2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
   case "$?" in
   0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
   2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   # If the "reload" option is implemented then remove the
   # 'force-reload' alias
   log_daemon_msg "Restarting $DESC" "$NAME"
   case "$?" in
   case "$?" in
   0) log_end_msg 0 ;;
   1) log_end_msg 1 ;; # Old process is still running
   *) log_end_msg 1 ;; # Failed to start
   # Failed to stop
   log_end_msg 1
   echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
   exit 3
 exit 0

Make it executable:

chmod +x /etc/init.d/mailscanner

Create Symlinks for mailscanner script to work:

chmod 755 /etc/init.d/mailscanner
update-rc.d mailscanner defaults
ln -s /opt/MailScanner/bin/Quick.Peek /usr/sbin/Quick.Peek

Start the system:

/etc/init.d/mailscanner start
/etc/init.d/postfix start

Check your logs for errors:

tail -f /var/log/mail.log

Check your mail.log (tail –f /var/log/mail.log) and you should see the following:

Jun 13 12:18:23 hoshi MailScanner[26388]: MailScanner E-Mail Virus Scanner version 4.84.5 starting...

Congratulations - you now have MailScanner logging to MySQL.

Share this page:

43 Comment(s)

Add comment


From: Marco at: 2013-03-01 17:38:32

don't you need to add spf to  I got errors on policy-spf_time_limit until i added

policy-spf    unix  -     n     n     -     -   spawn

user=nobody argv=/usr/bin/policyd-spf

to /etc/postfix/


From: at: 2013-03-19 20:26:59

spf is added to later in the tutorial, however the line in the script to setup has an error. It says:

postconf -e "spf_policy = check_policy_service unix:private/policy" 

it should be:

postconf -e "spf_policy = check_policy_service unix:private/policy-spf"

 also the line about rbl policy is commented out with #, which postfix didn't like when I ran the script.  I just added it manually when i set up rbl.

From: Anonymous at: 2013-09-18 03:20:37

In the edit for postfix, the next line says:

 vi /usr/src/ 

which makes no sense whatsoever ??

 Also, the username and password for mysql are not referenced elsewhere - I assume the user should be root, and the associated password?


From: at: 2014-01-24 16:15:31

You are creating a script to edit, so the command "vi /usr/src/" creates an empty file then you add the text indicated to the file.  Make sure to change the red text to match your setup.

 There is no need for your mysql password here.  You are simply adding the settings to postfix.  Make sure you remember the password you select for the baruwa db.  You will need to make sure it matches the password you set when you create that db.

From: at: 2013-11-25 21:58:53

I have been trying to set this up, and having problems. Even opened a thread up in forums:, however no reply so far.

 Is there anyone who can help to complete the setup ?

From: at: 2014-01-24 16:06:38

Rocky changed jobs so isn't as available as he once was.  What problems are you having?

From: at: 2014-02-09 19:38:27


Since i didn't get a notice on a reply, I didn't notice your post even. I had posted by issue on the forums ->, to which Rocky did reply. I can understand his unavailability. Is there an updated guide which i can use ?

I wish to do inbound as well as outbound spam filtering, separate ofcourse.


From: JR at: 2012-12-21 20:40:34

In addition to the instructions provided here, it was also necessary to create the MailScanner incoming directory:

mkdir /var/spool/MailScanner/incoming
chown postfix:www-data /var/spool/MailScanner/incoming

Mailscanner started just fine after this...  



From: Anonymous at: 2013-03-18 19:09:08

dcc package dcc-common_1.3.130-0ubuntu1~ppa2~quantal1 as well as client seems to be unavailable.  I installed with 1.3.144-0ubuntu1~ppa1~precise1 which seems to be working fine. So to install dcc try this:

 wget$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb && dpkg -i dcc-common_1.3.144-0ubuntu1~ppa1~precise1_$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb
wget$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb && dpkg -i dcc-client_1.3.144-0ubuntu1~ppa1~precise1_$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb

NB I didn't run this by Rocky...  but it is working fine for me.



From: Andy at: 2013-04-08 02:56:55

Another question on this...  Is there any particular reason to install the "quantal" version on "precise", and why are we doing it this way instead of adding the ppa and installing it via apt?  Not criticising, just asking the question, because I'm sure Rocky has a good reason, and I want to know :)



From: newbie at: 2013-04-15 04:17:06


DCC still failed to start based on your sources;

I got this unavailable error:

root@unknown:/tmp#  wget$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb && dpkg -i dcc-common_1.3.144-0ubuntu1~ppa1~precise1_$(uname -m | sed -e 's/x86_64/amd64/' -e 's/i686/i386/').deb
--2013-04-15 12:06:21--
Resolving (
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-04-15 12:06:21 ERROR 404: Not Found.

Please help , many thanks:)

From: at: 2013-09-27 15:52:34

ya they changed the file name again.  In this case you just need to change the instances of ppa1 in the name to ppa2.  You can always go to to see which version of the files are currently available.

From: jamesloker at: 2013-07-16 15:21:48

If you receive this error when running the spamassassin test run the command:

#sa-learn --sync

Then try the spamassassin test again 

From: Anonymous at: 2013-11-22 21:05:50

you might need to run this  

 apt-get install libssl-dev 

 before you can install Crypt::OpenSSL::RSA

From: at: 2014-01-24 16:35:13

I had the same issue.  I also had to install libmysqlclient-dev before I could install DBD::mysql

From: at: 2014-02-14 07:16:25

Create the following to prevent an error in a lint test:

mkdir /var/www/.spamassassin

But not have /var/www now.



From: at: 2014-03-10 15:26:24

For this part don't forget to run  

apt-get install libmysqlclient-dev


From: Real at: 2012-12-19 15:10:55

Same probléme with the FTP auth 

 But very good How to, more details, nice!

From: Dan at: 2012-12-19 05:09:16      


The above (or any variant) is not public.  If it is your ftp, please set it to anonymous ftp or provide another way to download the file.  Thanks for all the effort to put this together.

From: JhonKa at: 2012-12-27 23:30:08


 I followed all your instructions to a T and i'm having an error when I start up nginx I get this error

 /etc/init.d/uwsgi restart && /etc/init.d/nginx restart

* Restarting app server(s) uwsgi [ OK ] 

Restarting nginx: nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/nginx/sites-enabled/baruwa.conf:7
nginx: configuration file /etc/nginx/nginx.conf test failed

I even used your SN packages from your google docs account.  Could you help point me in the right direction?

From: at: 2012-12-28 08:40:20

What is on line 7 of /etc/nginx/sites-enabled/baruwa.conf

From: at: 2012-12-28 15:50:47

You can ignore this!  I found out that the baruwa.ini and .conf were switched in the uwsgi and nginx files.

From: at: 2012-12-28 19:41:11

Fixed, nginx and uwsgi config files were mixed up.

From: Doug Thomas at: 2013-01-06 21:34:49

Can't use an undefined value as an ARRAY reference at /opt/MailScanner/lib/MailScanner/ line 2588, <DATA> line 500.

Is anyone else getting this error? 

From: at: 2013-04-09 09:48:39

 I do.


Did you find the solution?

From: Andy at: 2013-06-06 00:52:19

I have this too. My guess is it's something in the MailScanner.conf, but line 500 is just a comment, and if you grep out all the comments there's less than 500 lines.  I'm still looking into it, but if anyone could shed light it would be appreciated :)

From: Andy at: 2013-06-06 01:25:37

I found this occurred because I hadn't commented out the following lines:

#Inline HTML Signature = htmlsigs.customize
#Inline Text Signature = textsigs.customize
#Signature Image Filename = sigimgfiles.customize
#Signature Image Filename = sigimgs.customize

as described above, AND I hadn't set up signatures properly (I'm not really sure how to do this at this stage).  So I commented out the lines, ran /opt/MailScanner/bin/MailScanner --lint, and things seem to be working a lot better.

Hope that helps someone.


From: SHL at: 2013-01-27 16:08:17


 I believe i've followed to guide but my SpamSnake isn't working when rbl_policy and spf_policy is added here: smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unknown_recipient_domain, reject_unauth_destination, whitelist_policy, grey_policy, permit

I'm getting these errors:

postfix/smtpd[6073]: warning: connect to private/policy: No such file or directory

warning: unknown smtpd restriction: "rbl_policy"

Could someone point me in the right direction? :) 

From: monopati at: 2013-03-24 18:10:07

I get 

 # baruwa-admin migrate
Unknown command: 'migrate'
Type 'baruwa-admin help' for usage.


 # baruwa-admin createsuperuser
Unknown command: 'createsuperuser'
Type 'baruwa-admin help' for usage.

Is there any replacement for these commands?


From: kup at: 2013-04-23 07:25:25

Rocky, thank you for this great howto. Please let us know, how to migrate Baruwa frontend to next version (2.0), if you have some way to do it.

Many thanks!

From: at: 2013-08-06 17:39:07

There is no direct upgrade path to 2.0.  Also, 2.0 only currently supports Exim for an MTA.   I did get it working rather poorly with Postfix on a test server, but I wouldn't put it into production.  I would wait until Postfix is supported.

From: kec at: 2013-04-23 07:34:22

For the first Rocky, I have to say - thank you for this great guide. I also want to ask you, if you have a way, how to migrate Baruwa frontend to next version (2.0)?

From: kup at: 2013-04-23 10:30:21

Just one hint for those who want to see Baruwa translated:

#apt-get install gettext
#baruwa-admin compilemessages

Event. edit main language of Baruwa:

#vi /etc/baruwa/




From: Mikacom at: 2013-11-21 21:20:10

Populating the database has changed to

#baruwa-admin migrate djcelery

From: Anonymous at: 2013-04-19 09:49:15

Nice guide, some minor problems at start but works perfect now !
Thanks alot ! ! !


From: Anonymous at: 2013-05-20 15:22:41


do not plan on virtual images to be issued?


From: e3fi389 at: 2013-05-27 11:02:40

Little (but interest!) error in script, correct line 68:

  attrs  => ["proxyAddresses"],


From: at: 2014-05-04 06:50:09


Great tutorial.

in the, i was getting an error message regarding postman and postfix. There are 2 ways around it.

1) Put and getadsmtp in the /usr/sbin directory and update the cron accordingly using crontab -e
2) in the change the following lines:
postmap /etc/postfix/relay_recipients
postfix reload

/usr/sbin/postmap /etc/postfix/relay_recipients
/usr/sbin/postfix reload

From: Kevin Traas at: 2014-06-12 19:01:00

* Line 141:  replace '' with ''.
* Line 257:  replace the (invalid) less-than character.

From: Anonymous at: 2014-06-12 19:05:46

The suggested cron change to run update_scamnailer on a daily basis has the wrong path, and is a bit ambiguous.  

 Instead, add the following to /etc/crontab

 53      3 * * * /opt/MailScanner/bin/update_scamnailer

From: kecup at: 2014-11-03 15:45:08

Thanks for great howto, but let me ask you, do you plan an update of this all? I mean upversion this howto to Ubuntu 14.04? Thank you.

From: Michael at: 2015-02-24 21:32:36

just having a small issue with the setup. im new to linux but am trying to learn. so the question i have might be extremely basic but im not sure.


im getting the following error when trying to start maillscanner via /etc/init.d/mailscanner start

Can't use an undefined value as an ARRAY reference at /opt/MailScanner/lib/MailScanner/ line 2588, <DATA> line 500.

so i commented out the following in the file /etc/MailScanner/conf.d/baruwa.conf

#Inline HTML Signature = htmlsigs.customize#Inline Text Signature = textsigs.customize#Signature Image Filename = sigimgfiles.customize#Signature Image Filename = sigimgs.customize

and it appears that everything is working fine. until i click the connect button in baruwa interface to test if the connection to the exchange server is valid.


it takes me to http://localhost/settings/hosts/2/test/

and says page unavailable

sorry the requested page is unavailable due to a server malfunction.


anyone got any ideas

From: Alexandro at: 2015-03-18 15:14:06

as of 2015 installation just have to fix (like said) most of wget instructions to use up2date releases of downloaded softwares, but that's a mino issue, big problem seem that djcelery need to be migrated with command:

$baruwa-admin migrate djcelery

after the the baruwa sync procedure, otherwise it wouldn't create djcelery related tables in baruwa db (preventing message preview/train/delete, smtp test connection, and few other things via web interface) beside that.. damn great guide <3