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