.. _mailscanner:

=================
Setup MailScanner
=================

Configuration
=============

**Edit and install BaruwaSQL.pm**

Edit extras/BaruwaSQL.pm and set the variables::

	my ($db_name)   = 'baruwa';
	my ($db_host)   = 'localhost';
	my ($db_user)   = 'baruwa';
	my ($db_pass)   = '';
	my ($sqlite_db) = "/var/spool/MailScanner/incoming/baruwa.db";

Copy it to the MailScanner custom functions directory::

	# confdir=$(/usr/sbin/Quick.Peek 'Custom Functions Dir' /etc/MailScanner/MailScanner.conf)
	# cp extras/BaruwaSQL.pm $confdir/

Stop MailScanner::

    # /etc/init.d/MailScanner stop

Next edit the MailScanner config file /etc/MailScanner/MailScanner.conf,
you need to make sure that the following options are set::

    Quarantine User = exim (Or what ever your "Run As User" is set to)
    Quarantine Group = apache (or your webserver user if not apache)
    Quarantine Permissions = 0660
    Quarantine Whole Message = yes
    Quarantine Whole Message As Queue Files = no
    Detailed Spam Report = yes
    Include Scores In SpamAssassin Report = yes
    Always Looked Up Last = &BaruwaSQL

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

**Integrate SQL Blacklist/Whitelist**

Edit extras/BaruwaLists.pm and set the variables::

	my ($db_name) = 'baruwa';
	my ($db_host) = 'localhost';
	my ($db_user) = 'baruwa';
	my ($db_pass) = '';

Copy it to the MailScanner custom functions directory (No required if installing from deb or rpm)::

	# confdir=$(/usr/sbin/Quick.Peek 'Custom Functions Dir' /etc/MailScanner/MailScanner.conf)
	# cp extras/BaruwaLists.pm $confdir/

Next edit the MailScanner config file /etc/MailScanner/MailScanner.conf, and
set the following options::

    Is Definitely Not Spam = &BaruwaWhitelist
    Is Definitely Spam = &BaruwaBlacklist

Start up MailScanner::

    # /etc/init.d/MailScanner start

**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 192.168.1.0/24 192.168.2.0/24 xxx.xx.xxx.0/26
