spamassassin运用小记录

1.可以建两个邮箱,一个黑名单,一个白名单,写类似下面的脚本,进行学习!
sa-learn --spam  --processes /home/domains/test.com/abc/Maildir/new/
sa-learn --spam --processes  /home/domains/test.com/abc/Maildir/new/
 
设置spamassassin,支持CCERT中文垃圾邮件过滤规则集及自动更新
[root@mail tmp]# wget -N -P /usr/share/spamassassin [url]www.ccert.edu.cn/spam/sa/Chinese_rules.cf[/url]
[root@mail tmp]# crontab -e
把下面一行复制到里面,进行自动更新规则
0 0 1 * * wget -N -P /usr/share/spamassassin [url]www.ccert.edu.cn/spam/sa/Chinese_rules.cf[/url]; /etc/rc.d/init.d/spamassassin restart
# sa-learn --sync -D -p user_prefs (建立学习系统)
#sa-learn --dump all(查看自学习的数据信息)
 
 
2.vi /etc/mail/spamassassin/local.cf 一些其它设定方法
 
# local domain from but ip not match. 域名和 IP 不符合,疑为垃圾邮件
header __FROM_TEATIME Received =~ /from test.com.cn/i
header __FROM_TEATIME_IP Received =~ /[12.34.56.78]/
meta FROM_TEATIME_BUT_IP_ERROR (__FROM_TEATIME)
describe FROM_TEATIME_BUT_IP_ERROR From test.com.cn but ip not match
score FROM_TEATIME_BUT_IP_ERROR 8

score NO_REAL_NAME 4.000
score SPF_FAIL 10.000
score SPF_HELO_FAIL 10.000
score BAYES_99 4.300
score BAYES_90 3.500
score BAYES_80 3.000
 
定义内容及RBL关键字得分(参考中国反垃垃联盟):
SpamAssassin主要配置文件是/etc/mail/spamassassin/local.cf和 /usr/share/spamassassin/*.cf,后者是默认的规则文件集,一般不要改动;前者可以让管理员修改配置添加规则。由于默认的规则 库不太符合国内中文邮件,所以你得添加一些适合中文的规则到local.cf文件中,下面的是由反垃圾邮件联盟网站ten提供的适合中文邮件规则集:
##################################################
#Follow is diables some bad rules for chinese mail
#################################################
score SUBJ_FULL_OF_8BITS 0.0
score BASE64_ENC_TEXT 0.0
score BAYES_99 0.1
score BAYES_90 0.1
score BAYES_80 0.1
score BAYES_70 0.1
score BAYES_60 0.1
score FROM_ILLEGAL_CHARS 0.1
score HEAD_ILLEGAL_CHARS 0.1
score SUBJ_ILLEGAL_CHARS 0.1
score MIME_BASE64_TEXT 0.1
score FAKE_HELO_AOL 0.1
score NO_RDNS_DOTCOM_HELO 0.1
score CHINA_HEADER 0.1 
 
鉴于相当多的网友询问如何在Spamassassin里配置CBL的黑名单作为其评分标准之一,
故整理了一下CBL/CDL/CBL+/CBL-的在Spamassassin里的配置格式,
其中有些设置了检查返验证码,有些没设,以及分值的设定等等,这些可根据各自的实际情况设置。
其中我们推荐优先使用CBL-和CML。
CODE

#最佳推荐之使用CBL-#
header  RCVD_IN_CBLLESS          eval:check_rbl('cblless', 'cblless.anti-spam.org.cn.', '127.0.8.5')
describe RCVD_IN_CBLLESS          Received via a relay in cblless.anti-spam.org.cn
tflags  RCVD_IN_CBLLESS          net
score           RCVD_IN_CBLLESS   3.5
#最佳推荐之使用CML#
header  RCVD_IN_CML          eval:check_rbl('cml', 'cml.anti-spam.org.cn.', '127.0.8.1')
describe  RCVD_IN_CML          Received via a white list relay in cml.anti-spam.org.cn
tflags  RCVD_IN_CML          net nice
score           RCVD_IN_CML          -20.0
#header  RCVD_IN_CBL            eval:check_rbl('cbl', 'cbl.anti-spam.org.cn.')
#describe  RCVD_IN_CBL          Received via a relay in cbl.anti-spam.org.cn
#tflags  RCVD_IN_CBL            net
#score   RCVD_IN_CBL   2.0
#header  RCVD_IN_CBL_DIALUP eval:check_rbl('cdl-notfirsthop', 'cdl.anti-spam.org.cn.', '127.0.8.4')
#describe  RCVD_IN_CBL_DIALUP CBL: dialup sender did non-local SMTP
#tflags  RCVD_IN_CBL_DIALUP      net
#score   RCVD_IN_CBL_DIALUP  1.5
#header  RCVD_IN_CBL_PLUS        eval:check_rbl('cblplus', 'cblplus.anti-spam.org.cn.')
#describe  RCVD_IN_CBL_PLUS        Received via a relay in cblplus.anti-spam.org.cn
#tflags  RCVD_IN_CBL_PLUS        net
#score   RCVD_IN_CBL_PLUS 1.0
以下两行另存为一个.cf文件 ,过滤指定主题和内容
header CN_SUBJECT_992   Subject =~ /135/
describe CN_SUBJECT_992 Subject contains "135"
score CN_SUBJECT_992    0.3
 body CN_BODY_977        /91\.com/
describe CN_BODY_977    Body contains "91\.com"
score CN_BODY_977       1.500
body CH_FREE /免费/
describe CH_FREE 内有中文字"免费",疑为垃圾信件。
score CH_FREE 15
#whitelist_from *@163.com
whitelist_from *@koowo.com
blacklist_from *@listhost.us

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值