Dspam的配置主要参考《Dspam+Amavis-new+SA-Clamav for EMOS》
链接: http://www.extmail.org/forum/thread-10393-1-1.html
shell
shell
DSPAM的token数据库的定时清理:
shell
加入以下内容:
0 0 * * * /usr/bin/mysql -u dspam -p'dspam' dspam < /usr/share/dspam/sql/mysql/purge.sql 0 0 * * * /usr/bin/dspam_logrotate -a 30 -d /var/spool/dspam/data
shell
变动内容如下:
DeliveryHost 127.0.0.1 DeliveryPort 10024 DeliveryIdent localhost DeliveryProto SMTP Trust extmail
Preference "signatureLocation=headers" # 'message' or 'headers' Preference "showFactors=off" MySQLUIDInSignature on MySQLServer /var/lib/mysql/mysql.sock MySQLUser dspam MySQLPass dspam MySQLDb dspam MySQLCompress true
MySQLConnectionCache 10
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"
shell
查看dspam启动进程
shell
显示以下内容:
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 grep dspamd
shell
增加以下内容:
header_checks = regexp:/etc/postfix/dspam_header_checks
设置邮件标题过滤管理 以防止重复X-DSPAM-Signature标题,可以防止签名被报道为垃圾。这发生在当你从一个已经运行Dspam的服务器收到邮件,或被用于通过伪造的、滥发邮件来阻止你训练数据库,
shell
增加以下内容:
/^(X-DSPAM-.*)/ IGNORE /^(X-Spam-.*)/ IGNORE
重启postfix :
shell
shell
增加以下内容:
$dspam = '/usr/bin/dspam';
@spam_scanners = (
['SpamAssassin', 'Amavis::SpamControl::SpamAssassin'],
['DSPAM', 'Amavis::SpamControl::ExtProg', $dspam,
[ qw(--client --stdout --deliver=spam,innocent --mode=teft --user extmail)],
],
);
SA增加DSpam插件:
shell
编辑 local.cf 文件
shell
在下面增加以下内容
include dspam.cf
编辑 init.pre 文件:
shell
在下面增加以下内容
loadplugin Mail::SpamAssassin::Plugin::dspam
重启amavisd
shell
说明:
Extmail 1.0.9正式加入垃圾邮件举报功能,主要基于(xueron)的补丁包,并进行了一定的调整,使该功能可以兼容DSPAM及Spamassassin两种内容过滤软件的训练。
Extmail1.1.1加入(stvictor)提供的spamassassin举报功能,感谢!
修改 webmail.cf
shell
主要变动的内容如下:
SYS_SPAM_REPORT_ON = 1 SYS_SPAM_REPORT_TYPE = dspam
设置maidrop的全局过滤
shell
内容如下:
# Decoder for high quality key word filtering
# Author: hzqbbc <hzqbbc@hzqbbc.com> - ExtMail Dev 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/."
}
}
}
备注: Dspam_WebUI for Nginx配置:
安装相关的rpm包:
shell
创建dspam-web 认证用户:
shell
输入认证密码
New password: Re-type new password: Adding password for user extmail
启动 dspam-web 守护进程
shell
这实际是启动了mini_httpd进程,查看 mini_httpd 是否启动正常:
shell
显示以下内容:
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
shell
访问 dspam-web
http://mail.example.com/dspam
输入你在 .htpasswd 文件中创建的用户和密码