SpamAssassin mit MySQL Backend

Aus Wiki.hidden.ch
Wechseln zu: Navigation, Suche

Installation von Spamassassin

Solle SpamAssassin noch nicht installiert sein (wird meist mit Amavisd-New mit-installiert), so kann man dies mittels Ports machen.

-su-2.05b# cd /usr/ports/mail/p5-Mail-SpamAssassin

Dann wird man im Menu gefragt (kann später auch mit make config wieder aufgerufen werden), welche Optionen man möchte. Am besten wählt man aus, wie unten (über das Thema SPF reden wir hier mal nicht).

lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x              Options for p5-Mail-SpamAssassin 3.0.4                x
x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
x x     [X] AS_ROOT    Run spamd as root (recommended)             x x
x x     [X] SSL        Build with SSL support for spamd/spamc      x x
x x     [X] MYSQL      Add MySQL support                           x x
x x     [ ] PGSQL      Add PostreSQL support                       x x
x x     [X] RAZOR      Add Vipul's Razor support                   x x
x x     [ ] SPF_QUERY  Add SPF query support                       x x
x x     [X] TOOLS      Install SpamAssassin tools                  x x
x x                                                                x x
tqmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjqu
x                       [  OK  ]       Cancel                        x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

... TDF ...

Konfiguration des MySQL Backends

Wie man den MySQL-Server Installiert, wurde in diesem Wiki schon beschrieben.

SQL: Whitelist / Blacklist

CREATE TABLE awl (
 username varchar(100) NOT NULL default ,
 email varchar(200) NOT NULL default ,
 ip varchar(10) NOT NULL default ,
 count int(11) default '0',
 totscore float default '0',
 PRIMARY KEY  (username,email,ip)
) TYPE=MyISAM;

SQL: Bayes Filter

CREATE TABLE bayes_expire (
 id int(11) NOT NULL default '0',
 runtime int(11) NOT NULL default '0',
 KEY bayes_expire_idx1 (id)
) TYPE=MyISAM;
CREATE TABLE bayes_global_vars (
 variable varchar(30) NOT NULL default ,
 value varchar(200) NOT NULL default ,
 PRIMARY KEY  (variable)
) TYPE=MyISAM;
INSERT INTO bayes_global_vars VALUES ('VERSION','3');
CREATE TABLE bayes_seen (
 id int(11) NOT NULL default '0',
 msgid varchar(200) binary NOT NULL default ,
 flag char(1) NOT NULL default ,
 PRIMARY KEY  (id,msgid)
) TYPE=MyISAM;
CREATE TABLE bayes_token (
 id int(11) NOT NULL default '0',
 token char(5) NOT NULL default ,
 spam_count int(11) NOT NULL default '0',
 ham_count int(11) NOT NULL default '0',
 atime int(11) NOT NULL default '0',
 PRIMARY KEY  (id, token),
 INDEX bayes_token_idx1 (token),
 INDEX bayes_token_idx2 (id, atime)
) TYPE=MyISAM;
CREATE TABLE bayes_vars (
 id int(11) NOT NULL AUTO_INCREMENT,
 username varchar(200) NOT NULL default ,
 spam_count int(11) NOT NULL default '0',
 ham_count int(11) NOT NULL default '0',
 token_count int(11) NOT NULL default '0',
 last_expire int(11) NOT NULL default '0',
 last_atime_delta int(11) NOT NULL default '0',
 last_expire_reduce int(11) NOT NULL default '0',
 oldest_token_age int(11) NOT NULL default '2147483647',
 newest_token_age int(11) NOT NULL default '0',
 PRIMARY KEY  (id),
 UNIQUE bayes_vars_idx1 (username)
) TYPE=MyISAM;

SQL: Global? Per-User? Per Domain?

CREATE TABLE userpref (
 username varchar(100) NOT NULL default ,
 preference varchar(50) NOT NULL default ,
 value varchar(100) NOT NULL default ,
 prefid int(11) NOT NULL auto_increment,
 PRIMARY KEY  (prefid),
 KEY username (username)
) TYPE=MyISAM;


Weblinks