视频1 视频21 视频41 视频61 视频文章1 视频文章21 视频文章41 视频文章61 推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37 推荐39 推荐41 推荐43 推荐45 推荐47 推荐49 关键词1 关键词101 关键词201 关键词301 关键词401 关键词501 关键词601 关键词701 关键词801 关键词901 关键词1001 关键词1101 关键词1201 关键词1301 关键词1401 关键词1501 关键词1601 关键词1701 关键词1801 关键词1901 视频扩展1 视频扩展6 视频扩展11 视频扩展16 文章1 文章201 文章401 文章601 文章801 文章1001 资讯1 资讯501 资讯1001 资讯1501 标签1 标签501 标签1001 关键词1 关键词501 关键词1001 关键词1501 专题2001
EMOS1.5配置文件+反垃圾处理
2025-09-24 06:39:17 责编:小OO
文档
EMOS1.5邮件系统配置+反垃圾处理

author:yaoyuan

声明:本文参考资料来自extmail官方文档,详细可登陆extmail官网查询

http://wiki.extmail.org/extmail_solution_for_linux_centos-5

1.操作系统安装

CentOS-5系统安装在此不做过多说明,需注意一点:

预装mysql数据库时必须选中php-mysql模块,否则extmail将无法连接mysql

以root身份登进系统后,增加一个非root帐户,名称为sysadmin,密码按您的需求设置一个即可。接下来我们要禁止root直接登陆。

# vi /etc/ssh/sshd_config

修改以下配置为:

PermitRootLogin no

然后重新启动sshd,这样禁止了root直接登陆。

# servicesshd restart

2.制作yum库

# su– root

# mkdir /root/rpm

# cd /root/rpm

(1)本地yum库

使用EMOS-1.5.ISO制作本地yum库;

此外,我们假设本次安装默认域是xinhua.com,主机名为:mail.xinhua.com

安装CentOS-5.6光盘或者ISO镜像中的createrepo工具

# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm

下载好EMOS-1.5.ISO镜像

# mkdir /mnt/EMOS

# mount /root/EMOS-1.5.0.ISO /mnt/EMOS

# cd /mnt

# createrepo  .

创建客户端yum的定义文件:

# cd /etc/yum.repos.d

# mkdir backup

# mv *.repo ./backup

# vi EMOS.repo

加入以下内容:

[EMOS]

name=EMOS

baseurl=file:///mnt/

enabled=1

gpgcheck=0

重新获取最新仓库信息:

# yum clean all

# yum list

(2)网络yum源

编译CentOS-Base.repo文件

# vi /etc/yum.repo.d/CentOS-Base.repo

加入以下内容:

# EMOS-Base.repo

# Created by ExtMailDev Team: http://www.extmail.org/ 

# $Id$

[EMOS-base]

name=EMOS-Base

baseurl=http://mirror.extmail.org/yum/emos/1.5/os/$basearch/

gpgcheck=0

priority=0

protect=0

[EMOS-update]

name=EMOS-Updates

baseurl=http://mirror.extmail.org/yum/emos/1.5/updates/$basearch/

gpgcheck=0

priority=0

protect=0

保存后,然后尝试执行以下yum list等操作,看看是否成功;

3.配置mta-posyfix

(1)安装postfix

# yum install postfix

# rpm–e sendmail

(2)配置postfix

# postconf–n > /etc/postfix/main2.cf

# mv /etc/postfix/main.cf /etc/postfix/main.cf.old

# mv /etc/postfix/main2.cf /etc/postfix/main.cf

编辑mail.cf:

# vi /etc/postfix/main.cf

增加如下内容:

# hostname

mynetworks = 127.0.0.1

myhostname = mail.xinhua.com

mydestination = $mynetworks $myhostname

# banner

mail_name = Postfix - by extmail.org

smtpd_banner = $myhostname ESMTP $mail_name

# response immediately

smtpd_error_sleep_time = 0s

# Message and return code control

message_size_limit = 10485760

mailbox_size_limit = 10485760

show_user_unknown_table_name = no

