pyzor-0.5.0.tar.gz , dcc.tar.z
--------------------Start--------------------------------------
1. (安裝: Mail Scanneryum -y install gcc rpm-build perl-MIME-tools
shell> tar zxvf MailScanner-4.79.11-1.rpm.tar.gz
shell> cd MailScanner-4.79.11-1
shell> ./install #進行安裝
2.(安裝: antivir ,小紅傘防毒
shell> tar zxvf antivir_workstation-pers.tar.gz
shell> cd antivir_workstation-pers
shell> ./install #安裝前請將小紅傘KEY複製在安裝資料夾下再安裝
小紅傘的更新與啟動(chkconfig avguard on)
shell> service avguard start #啟動小紅傘
shell> avupdate-guard start #手動更新病毒碼
手動掃毒
shell> avscan /var #利用avscan 指定掃描 /var目錄
2.(安裝: spamasssassin
shell> yum -y install spamasssassin #安裝濾信軟體
shell> cd /etc/mail/spamasssassin
shell> ln -s local.cf /etc/MailScanner/spam.assassin.prefs.conf
shell> ln -s local.cf /root/.spamassassin/pre
#本人已先將初始spam.assassin.prefs.conf備份為
spam.assassin.prefs.conf.bak 再進行soft-link連結
vi /etc/mail/spamasssassin/local.cf
*初始化的local.cf是幾乎空白您可至 http://www.yrex.com/spam/spamconfig.php
網站上下載初始化設定*
本人設定如下
auto_whitelist_path /var/spool/MailScanner/spamassassin/auto-whitelist
#啟動Mail Scanner 自動讀白名單檔案
auto_whitelist_file_mode 0644
bayes_path /var/spool/MailScanner/spamassassin/bayes #指定byes_path
bayes_file_mode 0644
use_bayes 1 #使用貝式分析法比對垃圾信
report_safe 0 # 是否壓縮spam檔案並儲存
pyzor_path /usr/bin/pyzor #搭配spamassign 評分垃圾機制
dcc_path /usr/local/bin/dccproc #搭配spamassign 評分垃圾機制,指定其path
use_razor2 1 #搭配spamassign 的plugin
use_dcc 1
dcc_home /var/dcc # 搭配spamassign 的plugin
use_pyzor 1 # 搭配spamassign 的plugin
3.(安裝: razor-agents ,razor-agents-sdk
shell > tar xvf razor-agents-2.84.tar.bz2
shell > cd razor-agents-2.84
shell> perl Makefile.PL
shell> make
shel> make install *razor-agents-sdk也以此安裝再此略過*
3.(安裝: Pyzor
shell > tar xvf pyzor-0.5.0.tar.bz2
shell > cd pyzoer.0.5.0
shell> python setuppy bulid
shell> python setup.py install
shell> chmod -R a+rX /usr/share/doc/pyzor
shell> chmod -R a+rX /usr/lib/python2.4/site-packages/pyzor
shell> chmod -R a+rX /usr/bin/pyzor /usr/bin/pyzor
pyzor discover # 下載相關server清單
4(安裝: dcc
shell > tar zxvf dcc.tar.Z
shell > cd dcc
shell> ./configure
make
make install
vi /var/dcc/dcc_conf
DCCIFD_ENABLE=on <===確認on
5(安裝: 於Postfix上起用DNSBL黑名單檢查功能(若被列入此名單,將無法以此
mail address 發信給我方mail client)
vi /etc/postfix/main.cf
smtp_client_restrictions=reject_rbl_client,sbl-xbl.sparmhaus.org
#找空白處加入此行即可
.6(使用: Postgrey(yum -y install postgrey)
vi /etc/postfix/main.cf
smtpd_recipient_restrictions = permit_mynetwork,
check_policy_service unix:/var/spool/postfix/postgrey/socket,
check_relay_domains
.7(Spamasssssin 白名單設計與 Spamassassin 智能學習濾信
vi /etc/MailScanner/MailScanner.conf
#黑名單撰寫方式也類似,預設MailScanner中未啟用黑名單,以白名單為主,但可打開此fuction
Exsample:
From: *@so-net.net.tw yes
#將so-net.net_信箱使用者,設置為白名單(此為比對寄件者)
From: 192.168.0 yes
#將192.168.0.0/24此網段設置成白名單成員(此為比對寄件者)
修改 /var/spool/MailScanner 權限
chown -R postfix.postdrop /var/spool/MailScanner
接者我們須修改Postfix 的mail.cf 讓MailScanner 啟動時能夠順利呼叫Postfix 啟動
vi /etc/postfix/mail.cf
header_checks = regexp:/etc/postfix/header_checks #空白處加入此行儲存即可
vi /etc/postfix/header_checks
/^Received:/ HOLD #空白處加入此行儲存即可about 表頭檢查
將防毒小紅傘軟體,加入MailScnner 呼叫掃毒的成(我們已在前面安裝且測試小紅傘OK)
vi /etc/MailScanner/MailScanner.conf
Virus Scanning = yes #找到相關參數並依照左邊修改
Virus Scanners = antivir
修改MailScanner中有關Spamassassin相關組態設定
vi /etc/MailScanner/MailScanner.conf
Spam Checks = yes
Use SpamAssassin = yes # 使用 SpamAssassin 偵測SPAM)
Deliver Unparsable TNEF = yes # 增加使用Outlook的相容性
High Scoring Spam Actions = deliver header "X-Spam-Status: Yes"
#高積分時在header標記X-Spam
Spam Assassin User State Dir = /var/spool/MailScsnner/spamassassin
Spam Subject Text = **SPAM** #普通SPAM的附加標題)
High Scoring Spam Subject Text = **SPAM* * #高分SPAM的附加標題)
Required SpamAssassin Score = 6 #(普通SPAM積分)
High SpamAssassin Score = 10 #(高級SPAM積分)
Delivery Method = batch #批次掃描)
接者讓MailScanner開機自動ON,及讓MailScanner服務重新啟動
shell> chkconfig MailScanner on
shell> service MailScanner restart
# 重新啟動MailScanner , Postfix & Antivir & Spamassassin 將一併啟動服務
Spamassassin 智能學習濾信
我們必須在新增一個SPAM專用學習信箱, Ex: SPAM_BOX
我們可以將垃圾郵件瘋狂大量轉寄於SPAM_BOX,並下以下command讓 Spamassassin
智能學習增加濾信判斷率
sa-learn --showdots --spam --mbox SPAM_BOX
8).寄發一封信並查看/var/log/message ,/var/log/maillog
keynes@mail.shengyao.idv.tw => chi@mail.shengyao.idv.tw
#下圖可得知MailScanner呼叫小紅傘進行掃毒
MailScanner 亦呼叫 SpamAssassin
8) (重頭戲) Mail Scanner 安裝完成後組態設定 趁者 Mail Scanner 又臭又長的安裝過程中, 我們完成上述,Spamassassin 白名單, dnsbl,postgrey..安裝與設定後,剩下來我們要組態最後重頭戲 MailScanner 請先將Mailgateway ,Spamassassin,Postfix 服務終止,等會組態MailScanner vi /etc/MailScanner/MailScanner.conf 找到以下參數並修改成下述 Run As User = Postfix #修改執行MailScanner的身份 Run As Group = Postfix Outging Queue Dir = /var/spool/postfix/incoming 最後_最直接測試SpamAssign 是否運行,並輸出查看評分測試結果 shell> cd /usr/share/doc/spamassain/ shell> spamassassin -D -t < sample-spam.txt > spam.txt
基本組態設定,與一些plugn(pyzor,dcc,rzor2....)
後一併呼叫啟動
Incoming Queue Dir = /var/spool/postfix/hold
#設定郵件進與出的佇列,進來郵件會入hold掃描
#設定郵件進與出的佇列,出去郵件會入incoming掃描 MTA = postfix
#預設為sendmail,我們須修正為postfix
#將評分結果輸出成spam.txt(共有dcc,pyzor,rzor...幾種評分測試)
留言列表