Chinaunix首页 | 论坛 | 博客
  • 博客访问: 242644
  • 博文数量: 49
  • 博客积分: 1035
  • 博客等级: 少尉
  • 技术积分: 477
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-14 17:23
文章分类

全部博文(49)

文章存档

2015年(15)

2014年(6)

2011年(1)

2008年(3)

2007年(11)

2006年(13)

我的朋友

分类: 系统运维

2015-03-31 07:04:38

除了modoboa外还有其它的web装垃圾邮件管理平台。因Modoboa配置基于Django开发,所以选择了此项目,而且一直有新版本发行。具体可参考

1   amavisd-new配置

@lookup_sql_dsn =

   ( ['DBI:mysql:database=mail;host=127.0.0.1;port=3306', 'root', ''],);

 @storage_sql_dsn = @lookup_sql_dsn;  # none, same, or separate database

 

$virus_quarantine_method = 'sql:';

$spam_quarantine_method = 'sql:';

$banned_files_quarantine_method = 'sql:';

$bad_header_quarantine_method = 'sql:';

 

$virus_quarantine_to = 'virus-quarantine';

$banned_quarantine_to = 'banned-quarantine';

$bad_header_quarantine_to = 'bad-header-quarantine';

$spam_quarantine_to = 'spam-quarantine';

$timestamp_fmt_mysql = 1; # if using MySQL *and* msgs.time_iso is TIMESTAMP;

a)         mysql配置

CREATE DATABASE amavis;

CREATE DATABASE modoboa;

CREATE DATABASE spamassassin;

CREATE USER 'modoboa'@'mail.example.tld' identified by 'modoboa_pwd';

CREATE USER 'amavis'@'mail.example.tld' identified by 'amavis_pwd';

CREATE USER 'dovecot'@'mail.example.tld' identified by 'dovecot_pwd';

CREATE USER 'postfix'@'mail.example.tld' identified by 'postfix_pwd';

CREATE USER 'spamassassin'@'mail.example.tld' identified by 'spamassassin_pwd';

 

GRANT ALL PRIVILEGES ON modoboa.* to 'modoboa'@'mail.example.tld';

GRANT ALL PRIVILEGES ON amavis.* to 'amavis'@'mail.example.tld';

GRANT SELECT ON modoboa.* to 'postfix'@'mail.example.tld';

GRANT ALL PRIVILEGES ON spamassassin.* to 'spamassassin'@'mail.example.tld';

FLUSH PRIVILEGES;

USE amavis;

CREATE TABLE users (

  id         int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,

  priority   integer      NOT NULL DEFAULT '7',

  policy_id  integer unsigned NOT NULL DEFAULT '1',

  email      varbinary(255) NOT NULL UNIQUE,

  fullname   varchar(255) DEFAULT NULL

  );

 

CREATE TABLE mailaddr (

  id         int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,

  priority   integer      NOT NULL DEFAULT '7',

  email      varbinary(255) NOT NULL UNIQUE

);

 

CREATE TABLE wblist (

  rid        integer unsigned NOT NULL,

  sid        integer unsigned NOT NULL,

  wb         varchar(10)  NOT NULL,

  PRIMARY KEY (rid,sid)

);

 

CREATE TABLE policy (

  id  int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,

  policy_name      varchar(32),

 

  virus_lover           char(1) default NULL,

  spam_lover            char(1) default NULL,

  unchecked_lover       char(1) default NULL,

  banned_files_lover    char(1) default NULL,

  bad_header_lover      char(1) default NULL,

 

  bypass_virus_checks   char(1) default NULL,

  bypass_spam_checks    char(1) default NULL,

  bypass_banned_checks  char(1) default NULL,

  bypass_header_checks  char(1) default NULL,

 

  spam_modifies_subj    char(1) default NULL,

 

  virus_quarantine_to      varchar(64) default NULL,

  spam_quarantine_to       varchar(64) default NULL,

  banned_quarantine_to     varchar(64) default NULL,

  unchecked_quarantine_to  varchar(64) default NULL,

  bad_header_quarantine_to varchar(64) default NULL,

  clean_quarantine_to      varchar(64) default NULL,

  archive_quarantine_to    varchar(64) default NULL,

 

  spam_tag_level  float default NULL,

  spam_tag2_level float default NULL,

  spam_tag3_level float default NULL,

  spam_kill_level float default NULL,

  spam_dsn_cutoff_level        float default NULL,

  spam_quarantine_cutoff_level float default NULL,

 

  addr_extension_virus      varchar(64) default NULL,

  addr_extension_spam       varchar(64) default NULL,

  addr_extension_banned     varchar(64) default NULL,

  addr_extension_bad_header varchar(64) default NULL,

 

  warnvirusrecip      char(1)     default NULL,

  warnbannedrecip     char(1)     default NULL,

  warnbadhrecip       char(1)     default NULL,

  newvirus_admin      varchar(64) default NULL,

  virus_admin         varchar(64) default NULL,

  banned_admin        varchar(64) default NULL,

  bad_header_admin    varchar(64) default NULL,

  spam_admin          varchar(64) default NULL,

  spam_subject_tag    varchar(64) default NULL,

  spam_subject_tag2   varchar(64) default NULL,

  spam_subject_tag3   varchar(64) default NULL,

  message_size_limit  integer     default NULL,

  banned_rulenames    varchar(64) default NULL,

  disclaimer_options  varchar(64) default NULL,

  forward_method      varchar(64) default NULL,

  sa_userconf         varchar(64) default NULL,

  sa_username         varchar(64) default NULL

);

 