# Queue lifetime control

bounce_queue_lifetime = 1d

maximal_queue_lifetime = 1d

注:myhostname改为自己的。

设置postfix开机启动:

# chkconfig postfix on

4.配置courier-authlib

(1)安装Courier-Auyhlib

安装以下软件包:

# yum–y install courier-authlib

# yum–y install courier-authlib-mysql

编辑/etc/authlib/authmysqlrc文件:

# vi /etc/authlib/authmysqlrc

将内容清空,增加以下内容:

MYSQL_SERVER            localhost

MYSQL_USERNAME          extmail

MYSQL_PASSWORD          extmail

MYSQL_SOCKET            /var/lib/mysql/mysql.sock

MYSQL_PORT              3306

MYSQL_OPT               0

MYSQL_DATABASE          extmail

MYSQL_USER_TABLE        mailbox

MYSQL_CRYPT_PWFIELD     password

MYSQL_UID_FIELD         uidnumber

MYSQL_GID_FIELD         gidnumber

MYSQL_LOGIN_FIELD       username

MYSQL_HOME_FIELD        homedir

MYSQL_NAME_FIELD        name

MYSQL_MAILDIR_FIELD     maildir

MYSQL_QUOTA_FIELD       quota

MYSQL_SELECT_CLAUSE   SELECTusername,password,"",uidnumber,gidnumber,\

CONCAT('/home/domains/',homedir),             \

        CONCAT('/home/domains/',maildir),               \

quota,          \

name\

FROM mailbox    \

WHERE username = '$(local_part)@$(domain)'

    修改authdaemonrc文件

    # vi /etc/suthlib/authdaemonrc

    修改如下内容:

    authmodulelist=”authmysql”

    authmodulelistorig=”authmysql”

(2)启动courier-authlib:

# service courier-authlib start

如一切正常,命令行将返回如下信息:

Starting Courier authentication services:  authdaemond

修改authdaemon socket目录权限

如果该目录权限不正确修改,maildrop及postfix等将无法正确获取用户的信息及密码认证:

# chmod 755 /var/spool/authdaemon/

5.配置maildrop

(1)安装maildrop

# yum install maildrop

配置master.cf为了使Postfix支持Maildrop,必须修改/etc/postfix/master.cf文件,注释掉原来的maildrop的配置内容,并改为:

maildrop   unix        -       n        n        -        -        pipe

flags=DRhu user=vuserargv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}

        注意:flags前面有“两个空格”

配置main.cf由于maildrop不支持一次接收多个收件人,因为必须在main.cf里增加如下参数:、

            maildrop_destination_recipient_limit = 1

(2)测试maildrop对authlib支持

# maildrop–v

看是否出现以下内容:

maildrop 2.1.0 Copyright 1998-2005 Double Precision, Inc.

GDBM/DB extensions enabled.

Courier Authentication Library extension enabled.

Maildir quota extension enabled.

This program is distributed under the terms of the GNU General Public

License. See COPYING for additional information.

注意事项:

1、如需重新编译Maildrop软件包,必须先获取其源码rpm包,并且必须先行安装courier-authlib及其devel软件包,否则编译后的maildrop将无法打开authlib支持。

2、Maildrop    rpm包安装时,会自动创建vuser用户及vgroup用户组,专门用于邮件的存储,vuser:vgroup的uid/gid都是1000,这与一般的邮件文档中提及用postfix用户存邮件不一样。因为postfix用户的uid一般都低于500,而Suexec模块编译时对uid/gid的要求是要大于500,因此使用postfix用户不能满足要求。其次,如果用Maildrop作为投递代理(MDA),以postfix身份投递的话,会导致postfix MTA错误。

6.配置apache

(1)虚拟主机设置

编辑httpd.conf文件:

# vi /etc/httpd/conf/httpd.conf

在最后一行加上:

NameVirtualHost *:80

Include conf/vhost_*.conf

编辑vhost_extmail.conf

# vi /etc/httpd/conf/vhost_extmail.conf

里面定义虚拟主机的相关内容:

