Table Of Contents

Previous topic

Baruwa on Fedora

Next topic

External authentication

This Page

On the web


Your generous donations help fund future development.

This document is for Baruwa's development version, may be significantly different from released versions and is a work in progress. View the current released docs here: 1.0.2.

Baruwa on Ubuntu/Debian

There is two ways to install Baruwa on Ubuntu, you can download and install the deb package or you can use the Baruwa Ubuntu PPA. Both methods are described below.

Debian users can only use the download method at the moment.

Install & Configure RabbitMQ

Install RabbitMQ:

# apt-get install rabbitmq-server

Configure RabbitMQ

Create a user and virtual host for baruwa:

# rabbitmqctl add_user baruwa your_password
# rabbitmqctl add_vhost baruwa
# rabbitmqctl set_permissions -p baruwa baruwa ".*" ".*" ".*"

Delete the guest user:

# rabbitmqctl delete_user guest

See the RabbitMQ Admin Guide for more information.


Please ensure that you control access to your RabbitMQ install as to prevent an unauthorized clients from accessing your broker.

Baruwa deb install

Download the deb from

Install Baruwa:

# apt-get install gdebi-core
# gdebi baruwa_<version>_all.deb

Baruwa Ubuntu PPA install

The Baruwa Ubuntu PPA is located at

To install from this PPA you need to enable it:

# sudo add-apt-repository ppa:topdog/baruwa

You can now install Baruwa from the PPA:

# sudo apt-get update
# sudo apt-get install baruwa

Automated configuration

The installation process will also configure apache, mysql and baruwa should you choose let the install configure the system for you.

The install asks you for the following info

  • apache virtualhost name (The name used to configure the baruwa apache virtualhost)
  • database host (The hostname or ip of the host running your mysql database)
  • database admin user (A user account with admin access on the database server)
  • database admin password (The password fo the above user)
  • database user (The user baruwa will use to connect to the database)
  • database password (The password for the above)
  • database name (The name of the baruwa database)
  • rabbitmq host (The rabbitMQ hostname or IP address)
  • rabbitmq vhost (The RabbitMQ vhost)
  • rabbitmq user (The RabbitMQ user)
  • rabbitmq password (The RabbitMQ password)
  • baruwa admin user (The baruwa admin user)
  • baruwa admin password (The baruwa admin user password)
  • baruwa admin email (The baruwa admin user email address)

Configure MailScanner

It is assumed that you have a working MailScanner system already configured, if you are installing from scratch please refer to their documentation on how to configure MailScanner.


Starting with Baruwa version 1.1.0 you no longer have to edit and set the DB authentication details in each and every Custom module, you just set them up once in the MailScanner configuration file, A Baruwa MailScanner configuration file is installed as /etc/MailScanner/conf.d/baruwa.conf

Edit the provided Baruwa MailScanner config file /etc/MailScanner/conf.d/baruwa.conf, you need to make sure the following options are correct:

Quarantine User = exim #(Or what ever your "Run As User" is set to)
DB DSN = DBI:mysql:database=baruwa;host=spam01;port=3306 #set to valid DSN
DB Username = baruwa # your DB username
DB Password = password # your DB password

To actually quarantine and later process messages with in Baruwa, set ‘store’ as one of your keywords for the “Spam Actions” and “High Scoring Spam Actions” MailScanner options.

The provided MailScanner configuration provides for SQL logging, Whitelists and Blacklists and Per user settings.

Apply configuration changes

Test your configuration for any errors:

# MailScanner --lint

Restart MailScanner:

# /etc/init.d/MailScanner restart

Configure Baruwa

Edit the file and make configuration changes to suit your site.:

# baruwa_path=$(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
# vi $baruwa_path/baruwa/


Make sure you change the SECRET_KEY, DO NOT USE THE DEFAULT, If you have a cluster the key should be the same on all the machines in the cluster.


Verify that is working

Check your log files you should see

Baruwa SQL logger:

Aug  9 18:58:27 localhost MailScanner[8470]: Logging message 1OiVg7-0003zS-9s to Baruwa SQL
Aug  9 18:58:27 localhost MailScanner[11052]: 1OiVg7-0003zS-9s: Logged to Baruwa SQL

Baruwa Lists:

Aug 9 18:32:42 localhost MailScanner[27260]: Starting Baruwa whitelists
Aug 9 18:32:42 localhost MailScanner[27260]: Read 6 whitelist items
Aug 9 18:32:42 localhost MailScanner[27260]: Ip blocks whitelisted

Baruwa User settings:

Aug 9 15:00:03 localhost MailScanner[25708]: Baruwa - Populating spam score settings
Aug 9 15:00:03 localhost MailScanner[25708]: Read 1 spam score settings
Aug 9 14:59:53 localhost MailScanner[25668]: Baruwa - Populating high spam score settings
Aug 9 14:59:53 localhost MailScanner[25668]: Read 1 high spam score settings

Point your browser to http://hostname_used login with admin user and password and start working. You can now use the interface to add users, domains and process messages, etc etc.