MailWatch For MailScanner - Installation
MailWatch For MailScanner - Installation
MailWatch For MailScanner - Installation
html
(/)
Features (//mailwatch.org/index.html#features
( //mailwatch.org/index.html#features)
//mailwatch.org/index.html#features ) Docs (/
(/) News (//mailwatch.org/news
( //mailwatch.org/news)
//mailwatch.org/news )
Documentation
Getting started (/doc/getting-started.html)
Installation (/doc/installing.html)
Using MailWatch
FAQ (/using/faq.html)
Per Domain/Per User Filtering (/using/per-domainper-user-ltering.html)
Developers
Contributing (/dev/contributing.html)
Changelog (/dev/changelog.html)
License (/dev/license.html)
Installation instructions
MailWatch for MailScanner is developed on Debian 7 & Ubuntu 12.04, so these docs will reect this and I
will make note on anything that will be required to run on other distro's or operating systems.
Some PHP extensions and executable software are required to make MailWatch fully works:
Support
Please use the mailing-list mailwatch-users (http://lists.sourceforge.net/lists/listinfo/mailwatch-users) on
Sourceforge. Note that you will get faster support if you use the mailing-list.
safe_mode = Off
register_globals = Off
magic_quotes_gpc = Off
magic_quotes_runtime = Off
session.auto_start = 0
Installation
All commands below should be run as the 'root'.
NOTE: you will need to modify the above as necessary for your system if you have a root password for your
MySQL database (recommended!).
Create a MySQL user and password & Set-up MailScanner for SQL
logging
$ mysql
Edit MailWatch.pm and change the $db_user and $db_pass values accordingly and move
MailWatch.pm to /usr/lib/MailScanner/MailScanner/CustomFunctions (this could be
/opt/MailScanner/lib/MailScanner/MailScanner/CustomFunctions on non-RPM systems).
mv mailscanner /var/www/html/
Create conf.php by copying conf.php.example and edit the values to suit, you will need to set
DB_USER and DB_PASS to the MySQL user and password that you created earlier.
Note that MailWatch 1.0 and later can use the quarantine more effectively when used with
MailScanner version 4.43 or later as Julian added some code for me to keep track of messages
quarantined by using a ag in the maillog table.
This means that MailWatch 1.0 is much faster when you have a large quarantine directory. The new
quarantine report requires the use of the new functionality - so you must upgrade if you want to run
this. The new quarantine ag is used by default and you must disable the clean.quarantine script
supplied by MailScanner and use the new quarantine_maint.php script in the tools directory instead.
cp conf.php.example conf.php
Set-up MailScanner
Stop MailScanner
Next edit /etc/MailScanner/MailScanner.conf - you need to make sure that the following options are
set:
Spam Actions and High Scoring Spam Actions should also have 'store' as one of the keywords if you want
to quarantine items for learning/viewing in MailWatch.
then edit the le and change the connection string in the CreateList subroutine to match MailWatch.pm.
Then edit SQLBlackWhitelist.pm and change the connection string in the CreateList subroutine to
match MailWatch.pm .
Move the Bayesian Databases and set-up permissions (skip this if you don't use bayes).
bayes_path /etc/MailScanner/bayes/bayes
bayes_file_mode 0660
Create the 'new' bayes directory, make the directory owned by the same group as the web server user and
make the directory setgid:
mkdir /etc/MailScanner/bayes
chown root:apache /etc/MailScanner/bayes
chmod g+rws /etc/MailScanner/bayes
cp /root/.spamassassin/bayes_* /etc/MailScanner/bayes
chown root:apache /etc/MailScanner/bayes/bayes_*
chmod g+rw /etc/MailScanner/bayes/bayes_*
Test SpamAssassin to make sure that it is using the new databases correctly:
Jun 13 12:18:23 hoshi MailScanner[26388]: MailScanner E-Mail Virus Scanner version 4.20-3 start
ing...
Jun 13 12:18:24 hoshi MailScanner[26388]: Config: calling custom init function MailWatchLogging
Jun 13 12:18:24 hoshi MailScanner[26388]: Initialising database connection
Jun 13 12:18:24 hoshi MailScanner[26388]: Finished initialising database connection
If you want to see the output of MailScanner --lint in Tools/MailScanner Lint (Test) edit conf.php and
set MS_EXECUTABLE_PATH, the follow instruction in tools/sudo/INSTALL
You will need to edit the db_clean.php to reect the location of the functions.php le
Quarantine Maintenance
Remove the clean.quarantine cronjob congured with MailScanner.
You will need to edit the quarantine_maint.php to reect the location of the functions.php le
Quarantine Reporting
You will need to edit the quarantine_report.php to reect the location of the functions.php le
Update the SpamAssassin Rules table MailWatch keeps a list of all the SpamAssassin rules and
descriptions which are displayed on the 'Message Detail' page - to show the descriptions, you need
to run the updater every time you add new rules or upgrade SpamAssassin. Click on the 'Other' menu
and select 'Update SpamAssassin Rule Descriptions' and click 'Run Now'.
Update the GeoIP database Click on the 'Other' menu and select 'Update GeoIP database' and click
'Run Now'.
Setup the Mail Queue watcher (optional) You can get MailWatch to watch and display your sendmail
queue directories - all you need to do is copy mailq.php (from the root of the MailWatch archive -
not from the mailscanner directory - they are different!) to /usr/local/bin and set-up a cron-job to
run it.
cp tools/Sendmail_queue/mailq.php /usr/local/bin
crontab -e
0-59 * * * * /usr/local/bin/mailq.php
Note: mailq.php re-creates all entries on each run, so for busy sites you will probably want to change this
to run every 5 minutes or greater.
cp tools/Sendmail_relay/sendmail_relay.php /usr/local/bin
cp tools/Sendmail_relay/sendmail_relay.init /etc/rc.d/init.d/
chmod 777 /etc/rc.d/init.d/sendmail_relay.init
/etc/rc.d/init.d/sendmail_relay.init start
ln -s /etc/rc.d/ini.d/sendmail_relay.init /etc/rc.2/S30sendmail_relay.init
<?php
// Enable MailScanner Rule Editor
define('MSRE', true);
define('MSRE_RELOAD_INTERVAL', 5);
define('MSRE_RULESET_DIR', "/etc/MailScanner/rules");
Change le permissions so that we can update the rules change group and rules directory locations as
appropriate
FINISHED!! (Phew!)
Please open an issue on GitHub (https://github.com/mailwatch/1.2.0/issues) or report to the mailing-list if
you nd any errors or omissions.
Thanks!