Installation


Upgrades


DTC-Xen Installation


DTC-Xen / Dom0 Howtos

DTC-Xen / DomU Howtos

FAQ


DTC Howtos


Manuals


Features


Roadmap


Devel docs


Wiki - i18n


Wiki - Meta


SpamassassinAWL

To setup Spamassassin's AWL (which is no longer enabled by default):

  • edit /etc/mail/spamassassin/v310.pre (or local.pre) and uncomment the line to load the plugin:
   # AWL - do auto-whitelist checks
   #
   loadplugin Mail::SpamAssassin::Plugin::AWL
  • edit /etc/mail/spamassassin/local.cf and add some settings:
   # Auto-Whitelist configuration
   auto_whitelist_factory              Mail::SpamAssassin::SQLBasedAddrList
   user_awl_dsn                        DBI:mysql:dbname=spamassassin;host=localhost
   user_awl_sql_username               spamassassin
   user_awl_sql_password               whatever
   auto_whitelist_distinguish_signed   1
  • create that same mysql database and user, and awl table (in mysql as root):
        CREATE DATABASE spamassassin;
        GRANT all on spamassassin.* to spamassassin@localhost identified by 'whatever';
        FLUSH PRIVILEGES;

        Use spamassassin;

        CREATE TABLE awl (
          username varchar(100) NOT NULL default '',
          email varchar(255) NOT NULL default '',
          ip varchar(40) NOT NULL default '',
          count int(11) NOT NULL default '0',
          totscore float NOT NULL default '0',
          signedby varchar(255) NOT NULL default '',
          lastupdate timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
          PRIMARY KEY (username,email,signedby,ip)
        ) TYPE=MyISAM;

        ALTER TABLE awl ADD INDEX lastupdate(lastupdate);
  • change file ownership/permissions so only the spam scanners can read the new sql credentials
   chgrp amavis /etc/spamassassin/local.cf
   chmod 640 /etc/spamassassin/local.cf
  • restart services to read the new config:
   /etc/init.d/spamassassin restart
   /etc/init.d/amavis restart
  • setup a cronjob to clean up old awl entries, create /etc/cron.daily/expire-awl.php (mode 755) with:
   #!/usr/bin/env php
   <?php

   // DTC install dir
   chdir("/usr/share/dtc/admin/");

   // DTC main configuration file
   require("../shared/autoSQLconfig.php");

   $query = "Use spamassassin";
   $result = mysql_query($query)or die("Cannot query \"$query\" !!!".mysql_error());
   $query = "DELETE FROM awl WHERE lastupdate <= (now() - INTERVAL 15 day) and count < 5;";
   $result = mysql_query($query)or die("Cannot query \"$query\" !!!".mysql_error());
   $query = "DELETE FROM awl WHERE lastupdate <= (now() - INTERVAL 30 day) and count < 10;";
   $result = mysql_query($query)or die("Cannot query \"$query\" !!!".mysql_error());
   $query = "DELETE FROM awl WHERE lastupdate <= (now() - INTERVAL 60 day) and count < 20;";
   $result = mysql_query($query)or die("Cannot query \"$query\" !!!".mysql_error());
   $query = "DELETE FROM awl WHERE lastupdate <= (now() - INTERVAL 120 day);";
   $result = mysql_query($query)or die("Cannot query \"$query\" !!!".mysql_error());

   exit();

   ?>


Editing this page means accepting its license.

Page last modified on May 08, 2013, at 09:07 PM EST