Openwebmail + spamassassin 擋垃圾信的設定方法

這幾天趁案子的空檔趕快把 Openwebmail + spamassassin 給架起來,之前一直架不成功,終於知道問題在哪裡了。


首先先到官方網站看安裝的方式:

http://openwebmail.com/openwebmail/download/redhat/howto/spam/howto.txt

(裡面的第 4. 可以略過)

再來才是重頭戲,也是我卡了好幾天才發現的地方:

在 openwebmail.conf 裡面的設定找到 enable_spamcheck 這段,照以下的參數做修改就可以了。(下面的例子也把學習廣告信的功能也打開)

spamcheck_pipe                  /usr/bin/spamc  -c -x -t60 -u @@@USERNAME@@@
learnham_pipe                   /usr/bin/sa-learn --local --ham
learnspam_pipe                  /usr/bin/sa-learn --local --spam
enable_spamcheck                yes
enable_learnspam                yes
spamcheck_source_allowed        all

之後再照官方的說明文件,以 sample-spam.txt 寄一封測試的廣告信,如果設錯的話,在 openwebmail.log 裡面就會出現:

Sun Oct 24 21:52:06 2004 - [31314] (192.168.1.1) neo - spamscheck - pipe error - spamd error, exit=2
55, ret=From root@xxx.com  Sun Oct 24 21:52:01 2004

成功的話就會出現:

Sun Oct 24 22:18:20 2004 - [31484] (192.168.1.1) neo - spamcheck - spam 1000.0/10 found in msg <2004
1024141811.CF83A19434C@xxx.com>

另外廣告信學習的功能如果設定成功的話,在使用者點選學習功能的時候,在 log 裡就會看到類似以下的訊息:

Sun Oct 24 22:25:13 2004 - [31634] (192.168.1.1) neo - learnspam - 1 learned, 1 examined

如果學習的功能起不來,就要確定 CmdLearn.pm 是不是非 root 權限的人可以讀到? 如果不行的話,就下 chmod 打開權限就可以了。如果不確定 CmdLearn.pm 路徑的話可以下 #locate CmdLearn.pm 找看看。

但是要注意的是目錄的權限也要開,以我的環境 CmdLearn.pm 在 RH9 的 RPM 預設是裝在:

/usr/lib/perl5/site_perl/5.8.0/Mail/SpamAssassin/

而我是乾脆把整個目錄都把 Group 跟 Public 讀取跟執行的權限打開:

chmod 555 /usr/lib/perl5/site_perl/5.8.0/Mail/SpamAssassin/ -R

這樣每個使用者就可以開始使用 OpenWebMail 的擋廣告信及學習廣告信的功能了。

