3-3‧實際設定:
#vi /usr/local/etc/mail/spamassassin/local.cf
# SpamAssassin config file for version 2.5x# generated by
http://www.yrex.com/spam/spamconfig.php (version 1.01)# How many hits
before a message is considered spam. 得分多少以上就會被判定為垃圾郵件.required_hits
10# Whether to change the subject of suspected
spam. 在垃圾郵件上之標題上加上註記.rewrite_header Subject ****SPAM(_SCORE_)****#
Encapsulate spam in an attachment.
# 要如何處理垃圾郵件。因為郵件還會經過防毒程式的處理,所以必須設定為 0。
# 0:將資訊寫入郵件表頭。
# 1:將垃圾郵件轉為附件。
# 2:將垃圾郵件轉為純文字附件。 report_safe 0# 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. 略過 RBLs 之檢查、使用 Razor version 2、使用 DCC (Distributed
Checksum Clearinghouse)、使用 Pyzorskip_rbl_checks 0use_razor2
1use_dcc 1use_pyzor 1#
Blacklist. 黑色清單,判定減 - 100 分blacklist_from *@sohu.com *@mailfb.com#
Whitelist . 白色清單,判定加 +100 分whitelist_from *@yahoo.com.tw *@yahoo.com.hk
*@yahoogroups.com.hkwhitelist_from rika@rika.idv.tw# Mail using
languages used in these country codes will not be marked# as being
possibly spam in a foreign language.# - chineseok_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# Disabled scores. 防止 中文
主旨和中文收件者誤判,建議再加上下列幾行score HEADER_8BITS 0score HTML_COMMENT_8BITS 0score
SUBJ_FULL_OF_8BITS 0score UPPERCASE_25_50 0score UPPERCASE_50_75 0score
UPPERCASE_75_100 0
# local domain from but ip not match. 網域和 ip 不符,疑為垃圾信件
header __FROM_TEATIME Received =~ /from ntut.idv.tw/i
header __FROM_TEATIME_IP Received =~ /\[88\.88\.88\.88\]/
meta FROM_TEATIME_BUT_IP_ERROR (__FROM_TEATIME)
describe FROM_TEATIME_BUT_IP_ERROR From ntut.idv.tw but ip not match
score FROM_TEATIME_BUT_IP_ERROR 8
#telnet 127.0.0.1 10025
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 yourhost.example.com ESMTP Postfix
--> quit
221 Bye
Connection closed by foreign host.
如果出现了上面的信息就表示程式配置成功,可以使用它了。
如果你还想进一步测式看看你的邮件伺服器是否真的会通过amavisd-new来扫描病毒,就需要执行下面的命令交互测试。
-> $ telnet 127.0.0.1 10024
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 [127.0.0.1] ESMTP amavisd-new service ready
--> MAIL FROM:<test@example.com>
250 2.1.0 Sender test@example.com OK
--> RCPT TO:<postmaster>
250 2.1.5 Recipient postmaster OK
--> DATA
354 End data with <CR><LF>.<CR><LF>
--> Subject: test1
-->
--> test1
--> .
*** 250 2.6.0 Ok, id=31859-01, from MTA: 250 Ok: queued as 90B7F16F
--> MAIL FROM:<test@example.com>
250 2.1.0 Sender test@example.com OK
--> RCPT TO:<postmaster>
250 2.1.5 Recipient postmaster OK
--> DATA
354 End data with <CR><LF>.<CR><LF>
--> Subject: test2 - virus test pattern
-->
--> X5O!P%@AP[4PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
--> .
you should get one of the following replies (or similar), depending on
the $final_virus_destiny and *virus_lovers* settings in amavisd.conf:
*** 550 5.7.1 Message content rejected, id=16968-01 - VIRUS: EICAR-AV-Test
*** 250 2.5.0 Ok, but 1 BOUNCE
*** 250 2.7.1 Ok, discarded, id=16984-01 - VIRUS: EICAR-AV-Test
*** 250 2.6.0 Ok, id=17041-01, from MTA: 250 Ok: queued as 3F1841A5F5