# VirtualHost for ExtMail Solution

ServerNamemail.xinhua.com

DocumentRoot /var/www/extsuite/extmail/html/

ScriptAlias /extmail/cgi/ /var/www/extsuite/extmail/cgi/

Alias /extmail /var/www/extsuite/extmail/html/

ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/

Alias /extman /var/www/extsuite/extman/html/

# Suexecconfig

SuexecUserGroupvuservgroup

设置apache开机启动

# chkconfighttpd on

# servicehttpd restart

注意:把ServerName修改成自己的。

7.配置webmail-extmail

(1)安装extmail

# yum install extsuite-webmail

(2)编辑webmail.cf

# cd /var/www/extsuite/extmail

# cpwebmail.cf.default webmail.cf

# vi webmail.cf

主要变动的内容如下:

SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = extmail

SYS_MYSQL_DB = extmail

更新cgi目录权限    由于Suexec的需要,必须将extmail的cgi目录修改成vuser:vgroup权限

# chown–R vuser:vgroup /var/www/extsuite/extmail/cgi/

8.配置管理后台-extman

(1)Yum安装ExtMan

# yum install extsuite-webman

更新cgi目录权限    由于Suexec的需要,必须将extman的cgi目录修改成vuser:vgroup权限

# chown–R vuser:vgroup /var/www/extsuite/extman/cgi/

链接基本库到ExtMan

# mkdir /tmp/extman

# chown–R vuser:vgroup /tmp/extman

注意事项:

由于RedHat发行版中包含了一个叫tmpwatch的工具,该工具会定期扫描/tmp/下的文件,如果这些文件很久都没被使用,将被删除,因此如果后台长期不使用,/tmp/extman目录有可能被tmpwatch删除,所以要么定期登陆后台,要么修改 webman.cf将临时目录修改到另一个地方。此处暂以/tmp/extman默认值为例。

(2)数据库初始化

启动mysql

# servicemysql start

# chkconfigmysqld on

导入mysql数据库结构以及初始化数据,root密码默认为空

# mysql–u root –p < /var/www/extsuite/extman/docs/etxmail.sql

# mysql–u root –p < /var/www/extsuite/etxman/docs/init.sql

注意事项:

上述导入初始化SQL时,默认的uidnumber/gidnumber都是1000,这和vuser:vgroup的uid/gid一致,是因为maildrop投递时会从数据库里取uidnumber/gidnumber,而在master.cf里已经定义好了投递时的运行身份(vuser:vgroup),所以这两个字段的内容必须为1000,否则将出现投递错误,例如报0×06等错误。

(3)设置虚拟域和虚拟用户的配置文件

# cd /var/www/extsuite/extman/docs

# cp mysql_virtual_alias_maps.cf    /etc/postfix/

# cp mysql_virtual_domains_maps.cf    /etc/postfix/

# cp mysql_virtual_mailbox_maps.cf    /etc/postfix/

# cp mysql_virtual_sender_maps.cf    /etc/postfix/

配置main.cf:

# vi /etc/postfix/main.cf

增加以下内容:

# extmailconfig here

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf

virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf

virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

virtual_transport = maildrop:

重启postfix:

# service postfix restart

(4)测试authlib

在命令行下执行:

# /usr/sbin/authtest–s login postmaster@extmail.orgextmail

结果如下:

Authentication succeeded.

Authenticated: postmaster@extmail.org (uid 1000, gid 1000)

Home Directory: /home/domains/extmail.org/postmaster

Maildir: /home/domains/extmail.org/postmaster/Maildir/

Quota: 104857600S

Encrypted Password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0

Cleartext Password: extmail

Options: (none)

这样表明ExtMan的正确安装,数据库也正确导入,courier-authlib能正确连接到mysql数据库

最后访问http://mail.xinhua.com/extmail/,如无意外,将看到webmail的登陆页,不过此时还没有加正式的用户,所以不能登陆,包括postmaster@extmail.org也不行。必须要登陆到http://mail.xinhua.com/extman/ 里增加一个新帐户才能登陆。

