linux下spamassassin配置
SpamAssassin 是一种安装在邮件伺服主机上的邮件过滤器,用来辨识垃圾信。它是使用大量的预设规则检查垃圾信,这些规则会检查寄到网域内所有邮件的标头,内文,以及送信者。他采取的过滤方式是采用记分制,也就是说会根据我们所设定的标准来给予分数超过标准值的时候即判定为 SPAM,如果你使用了邮件服务器我们就一起来看看spamassassin配置方法。
spamassassin
安装
yum -y install spamassassin
修改Openwebmail的设定档
/var/www/cgi-bin/openwebmail/etc/openwebmail.conf
enable_spamcheck yes
enable_learnspam yes
learnspam_pipe /usr/bin/sa-learn --spam
learnham_pipe /usr/bin/sa-learn --ham
设定spamassassin,直接??即可使用
vi /etc/mail/spamassassin/local.cf
# How many hits before a message is considered spam.
required_hits 6.5
# Whether to change the subject of suspected spam
rewrite_subject 1
# Text to prepend to subject if rewrite_subject is used
subject_tag [SPAM]
# Encapsulate spam in an attachment
report_safe 1
# Use terse version of the spam report
use_terse_report 0
# Enable the Bayes system
use_bayes 1
# Enable Bayes auto-learning
auto_learn 1
# Enable or disable network checks
skip_rbl_checks 0
use_razor2 1
use_dcc 1
use_pyzor 1
# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
# - chinese english
ok_languages zh en
# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales zh en
# white list
whitelist_from www.111cn.net
# for CJK
score HEADER_8BITS 0
score HTML_COMMENT_8BITS 0
score SUBJ_FULL_OF_8BITS 0
score UPPERCASE_25_50 0
score UPPERCASE_50_75 0
score UPPERCASE_75_100 0
score BASE64_ENC_TEXT 0
score DATE_IN_PAST_03_06 0
score FROM_NAME_NO_SPACES 0
score X_MSMAIL_PRIORITY_HIGH 0
score X_PRIORITY_HIGH 0
# customized scores
score SUBJ_ILLEGAL_CHARS 1.0 1.0 0.8 0.8
score HEAD_ILLEGAL_CHARS 1.0 1.0 0.8 0.8
score FROM_ILLEGAL_CHARS 0.7 0.2 0.3 0.7
# customized scores
score TO_TXT 100
score RATWARE_HASH_2 100
score RATWARE_HASH_2_V2 100
score RATWARE_JIXING 100
# customized rules
header FOXMAIL X-Mailer =~ /FoxMail /
describe FOXMAIL Foxmail
score FOXMAIL 3.5
header QSUBJ Subject =~ /吗|哦|?|!/
describe QSUBJ Header contain question? in chinese
score QSUBJ 1
header CDROM_ZH Subject =~ /光碟/
describe CDROM_ZH Header contain CD in chinese
score CDROM_ZH 1
body UNSUBSCRIBE_ZH /取消.*订阅/
describe UNSUBSCRIBE_ZH Body contain unsubscribe msg in chinese
score UNSUBSCRIBE_ZH 1
body SPAM1_ZH /发信软体/
describe SPAM1_ZH Body contain spammer msg in chinese
score SPAM1_ZH 1
body SPAM2_ZH /发信系统/
describe SPAM2_ZH Body contain spammer msg in chinese
score SPAM2_ZH 1
body SPAM3_ZH /打扰.*致.*歉/
describe SPAM3_ZH Body contain spammer msg in chinese
score SPAM3_ZH 1
body SPAM4_ZH /行销光碟|行销名单/
describe SPAM4_ZH Body contain spammer msg in chinese
score SPAM4_ZH 1
body SPAM5_ZH /风险.*利润/
describe SPAM5_ZH Body contain spammer msg in chinese
score SPAM5_ZH 1
body WINDOWOPEN /window.open(/i
describe WINDOWOPEN JavaScript: Windows.Open
score WINDOWOPEN 3.5