MailWatch 可以統計 MailScanner 的運作狀況, 並將之存到 MySQL 協助管理的工具
su - root cd /var/www/html wget http://sourceforge.net/projects/mailwatch/files/mailwatch/1.0.5/mailwatch-1.0.5.tar.gz/download tar -zxvf mailwatch-1.0.5.tar.gz mv mailwatch-1.0.5 mailwatch cd mailwatch
vi /etc/php.ini
: magic_quotes_gpc = On :
mv mailscanner /var/www/html cd /var/www/html/mailscanner chown root:apache images chmod ug+rwx images chown root:apache images/cache chmod ug+rwx images/cache
cp conf.php.example conf.php vi conf.php
: define('DB_TYPE', 'mysql'); define('DB_USER', 'mailwatch'); define('DB_PASS', 'xxxx'); define('DB_HOST', '192.168.11.xx'); define('DB_NAME', 'mailscanner'); define('DB_DSN', DB_TYPE.'://'.DB_USER.":".DB_PASS."@".DB_HOST."/".DB_NAME); :
vi MailWatch.pm
: # Modify this as necessary for your configuration my($db_name) = 'mailscanner'; my($db_host) = '192.168.11.xx'; my($db_user) = 'mailwatch'; my($db_pass) = 'xxxx'; :
cp MailWatch.pm /usr/lib/MailScanner/MailScanner/CustomFunctions/
service MailScanner stop vi /etc/MailScanner/MailScanner.conf
: # If you want to use it, read CustomConfig.pm. Always Looked Up Last = &MailWatchLogging : # Do you want the full spam report, or just a simple "spam / not spam" report? Detailed Spam Report = yes : # This can also be the filename of a ruleset. Quarantine Whole Message = Yes : # as human-readable files (header then body in 1 file)? Quarantine Whole Messages As Queue Files = no : # report, or just list the names of the scores Include Scores In SpamAssassin Report = yes : # and "Quarantine Group". Quarantine User = root Quarantine Group = apache # If you want processes running under the same *group* as MailScanner to # be able to read the quarantined files (and list what is in the # directories, of course), set to 0640. If you want *all* other users to # be able to read them, set to 0644. For a detailed description, if # you're not already familiar with it, refer to `man 2 chmod`. # Typical use: let the webserver have access to the files so users can # download them if they really want to. # Use with care, you may well open security holes. Quarantine Permissions = 0660 : Spam Actions = store deliver header "X-Spam-Status: Yes" : High Scoring Spam Actions = store :
vi SQLBlackWhiteList.pm
: sub CreateList { my($type, $BlackWhite) = @_; my($dbh, $sth, $sql, $to_address, $from_address, $count); my($db_name) = 'mailscanner'; my($db_host) = '192.168.11.xx'; my($db_user) = 'mailwatch'; my($db_pass) = 'xxxx'; :
cp SQLBlackWhiteList.pm /usr/lib/MailScanner/MailScanner/CustomFunctions/ vi /etc/MailScanner/MailScanner.conf
: Is Definitely Not Spam = &SQLWhitelist : Is Definitely Spam = &SQLBlacklist :
vi /etc/MailScanner/spam.assassin.prefs.conf
: # Thanks to Matt Kettler for pointing this out. bayes_path /etc/MailScanner/bayes/bayes # This is actually used as a mask, not a raw chmod setting. # Thanks for Matt Kettler for spotting this one. # Commented out: this if for MailWatch and Exim/Postfix users only. bayes_file_mode 0660 :
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_*
service MailScanner start && tail -f /var/log/maillog
: dbquery("LOAD DATA LOCAL INFILE '".$base.'/'.$file2."' INTO TABLE geoip_country FIELDS TERMINATED BY ',' ENCLOSED BY '\"'"); :
這樣才可順利匯入, 否則會出現類似以下的錯誤訊息
Downloading file, please wait.... Error executing query: Access denied for user 'mailwatch'@'192.168.11.xx' (using password: YES)