ExtMan的默认超级管理员帐户:root@extmail.org,初始密码:extmail*123*,登陆成功后,建议将密码修改,以确保安全。

(5)配置图形化日志

启动mailgraph_ext

# /usr/local/mailgraph_ext/mailgraph-init start

启动cmdserver(在后台显示系统信息)

# /var/www/extsuite/extman/daemon/cmdserver–daemon

加入开机自启动:

# echo “/usr/local/mailgraph_ext/mailgraph-init start”>> /etc/rc.d/rc.local

#echo “/var/www/extsuite/extman/daemon/cmdserver-v –d”>> /etc/rc.d/rc.local

使用方法:等待大约15分钟左右,如果邮件系统有一定的流量,即可登陆到extman里,点“图形日志”即可看到图形化的日志。具体每天,周,日,年的则点击相应的图片进入即可。

9.配置cyrus-sasl

(1)安装cyrus-sasl

删除系统的cyrus-sasl:

# rpm–e –nodepscyrus-sasl

安装新的支持authdaemon的软件包

# yum install cyrus-sasl

(2)配置main.cf文件

Postfix的SMTP认证需要透过Cyrus-SASL,连接到authdaemon获取认证信息。

编辑main.cf

# vi /etc/postfix/main.cf

增加如下内容:

# smtpd related config

smtpd_recipient_restrictions =

permit_mynetworks,

permit_sasl_authenticated,

reject_non_fqdn_hostname,

reject_non_fqdn_sender,

reject_non_fqdn_recipient,

reject_unauth_destination,

reject_unauth_pipelining,

reject_invalid_hostname,

# SMTP sender login matching config

smtpd_sender_restrictions =

permit_mynetworks,

reject_sender_login_mismatch,

reject_authenticated_sender_login_mismatch,

reject_unauthenticated_sender_login_mismatch

smtpd_sender_login_maps =

mysql:/etc/postfix/mysql_virtual_sender_maps.cf,

mysql:/etc/postfix/mysql_virtual_alias_maps.cf

# SMTP AUTH config here

broken_sasl_auth_clients = yes

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = $myhostname

smtpd_sasl_security_options = noanonymous

(3)编辑smtpd.conf文件

# vi  /usr/lib/sasl2/smtpd.conf

确保其内容为:

pwcheck_method: authdaemond

log_level: 3

mech_list: PLAIN LOGIN

authdaemond_path:/var/spool/authdaemon/socket

重新启动postfix:

# service postfix start

(4)测试SMTP认证

通过以下命令获得postmaster@extmail.org的用户名及密码的BASE编码:

# perl–e ‘use MIME::Base; print encode_base(“postmaster\\@extmail.org”)’

内容如下:

cG9zdG1hc3RlckBleHRtYWlsLm9yZw==

# perl -e ‘use MIME::Base; print encode_base(“extmail”)’

内容如下:

ZXh0bWFpbA==

然后本机测试:

# telnetlocalhost 25

其过程如下:

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

220 mail.extmail.org ESMTP Postfix - by extmail.org

ehlodemo.domain.tld<<输入内容

250-mail.extmail.org

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-AUTH LOGIN PLAIN

250-AUTH=LOGIN PLAIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

auth login<<输入内容

334 VXNlcm5hbWU6

cG9zdG1hc3RlckBleHRtYWlsLm9yZw== <<输入内容

334 UGFzc3dvcmQ6

ZXh0bWFpbA== <<输入内容

235 2.0.0 Authentication successful

quit <<输入内容

221 2.0.0 Bye

最后出现235 Authentication Successful表明认证成功。

10.配置courier-imap

(1)安装Courier-imap

默认的courier-authlib及courier-imap都增加系统自启动设置,因此下一次服务器将自动启动相应的authlib及POP3服务

# yum install courier-imap

配置courier-imap

由于Courier-imap的IMAP目录是按UTF-7编码的,ExtMail目前还没有正式支持IMAP目录,因此需要屏蔽IMAP,只提供pop3服务。而就目前的使用情况来看,IMAP使用的非常少,绝大部分OutLook/Foxmail用户都习惯使用POP3而非IMAP。

