分类:
2006-10-15 12:14:05
# cc -O -o qmail-spamc qmail-spamc.c # install -m 755 qmail-spamc /var/qmail/bin |
确保qmail-queue,spamc 和spamd 在缺省路径中
|
编辑 /etc/tcp.smtp 如下,使所有的邮件都经过SpamAssassin 处理
127.:allow,RELAYCLIENT="" :allow,QMAILQUEUE="/var/qmail/bin/qmail-spamc" |
更新cdb文件
# qmailctl cdb |
这样,所有的邮件都经过SpamAssassin 处理,在邮件信头会加上一些扩展信头X-Spam
#!/bin/sh exec /usr/bin/spamd -L -x -u vpopmail -s stderr --pidfile /var/run/spamd.pid 2>&1 |
以后重启SA时用:
kill -HUP `cat /var/run/spamd.pid` |
下载Chinese_rules.cf
把该规则放在SpamAssassin存放规则的目录,一般在/usr/share/spamassassin
二 配置SpamAssassin的local.cf(/etc/mail/spamassassin/local.cf)
required_score 5.0 rewrite_header Subject ******SPAM****** report_safe 1 use_bayes 1 skip_rbl_checks 0 ok_languages all ok_locales zh score HEAD_ILLEGAL_CHARS 0 score SUBJ_ILLEGAL_CHARS 0 score DATE_IN_PAST_03_06 0 score UPPERCASE_25_50 0 score UPPERCASE_50_75 0 score UPPERCASE_75_100 0 score X_MSMAIL_PRIORITY_HIGH 0 score X_PRIORITY_HIGH 0 score TO_TXT 100 score RATWARE_HASH_2 100 score RATWARE_HASH_2_V2 100 score BAYES_99 0.1 score BAYES_80 0.1 score BAYES_60 0.1 score FROM_ILLEGAL_CHARS 0.1 score MIME_BASE64_TEXT 0.1 score NO_RDNS_DOTCOM_HELO 0.1 score CHINA_HEADER 0.1 score NO_REAL_NAME 0.2 score HTML_MESSAGE 0.2 score MIME_HTML_ONLY 0.2 score MIME_HTML_ONLY_MULTI 0.2 score FORGED_MUA_OUTLOOK 0.2 score FORGED_HOTMAIL_RCVD 0.2 score FORGED_OUTLOOK_TAGS 0.2 score MAILTO_TO_SPAM_ADDR 0.2
#使用CBL- header RCVD_IN_CBLLESS eval:check_rbl('cblless', 'cblless.anti-spam.org.cn.', '127.0.8.5')
#使用CML |
local.cf中相关配置参考Mail_SpamAssassin_Conf.pdf
日志文件在: /var/log/spamd
三 配置maildrop
配置.qmail-default文件(/home/vpopmail/domains/test.com/.qmail-default)
/usr/local/bin/maildrop ./.mailfilter |
邮件用户不存在时.qmaildefault的弹信功能在.mailfilter中实现
配置.mailfilter文件(/home/vpopmail/domains/test.com/.mailfilter)
import EXT import HOST SHELL=/bin/bash VHOME=`/home/vpopmail/bin/vuserinfo -d ` `test -d $VHOME/Maildir/` if($RETURNCODE !=0 ) {
} if($SIZE < 262144 ) {
} else {
} if (^X-Spam-Flag: YES/) {
} else {
} |