MailWatch

Version: 1.1.5.1

  • PHP
  • MySQL
  • JpGraph

安裝

apt-get install apache2 php5 php5-gd mysql-server php5-mysql sudo

 

==========
DB setup:
==========

mysql -p < create.sql

# DB: mailscanner
# Tables:
geoip_country
inq
mcp_rules
outq
sa_rules
saved_filters
spamscores
blacklist, whitelist
user_filters, users
maillog, mtalog, audit_log

# mysql -p
    
    mysql> GRANT ALL ON mailscanner.* TO mailwatch@localhost IDENTIFIED BY '<password>';

# web user
    mysql> USE mailscanner
    mysql> INSERT INTO users VALUES ('mailscanner',md5('<password>'),'mailscanner','A','0','0','0','0','0');

# Install & Configure MailWatch

# 在 mailwatch-1.1.5.1/MailScanner_perl_scripts 內
# 在 MailWatch.pm 設定 $db_user, $db_pass
# mv MailWatch.pm  /opt/MailScanner/lib/MailScanner/CustomFunctions

# mv mailscanner/ /var/www/
# cd /var/www/mailscanner

# chown root:www-data images
# chmod ug+rwx images
# chown root:www-data images/cache
# chmod ug+rwx images/cache
# chown www-data temp
# chmod g+w temp
    

# cp  conf.php.example   conf.php

    define(DB_USER, 'mailwatch');
    define(DB_PASS, '<password>');

    define('TIME_ZONE', 'Asia/Hong_Kong');
    
    define('MAILWATCH_HOME', '/var/www/mailscanner/');
    define('MS_CONFIG_DIR', '/opt/MailScanner/etc/');
    define('MS_LIB_DIR', '/opt/MailScanner/lib/MailScanner/');
    
    
    # requires that you use the quarantine_manager.php in place of the clean.quarantine script provided with MailScanner.
    define(QUARANTINE_USE_FLAG, true);
    define('QUARANTINE_DAYS_TO_KEEP', 30);

    

======================
= Set-up MailScanner =
======================

/opt/MailScanner/etc/MailScanner.conf

    Quarantine User = root
    Quarantine Group = www-data
    Quarantine Permissions = 0660                     # default: 0600
    Quarantine Whole Message = yes                    # default: no
    Quarantine Whole Message As Queue Files = no
    Detailed Spam Report = yes
    Include Scores In SpamAssassin Report = yes
    Always Looked Up Last = &MailWatchLogging
    # default: Spam Actions = deliver header "X-Spam-Status: Yes"
    Spam Actions = store
    High Scorig Spam Actions = store

    QUARANTINEDIR="/var/spool/MailScanner/quarantine"
    
    
# fix permissions
    dos2unix fix_quarantine_permissions
    ./fix_quarantine_permissions
    
    
Integrate SQL Blacklist/Whitelist
=================================
    
cp SQLBlackWhiteList.pm to /usr/share/MailScanner/CustomFunctions/

my($db_user) = '<username>';
my($db_pass) = '<password>';

# MailScanner.conf

Not Spam = &SQLWhitelist
Spam = &SQLBlacklist

==========
Cron_jobs
==========

    # To disable the clean.quarantine script edit /pathtomailmailscanner/bin/cron/clean.quarantine.cron
    
    $disabled = 1;
    
    echo "/pathtomailwatch/tools/quarantine_maint.php --clean" > /etc/cron.daily/mailwatch_quarantine_maint.sh
    chmod +x /etc/cron.daily/mailwatch_quarantine_maint.sh

tools/db_clean.php
    #!/usr/bin/php -q

geoip_update.php
    
    dbquery("LOAD DATA LOCAL INFILE
    
    
quarantine_report.php
    

=======
users
=======

'users' table column named 'type'

    'A' - Administrator (can view everything, any filters are ignored)
    'D' - Domain Admin (can view domains)
    'U' - User (can view specific addresses)
    'R' - Regexp (can view items matching regexp)

table: 'user_filters'

    username   - this should match the user from the 'users' table.
    filter     - this is the text of the filter e.g. '[email protected]' or 'domain.com'.
    verify_key - this is for future use, it should be set to md5(rand()).
    active     - this can be set to 'Y' or 'N', if 'N' the rule is ignored.

 

Creative Commons license icon Creative Commons license icon