# vi /usr/lib/courier-imap/etc/imapd

修改内容如下:

IMAPDSTART=NO

# vi /usr/lib/courier-imap/etc/imapd-ssl

修改内容如下:

IMAPDSSLSTART=NO

然后重新启动courier-imap:

# service courier-imap start

测试POP3请按如下步骤输入pop3命令测试其是否正常工作,注意红色信息是们输入到POP3服务器的(请首先登陆extman自行建立test@extmail.org用户,密码:extmail)

# telnetlocalhost 110

其过程如下:

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

+OK Hello there.

user test@extmail.org <<输入内容

+OK Password required.

pass extmail<<输入内容

+OK logged in.

list <<输入内容

+OK POP3 clients that break here, they violate STD53.

.

quit <<输入内容

+OK Bye-bye.

Connection closed by foreign host.

至此,ExtMail的安装配置基本完成,可以提供基本的邮件的收发服务,关于反垃圾邮件和病毒的过滤,接下来将进行说明。

在选择反垃圾邮件处理方案的过程中,测试了很多种组合的方案,比较了各种方案的优点和劣势,最终我选择的是Slockd + Dspam配合过滤垃圾邮件。

Dspam单独处理垃圾邮件,需要前期付出比较多的劳动,对它进行训练,纠正(错误),而为了提高垃圾邮件的拦截率和准确度,我们对dspam漏判的垃圾信进行了分析,发现有80%都能通过slockd过滤掉,根据最近1周的Slockd + Dspam结合的效果来看,行为+内容过滤效果相当好。

1.原理

其实原理很简单,很多垃圾信的发送源ip能被一些著名RBL拦截,而部分冒充的邮件可以通过SPF拦截,另外一些由zombie发来的垃圾信可以通过greylist来阻隔一下。这些信其实都不需要经过dspam来判断,直接在slockd就干掉了,这样可以大大降低系统的负担,而且能将漏判的垃圾信杀掉。因此slockd和dspam是互补的作用。新的0.99 slockd只保留了那些能很有把握干掉垃圾邮件的模块(>99%的可信程度,例如spf),其他误判率高的模块全部删除,并且现有的插件执行顺序也是有设计思路在里面,不能随意变更的。

2.配置spam_locker

(1)安装Spam_Locker

# yum install extsuite-slockd

配置resolv.conf

请确认/etc/resolv.conf里的dns服务器是离你的邮件服务器最近,速度最快的dns server,slockd很依赖dns的好坏,因此给系统配置一个快速的dns能大幅度提高处理速度。

# vi /etc/resolv.conf

nameserver 202.106.0.20

上述dns服务器是北京联通dns,如果可能的话,请配置一个简单的bind,成为本地的dns cache server可获得最高性能。

(2)测试slockd

启动slockd

# /usr/local/slockd/slockd-init start

显示如下内容:

Starting spam locker daemon: slockd

设置slockd开机自启动

# echo “/usr/local/slockd/slockd-init start”>> /etc/rc.d/rc.local

slockd的系统日志一般在/var/log/slockd.log (支持彩色分析)

(3)Dspam配置

1、安装dspam

# yum install dspam-mysql

会安装上3个包,如下:

libdspam-3.8.0-10ext.i386.rpm

dspam-3.8.0-10ext.i386.rpm

dspam-mysql-3.8.0-10ext.i386.rpm

2、创建dspam所需的数据库

# cd /usr/share/dspam/sql/mysql/

# mysql -u root -p -e "create database dspam"

Enter password:        此处为空,直接回车

# mysql -u root -p -e "grant all on dspam.* to dspam@localhost identified by 'dspam'"

Enter password:

# mysql -u dspam -pdspamdspam< mysql_objects-4.1.sql

# mysql -u dspam -pdspamdspam3、DSPAM的token数据库的定时清理:

# crontab–e

加入以下内容:

0 0 * * * /usr/bin/mysql -u dspam -p'dspam' dspam< /usr/share/dspam/sql/mysql/purge-4.1.sql