14 comments On Openwebmail + spamassassin 擋垃圾信的設定方法

  • Openwebmail 之 Spamassassin 相關設定

    引用 Neo’s Blog : ‘Openwebmail + spamassassin 的設定方法’ 一文.

  • 請問以下二行
    learnham_pipe /usr/bin/sa-learn –local –spam
    learnspam_pipe /usr/bin/sa-learn –local –ham

    這樣對嗎,還是要改成
    learnham_pipe /usr/bin/sa-learn –local –ham
    learnspam_pipe /usr/bin/sa-learn –local –spam

    感謝

  • 真糟糕,這是我的筆誤,您的寫法是正確的。謝謝你提醒我喔! 馬上修正。

  • 點選學習功能的時候,在 log 裡就會看到類似以下的訊息:
    cat /var/log/openwebmail.log
    XXXXXXXXXXX – learnspam – 1 learned, 1 examined

    但下次同樣寄此封郵件,並不會送到廣告信件匣中,不知問題出在何處?

  • Neo大大您好
    小弟正為垃圾郵件所困擾,因本身只會RPM安裝,目前在SpamAssassin官網上並無提供RPM安裝方式,是否請大大分享如何安裝SpamAssassin步驟?
    小弟抓下GZ檔之後就不知道下一步該做什麼ㄌ@.@
    您提供的howto.txt真的是有看沒有懂^_^”
    謝謝

  • perl Makefile.PL(接下來按enter)
    make;make install

  • To kitty:

    SpamAssassin 學習功能並不是把寄件人加入黑名單,而是透過多次學習功能來讓貝氏演算法判別是不是廣告信喲。^^

  • To Rick:

    可以先到鳥哥這邊惡補一下! ^^
    http://linux.vbird.org/linux_basic/

  • 我的系統是freebsd 5.4 要安裝成mail server來當成辦公室的郵件主機 現在我遇到一個兩週下來都無法解決的問題

    我現在安裝的的軟體包含openwebmail2.5.1+vm-pop3d+clamav+spamassassin+amavisd+postfix來作為辦公室同事存取郵件

    dns設定沒有問題,收發信也沒問題,但是在自動學習貝氏演算法中,從mail.log告知我以下的訊息,當然我是全部用虛擬使用者,所以
    系統告訴我找使用者並不存在,所以無法自動來學習,所以我想問問對這方面有無解決方法?

    因為辦公室很久之前是用中華電信的ms8.hinet.net來收信,現在正常信件大約收到1封時,廣告信件大約已經60筆了,所以想要加入spamassassin來自動學習 只是現在測試的階段,判讀廣告信都是用openwebmail的郵件規則來分廣告信.

    ===下為我在openwebmail的收件夾信件移到廣告信夾所出現的log======
    May 6 19:36:09 mail spamd[615]: connection from localhost [127.0.0.1] at port 51107
    May 6 19:36:09 mail spamd[615]: info: setuid to nobody succeeded
    May 6 19:36:09 mail spamd[615]: Creating default_prefs [/nonexistent/.spamassassin/user_prefs]
    May 6 19:36:09 mail spamd[615]: Cannot write to /nonexistent/.spamassassin/user_prefs: No such file or directory
    May 6 19:36:09 mail spamd[615]: Couldn’t create readable default_prefs for [/nonexistent/.spamassassin/user_prefs]
    May 6 19:36:09 mail spamd[615]: checking message for nobody:65534.
    May 6 19:36:31 mail spamd[615]: identified spam (11.0/4.0) for nobody:65534 in 21.9 seconds, 922 bytes.
    May 6 19:36:31 mail spamd[615]: result: Y 11 – DOMAIN_RATIO,FORGED_MUA_OUTLOOK,FORGED_OUTLOOK_HTML,HTML_90_100,HTML_IMAGE_ONLY_08,HTML_MESSAGE,MIME_HTML_ONLY
    May 6 19:36:41 mail spamd[616]: connection from localhost [127.0.0.1] at port 49443
    May 6 19:36:41 mail spamd[616]: info: setuid to nobody succeeded
    May 6 19:36:41 mail spamd[616]: Creating default_prefs [/nonexistent/.spamassassin/user_prefs]
    May 6 19:36:41 mail spamd[616]: Cannot write to /nonexistent/.spamassassin/user_prefs: No such file or directory
    May 6 19:36:41 mail spamd[616]: Couldn’t create readable default_prefs for [/nonexistent/.spamassassin/user_prefs]
    May 6 19:36:41 mail spamd[616]: checking message for nobody:65534.
    May 6 19:37:02 mail spamd[616]: identified spam (18.8/4.0) for nobody:65534 in 20.7 seconds, 7802 bytes.
    May 6 19:37:02 mail spamd[616]: result: Y 18 – FORGED_MUA_AOL_FROM,FRONTPAGE,HEAD_ILLEGAL_CHARS,HELO_DYNAMIC_DHCP,HTML_MESSAGE,HTML_TAG_EXIST_TBODY,MIME_BASE

  • 請問各位大大:
    設定好後,是否連用收信軟體都有用
    還是只有開Openwebmail 時才會啟動過濾功能
    麻煩了,先謝嚕^^

  • 您好

    請問我在 Freebsd 5.4 版上架設 Openwebmail 2.51

    依照您文章中的建議設定了 openwebmail.conf
    一般從網頁的登入使用都沒有問題
    另外設定了 crontab 定期幫使用者作信件匣 index 檢查或是抓 POP3 外部信件,
    59 5 * * * /usr/local/www/cgi-bin/openwebmail/openwebmail-tool.pl -q -a -p -i

    不過每次系統執行的時候 openwebmail.log都會出現
    Sun Aug 28 05:59:06 2005 – [26407] (127.0.0.1) baison – spamscheck – pipe error – spamd error, exit=0, ret=0/0
    這樣的錯誤訊息,請問是不是有什麼地方漏了設定呢?

  • 請問一下
    SPAMASSASSIN成功後
    我的垃圾郵件郵件是會放進垃圾信箱中
    但是非垃圾郵件會放進Do檔案中,而且不是放在MAIL資料夾內
    不知識哪裡寫錯了?
    謝謝!

  • 請問neo大大
    你的openwebmail是裝在dreamhost上嗎
    因為最近要找有關這方面的資訊
    想問一下…謝謝

  • Thu Feb 8 10:02:44 2007 – [11073] (60.248.xxx.xxx) ysxxx – move message – move 1 msgs from INBOX to mail-trash – ids=
    Thu Feb 8 10:03:50 2007 – [11076] (60.248.xx.xxx) ysxxx – learnspam – 0 learned, 9 examined
    Thu Feb 8 10:04:56 2007 – [11109] (60.248.xx.xxx) ysxxxx – learnspam – 0 learned, 9 examined
    Thu Feb 8 10:05:04 2007 – [11173] (60.248.xxx.xxx) ysxxxx – move message – move 2 msgs from INBOX to spam-mail – ids=,
    Thu Feb 8 10:05:05 2007 – [11135] (127.0.0.1) fusheng – spamscheck – pipe error – spamd error, exit=255, ret=0/0
    Thu Feb 8 10:05:08 2007 – [11178] (60.248.xxx.xxxx) ysxxx – learnspam – 0 learned, 2 examined
    Thu Feb 8 10:05:49 2007 – [11237] (60.248.xxx.xxx) ysxxx – move message – move 1 msgs from INBOX to spam-mail – ids=
    Thu Feb 8 10:05:50 2007 – [11238] (60.248.xxx.xxx) ysxxxx – learnspam – 0 learned, 1 examined
    Thu Feb 8 10:06:43 2007 – [11247] (60.248.xxx.xxx) ysxxxx – move message – move 5 msgs from INBOX to spam-mail – ids=, , , ,
    Thu Feb 8 10:06:51 2007 – [11248] (60.248.xxx.xxx) ysxxxx – learnspam – 0 learned, 5 examined
    Thu Feb 8 10:10:08 2007 – [11471] (127.0.0.1) fusheng – spamscheck – pipe error – spamd error, exit=255, ret=0/0
    Thu Feb 8 10:15:07 2007 – [11596] (127.0.0.1) fusheng – spamscheck – pipe error – spamd error, exit=255, ret=0/0
    Thu Feb 8 10:20:08 2007 – [11725] (127.0.0.1) fusheng – spamscheck – pipe error – spamd error, exit=255, ret=0/0
    Thu Feb 8 10:25:05 2007 – [11866] (127.0.0.1) fusheng – spamscheck – pipe error – spamd error, exit=255, ret=0/0

    為啥麼我一直出現上面[11866] (127.0.0.1) fusheng – spamscheck – pipe error – spamd error錯誤呢?
    我的版本是FC2+openwebmail 2.41+spamassassin-2.63-8
    我也已經照您上面打的反覆查了好幾次了說!我的openwebmail.conf如下:
    enable_spamcheck yes
    spamcheck_pipe /usr/bin/spamc -c -x -t60 -u @@@USERNAME@@@
    #spamcheck_source_allowed pop3
    spamcheck_source_allowed all
    spamcheck_maxsize_allowed 1000
    spam_destination spam-mail
    has_spamfolder_by_default yes

    enable_learnspam yes
    learnspam_pipe /usr/bin/sa-learn –spam
    learnham_pipe /usr/bin/sa-learn –ham
    learnspam_destination spam-mail
    learnham_destination INBOX
    但是就是一直出現如上面的錯誤到底是怎麼回事有沒有那位大大可以提點一下!感恩不儘了

Comments are closed.

Site Footer

Sliding Sidebar