CREATE TABLE maddr (

  partition_tag integer      DEFAULT 0,

  id         bigint unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,

  email      varbinary(255)  NOT NULL,

  domain     varchar(255)    NOT NULL,

  CONSTRAINT part_email UNIQUE (partition_tag,email)

) ENGINE=InnoDB;

 

CREATE TABLE msgs (

  partition_tag integer     DEFAULT 0,

  mail_id     varbinary(16) NOT NULL,

  secret_id   varbinary(16) DEFAULT '',

  am_id       varchar(20)   NOT NULL,

  time_num    integer unsigned NOT NULL,

  time_iso    char(16)      NOT NULL,

  sid         bigint unsigned NOT NULL,

  policy      varchar(255)  DEFAULT '',

  client_addr varchar(255)  DEFAULT '',

  size        integer unsigned NOT NULL,

  originating char(1) DEFAULT ' ' NOT NULL,

  content     char(1),

  quar_type  char(1),

  quar_loc   varbinary(255) DEFAULT '',

  dsn_sent   char(1),

  spam_level float,

  message_id varchar(255)  DEFAULT '',

  from_addr  varchar(255)  CHARACTER SET utf8 COLLATE utf8_bin  DEFAULT '',

  subject    varchar(255)  CHARACTER SET utf8 COLLATE utf8_bin  DEFAULT '',

  host       varchar(255)  NOT NULL,

  PRIMARY KEY (partition_tag,mail_id)

) ENGINE=InnoDB;

 

CREATE INDEX msgs_idx_sid      ON msgs (sid);

CREATE INDEX msgs_idx_mess_id  ON msgs (message_id);

CREATE INDEX msgs_idx_time_num ON msgs (time_num);

 

CREATE TABLE msgrcpt (

  partition_tag integer    DEFAULT 0,

  mail_id    varbinary(16) NOT NULL,

  rseqnum    integer  DEFAULT 0   NOT NULL,

  rid        bigint unsigned NOT NULL,

  is_local   char(1)  DEFAULT ' ' NOT NULL,

  content    char(1)  DEFAULT ' ' NOT NULL,

  ds         char(1)  NOT NULL,

  rs         char(1)  NOT NULL,

  bl         char(1)  DEFAULT ' ',

  wl         char(1)  DEFAULT ' ',

  bspam_level float,

  smtp_resp  varchar(255)  DEFAULT '',

  PRIMARY KEY (partition_tag,mail_id,rseqnum)

) ENGINE=InnoDB;

 

CREATE INDEX msgrcpt_idx_mail_id  ON msgrcpt (mail_id);

CREATE INDEX msgrcpt_idx_rid      ON msgrcpt (rid);

 

CREATE TABLE quarantine (

  partition_tag integer    DEFAULT 0,

  mail_id    varbinary(16) NOT NULL,

  chunk_ind  integer unsigned NOT NULL,

  mail_text  blob          NOT NULL,

  PRIMARY KEY (partition_tag,mail_id,chunk_ind)

) ENGINE=InnoDB;

Create the database tables for spamassassin

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 '',

          PRIMARY KEY (username,email,signedby,ip)

) Engine=MyISAM;

 

CREATE TABLE bayes_expire (

          id int(11) NOT NULL default '0',

          runtime int(11) NOT NULL default '0',

          KEY bayes_expire_idx1 (id)

) Engine=MyISAM;

 

CREATE TABLE bayes_global_vars (

          variable varchar(30) NOT NULL default '',

          value varchar(200) NOT NULL default '',

          PRIMARY KEY  (variable)

) Engine=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)

) Engine=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)

) Engine=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 (id, atime)

) Engine=MyISAM;

2.    modoboa配置

要求:

  • Python version 2.6+
  • Django version 1.5+
  • south version 0.7+
  • lxml python module
  • pycrypto python module
  • rrdtool python binding
  • sievelib python module
  • chardet python module
  • argparse python module
  • reversion python module
  • mysql-python

生成项目: modoboa-admin.py deploy --syncdb --collectstatic --with-amavis mailadmin

运行:

python manage.py runserver 1.1.1.1:8000

 

阅读(4773) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~