0 0 * * * /usr/bin/dspam_logrotate -a 30 -d /var/spool/dspam/data

4、配置dspam.conf文件,内容如下:

# vi /etc/sdpam/dspam.conf

Home /var/spool/dspam

StorageDriver /usr/lib/libmysql_drv.so

TrustedDeliveryAgent "/usr/sbin/sendmail"

OnFail error

DeliveryHost        127.0.0.1

DeliveryPort        10024

DeliveryIdent       localhost

DeliveryProto       SMTP

Trust root

Trust dspam

Trust extmail

TrainingModeteft

TestConditionalTraining on

Feature whitelist

Algorithm graham burton

Tokenizer chain

PValuebcr

WebStats on

Preference "signatureLocation=headers"  # 'message' or 'headers'

Preference "showFactors=off"

AllowOverridetrainingMode

AllowOverridespamActionspamSubject

AllowOverridestatisticalSedation

AllowOverrideenableBNR

AllowOverrideenableWhitelist

AllowOverridesignatureLocation

AllowOverrideshowFactors

AllowOverrideoptInoptOut

AllowOverridewhitelistThreshold

MySQLUIDInSignature    on

MySQLServer     /var/lib/mysql/mysql.sock

MySQLUser               dspam

MySQLPass               dspam

MySQLDb                 dspam

MySQLCompress           true

MySQLConnectionCache   10

Notifications   off

PurgeSignatures 14          # Stale signatures

PurgeNeutral    90          # Tokens with neutralish probabilities

PurgeUnused     90          # Unused tokens

PurgeHapaxes    30          # Tokens with less than 5 hits (hapaxes)

PurgeHits1S     15          # Tokens with only 1 spam hit

PurgeHits1I     15          # Tokens with only 1 innocent hit

LocalMX 127.0.0.1

SystemLog on

UserLog   on

Opt out

MaxMessageSize 1048576

ServerPort              10028

ServerQueueSize 32

ServerPID               /var/spool/dspam/dspamd.pid

ServerMode              auto

ServerPass.Relay1       "secret"

ServerParameters        "--user extmail --deliver=innocent,spam"

ServerIdent             "localhost.localdomain"

ClientHost      127.0.0.1

ClientPort      10028

ClientIdent     "secret@Relay1"

ProcessorURLContext on

ProcessorBias on

5、启动dspam后台进程:

# chkconfigdspamd on

# /etc/init.d/dspamd start

查看dspam启动进程

# ps aux | grepdspam

dspam    18407  0.0  0.5  5452 1344 pts/0    S    19:16   0:00 /usr/sbin/dspamd –daemon

root     18412  0.0  0.2  5140  668 pts/0    S+   19:17   0:00 grepdspamd

6、配置Postfix

# vi /etc/postfix/main.cf

smtpd_recipient_restrictions = 

  permit_mynetworks,

  permit_sasl_authenticated,

  reject_non_fqdn_hostname,

  reject_non_fqdn_sender,

  reject_non_fqdn_recipient,

  reject_unauth_destination,

  reject_unauth_pipelining,

  reject_invalid_hostname,

  reject_unlisted_recipient,

  check_client_accesspcre:/etc/postfix/dspam_filter_access,

  check_policy_service inet:127.0.0.1:10030

smtpd_client_restrictions =

    header_checks = regexp:/etc/postfix/header_checks    这一行添加进去

过滤进来的邮件

# vi /etc/postfix/dspam_filter_access

加入以下内容:

/./ FILTER lmtp:[127.0.0.1]:10028

设置邮件标题过滤管理

# vi /etc/postfix/header_checks

加入以下内容:

/^(X-DSPAM-.*)/ IGNORE

/^(X-Spam-.*)/ IGNORE

修改 /etc/postfix/master.cf以下内容:

# vi /etc/postfix/master.cf

