接著上一篇的Spamassass的安裝後,現在來啟動服務(不是裝好就能用...)

上一篇有提到"Procmail"這個套件,現 在需要要它來呼叫spamassassin來過濾垃圾郵件。
(之前看了很多篇spamassassin的設定都是直接把設定寫在Postfix設定檔裡,
不過自己在做這一段時發現造成系統loading一直在95%以上,整台電腦好像快掛了...)

製作Procmail的設定檔
cp /etc/mail/spamassassin/spamassassin-spamc.rc /etc/procmailrc

修改Spamassassin的設定檔
pico /etc/mail/spamassassin/local.cf (因為有中文所以我用pico開)

#多少分才判為 SPAM
required_hits 5
report_safe 1
#若為 SPAM,是否設修改主旨
rewrite_subject 1
#修改主旨為 (當 rewrite_subject 是 1 的時候才會有用)
rewrite_header Subject [SPAM]
# Encapsulate spam in an attachment
report_safe 1
# Use terse version of the spam report
use_terse_report 1
# 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 japanese
ok_languages zh en ja

# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales en ja zh

設定Postfix 的設定檔 指定使用"Procmail"為MDA
vi /etc/postfix/main.cf

找到#mailbox_command = /some/where/procmail -a "$EXTENSION" 這行
修改成
mailbox_command = /usr/bin/procmail -a "$EXTENSION"

更改儲存郵件目錄的權限讓postfix透過procmail寫入郵件
chmod 1777 /var/spool/mail

最後把spamassass設為開機預設啟動的服務
chkconfig spamassassin on

把剛才做的設定restart 讓服務生效
service spamassassin restart
service postfix restart

以上就是Spamassassin的安裝與設定,裝好後不代表就能開始過濾全部的垃圾郵件,還需要做一番進階的設定才能讓過濾的功能更完整
(ex:嚴謹的過濾規則、黑&白名單的設定、自動學習功能...等)這部份的設定後續再補上(目前還沒做到那= =)。

這邊是我參考的資料

http://www.gentoo.tw/got-doc/spamassassin.xml
http://wiki.debian.org.tw/index.php/SpamAssassin
http://ms.ntcb.edu.tw/~steven/article/postfix_spam-spamassassin.htm

arrow
arrow
    全站熱搜

    正義的胖虎 發表在 痞客邦 留言(0) 人氣()