qmail and bogofilter (spam filter) how-to
tigger at onemoremonkey.com
Tue Mar 2 06:35:08 EST 2004
(This email has been sent to two list, please make any replies to only
the relevant list)
A quick, information email about how to set-up bogofilter
http://bogofilter.sourceforge.net/ for use with qmail 1.03
http://qmail.org/ - I'm using this method on two FreeBSD 5.2.1 servers
* Download and install bogofilter
* Download and install qmail, make sure you use the ~/Maildir method
* In each users home directory (added everything to /usr/share/skel/
for new users);
$ mkdir .bogofilter
$ echo "spam_subject_tag=[SPAM??]" > .bogofilter/bogofilter.cf
* Make a small (or big) generic wordlist.db using bogofilter (see the
bogofilter FAQ or read the man pages) and copy this to each users
.bogofilter/ folder (permission should be 660, owner:group is user)
* Make each users .qmail file look like the following;
(note: This should be one line and paths may be different)
(note: I do not know if Linux has mktemp, it maybe a *BSD only tool)
|/usr/local/bin/bogofilter -d./.bogofilter -c./.bogofilter/bogofilter.cf
-p > `mktemp ./Maildir/new/XXXXXXXXXXX` ; exit 99
* Make a .qmail-spam file in each users home with the following in it;
| /usr/local/bin/bogofilter -d ./.bogofilter -s
* Make a .qmail-ham file in each users home with the following in it;
| /usr/local/bin/bogofilter -d ./.bogofilter -n
* Detected spam (according to bogofilter) will now have [SPAM??] added
to the subject line.
* Any spam that does not have [SPAM??] added to the subject line should
be redirected to USER-spam at host
* Any mail that is NOT spam, but bogofilter has added [SPAM??] to the
subject line, should be redirected to USER-ham at host
Thats it for spam free (with a bit of training) email.
bogofilter will improve the detection of spam with use and the
redirection of spam and ham messages. Some people report 100% correct
detection. Personally, I find it gets about 98% correct.
Highly suggest reading up on bogofilter and qmail for the limitless
options and tweaks that can be used to suit your needs.
Correction and improvements are more than welcome. Personally, I think
the `mktemp` part is the weak point, followed by exit 99.
More information about the Bogofilter