127.0.0.1:10025 inet    n       -       n       -       -     smtpd

        -o content_filter=

        -o local_recipient_maps=

        -o relay_recipient_maps=

        -o smtpd_restriction_classes=

        -o smtpd_client_restrictions=

        -o smtpd_helo_restrictions=

        -o smtpd_sender_restrictions=

        -o smtpd_recipient_restrictions=permit_mynetworks,reject

        -o mynetworks=127.0.0.0/8

        -o strict_rfc821_envelopes=yes

        -o smtpd_error_sleep_time=0

        -o smtpd_soft_error_limit=1001

        -o smtpd_hard_error_limit=1000

-oreceive_override_options=no_unknown_recipient_checks,no_header_body_checks

        重启postfix

          # /etc/init.d/postfix restart

7、增加extmail的垃圾邮件举报

# vi /var/www/extsuite/extmail/webmail.cf

主要变动如下:

SYS_SPAM_REPORT_ON = 1

SYS_SPAM_REPORT_TYPE = dspam

设置maildrop的全局过滤

以下的maildroprc文件同时支持调用ExtMail多语言过滤器解码器,如果用户已建立自定义过滤规则,则此条全局规则无效(以用户为准)。

# Decoder for high quality key word filtering

# Author: hzqbbc - ExtMailDev Team

DECODER="/var/www/extsuite/extmail/tools/decode -v"

if ((/^(From|Sender|Return-Path):.*MAILER\\-DAEMON/))

{

  BADSENDER=1

}

# Custom filter and auto deliver to Junk mailbox support

# need test command and other Unix command

`test -f $HOME/.mailfilter&& exit 1 || exit 0`

# No customize filtering rules

if ( $RETURNCODE == 0 )

{

if (/^X-Spam-Flag:.*YES/ || /^X-DSPAM-Result:.*Spam/)

  {

exception {

to "$HOME/Maildir/.Junk/."

    }

  }

}

添加maildrop日志文件:

# touch /var/log/maildrop.log

# chownvuser.vgroup /var/log/maildrop.log

8、训练DSPAM

这里我们建议采用不训练的办法。

为了进一步降低管理员的工作量,我们进行了大量的测试和摸索工作,目前提供一个简单的缩减训练周期和工作量的方法。我们提供一个已经预先训练好的dspam数据库文件(mysql only),该库是由3000封ham+3000封spam训练而成,用户只要在新的dspam系统里导入该数据库,原理上就可免除初期搜集最新spam及最新ham并进行训练的痛苦。

备注:导入Dspam数据库后,在Dspam-web的History界面并不会有历史记录。这个数据库文件只包含Dspam的特征库。

安装和导入方法

# cd /root/

#wgethttp://www.extmail.org/download/misc/dspam/dspam-tarained-data.sql.gz

# gzip -d dspam-trained-data.sql.gz

# cd /var/lib/mysql

# rm -rfdspam/   (备注:如果没有dspam的库,可以不用执行)

# mysql -u root -p -e "create database dspam"

# mysql -u root -p -e "grant all on dspam.* todspam@localhost identified by 'dspam'" 

# mysql -u dspam -pdspamdspam< /root/rpm/dspam-trained-data.sql

9、配置DSPAM Web界面

# yum install perl-GDGraph

# yum install perl-GD-Graph3d

# yum install dspam-web

创建dspam-web认证用户:

# cd /usr/share/dspam/webui/cgi-bin

# echo “extmail”> admins

# htpasswd -c .htpasswdextmail

输入认证密码

New password: 

Re-type new password: 

Adding password for user extmail

启动dspam-web守护进程

# servicedspam-webd start

这实际是启动了mini_httpd进程,查看mini_httpd是否启动正常:

# psaux|grep mini

显示一下内容

dspam    18580  0.0  0.3  4152  820 ?    Ss   20:05   0:00 mini_httpd -C /etc/dspam/webui.conf

root     18582  0.0  0.2  5316  668 pts/0  S+  20:05   0:00 grep mini

重启apache

# servicehttpd restart

访问dspam-web 

http://mail.xinhua.com/dspam

输入你在 .htpasswd文件中创建的用户和密码.下载本文

显示全文
专题