以下文章引自
http://openwebmail.com/openwebmail/download/redhat/spamassassin/HOWTO稍微修改了一下
HOWTO install SpamAssassin on Red Hat Linux 7.3
===============================================
by Thomas Chung <
tchung@openwebmail.org>
Last Updated: 2003-05-13
1. 安裝下列 rpm 軟體,可在
http://www.mirror.ac.uk/sites/spamassassin.taint.org/spamassassin.org/released/RPMs/取得
perl-Mail-SpamAssassin-2.53-1.7.3.i386.rpm
spamassassin-2.53-1.7.3.i386.rpm
spamassassin-tools-2.53-1.7.3.i386.rpm
rpm --force -Uvh perl-Mail-SpamAssassin-2.53-1.7.3.i386.rpm
rpm --force -Uvh spamassassin-2.53-1.7.3.i386.rpm
rpm --force -Uvh spamassassin-tools-2.53-1.7.3.i386.rpm
2. 建立全域 spamassassin 設定檔
/etc/mail/spamassassin/local.cf
可以利用 SpamAssassin 設定檔產生器
http://www.yrex.com/spam/spamconfig.php 請確定有選擇: Rewrite Subjects using text "*****SPAM*****"
3. 啟動 spamassassin 服務
service spamassassin start
4. 在使用者目錄下的 procmailrc 設定檔裡增加如下的敘述
instead of global for security concern at
$HOME/.procmailrc
type following:
# filter all incoming mail through SpamAssassin and tags probable spam with a unique header
:0fw: spamassassin.lock
| /usr/bin/spamassassin
5. 使用 spamc 看 spamassassin 計分方式:
在 SpamAssassin 2.31 版(Redhat 8.0內建)沒有 -R 這個參數哩, 請去更新一下版本吧如果版本不一樣,以下的指令路徑也要改喔
$spamc -R < /usr/share/doc/spamassassin-2.53/sample-nonspam.txt
-6.3/5.0
PGP_SIGNATURE (-6.3 points) Contains a PGP-signed message
note: -6.3 is way low to be spam than required hits score 5.0
$spamc -R < /usr/share/doc/spamassassin-2.53/sample-spam.txt
7.4/5.0
NO_REAL_NAME (0.7 points) From: does not include a real name
INVALID_DATE (0.6 points) Invalid Date: header (not RFC 2822)
UNDISC_RECIPS (1.4 points) Valid-looking To "undisclosed-recipients"
HOME_EMPLOYMENT (1.5 points) BODY: Information on how to work at home (2)
DRASTIC_REDUCED (1.5 points) BODY: Drastically Reduced
REMOVE_SUBJ (0.8 points) BODY: List removal information
ONCE_IN_LIFETIME (0.7 points) BODY: Once in a lifetime, apparently
DATE_IN_PAST_12_24 (0.2 points) Date: is 12 to 24 hours before Received: date
INVALID_MSGID (0.4 points) Message-Id is not valid, according to RFC 2822
AWL (-0.4 points) AWL: Auto-whitelist adjustment
note: 7.4 is high enough to be spam than required hits score 5.0
標準是 5 分, 累積分數超過 5 分就判定是廣告信6. 寄一封廣告信來測試
mail -s test user@domain.com < /usr/share/doc/spamassassin-2.53/sample-spam.txt
7. 檢查看看信件主旨是否 rewrite 成
*****SPAM***** test
ps. 如果要讓 SpamAssassin 的過濾條件更高,可以把以下設定檔中
required_hits參數的值降低
例如把預設值 5 改成 4
請記得修改過設定檔之後,要重新啟動 SpamAssassin 服務8.到前面為止只是會把廣告信的主題,以及 Header 改寫,所以要過濾掉廣告信,可以在使用者目錄下的 procmailrc 設定檔中加入以下敘述
先在使用者目錄下建立一個 spam 目錄
:0:
* ^X-Spam-Status: Yes
$HOME/spam
這樣被過濾的廣告信,會一封一封分別存到使用者目錄下的spam目錄下
或是直接丟掉(不建議如此啦)
:0:
* ^X-Spam-Status: Yes
/dev/null
不過在初次使用的結果...它會把我訂閱的電子報過濾掉...所以需要稍微調整分數
你可以利用步驟五的方式,來檢查被過濾掉的非廣告信的計分,再來調整設定。