bogofilter

看到 這篇 bogofilter 亂談 才發現我好像欠某長輩 document 很久了 :p 查了一下,我是從六月中的時候開始用 ,七月中的時候把 的 Mail System 也加上 過濾。

我是裝 ,因為 只要 wordlist 超過 1xMB 就會寫不進去,不知道為什麼 :p 而且 的速度很快 (只比 慢:),所以就用 吧 :p

.procmailrc 裡面設定:

# bogofilter
:0fw
| /usr/local/bin/bogofilter -e -p -l

.muttrc 裡面設定:

macro index X "<pipe-entry>formail -s bogofilter -s\n<delete-message<" "mark as spam"
macro index Z "<pipe-entry>formail -s bogofilter -n\n" "mark as non-spam"

配合 過濾時 master.cf 的部分內容:


smtp inet n - n - - smtpd -o content_filter=bogofilter:
bogofilter unix - n n - - pipe flags=FR user=nobody:mail
argv=/usr/local/sbin/bogofilter.sh -f ${sender} -- ${recipient}

其中 /usr/local/sbin/bogofilter.sh 是從網路上抄來的,長這樣:

#!/bin/sh
/bin/rm /tmp/bogofilter-now
echo $$ > /tmp/bogofilter-now
CAT=/bin/cat
FILTER=/usr/local/bin/bogofilter
FILTER_DIR=/var/spool/bogofilter
SENDMAIL="/usr/sbin/sendmail -i"
# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69
cd $FILTER_DIR || { echo $FILTER_DIR does not exist; exit $EX_TEMPFAIL; }
# Clean up when done or when aborting.
trap "rm -f msg.$$" 0 1 2 3 15
# bogofilter returns: 0 for spam; 1 for non-spam; 2 for I/O or other errors.
$CAT | $FILTER -d $FILTER_DIR -p -e > msg.$$
$SENDMAIL "$@" < msg.$$

其中 /var/spool/bogofilter 裡必須有 wordlist.qdbm

詳細的說明晚點再寫。

另外提供我自己的 wordlist.qdbm 讓大家用好了,如果不想自己花兩三天 train 的話:http://files.gslin.org/bogofilter/wordlist.qdbm

This entry was posted in Computer, Mail, Murmuring, Network, Software, Spam. Bookmark the permalink.

4 Responses to bogofilter

  1. Pingback: jwhuang’s blog » bogofilter

  2. David Relson says:

    bogofilter's return codes are:
    0 - spam
    1 - ham
    2 - unsure
    3 - I/O or other error

    These return codes have been in use since version 0.92.8 ( October 2004)

  3. Pingback: bogofilter at jwhuang’s blog

  4. dennylin93 says:

    現在 SQLite 好像沒有問題了

Leave a Reply

Your email address will not be published. Required fields are marked *