new file --- GETTING.STARTED
David Relson
relson at osagesoftware.com
Sun Oct 24 16:43:53 CEST 2004
G'day,
As promised a while ago, I've written a "getting started" document. It's
aimed for the newbie who has found bogofilter, but isn't quit sure what
to do with it once he/she's gotten it installed. The document is still
a draft. Odds are I've forgotten some important info. Please read and
respond with clarifications, corrections, additions, etc.
Thank you,
David
-----------------------------------------------------------------------
GETTING STARTED
- Installing Bogofilter
- Preparing for use
- Configuring bogofilter
- Training bogofilter
- Setting up the mail transfer and delivery agents
- Use with mail user agent
- Ongoing training
- Tuning bogofilter
- Additional information
--- Installing Bogofilter ---
Bogofilter can be installed from source or from a binary package.
Releases are made available on SourceForge.net.
Source formats include tarballs (in .tar.gz and .tar.bz2 forms)
and rpms (bogofilter-VER.src.rpm). Once downloaded and untarred,
build and install with the usual commands, i.e. "configure",
"make", and "make install". To ensure that the newly built
bogofilter is running properly on your hardware and operating
system, use "make check" to run a series of tests.
For source rpms, use "rpm -bb bogofilter.spec" and "rpm -ivh
bogofilter" (or comparable commands).
Binary formats include builds for dynamically linked (shared)
libaries, e.g. bogofilter-VER.i586.rpm, and a statically linked
executable, e.g. bogofilter-static-VER.i586.rpm.
See the INSTALL file for more info.
--- Preparing for use ---
Once bogofilter has been installed, it needs to be configured and
trained, i.e. given messages that you classify as spam and
non-spam (also called "ham").
--- Configuring bogofilter ---
Bogofilter's default configuration is conservative, i.e. only
messages that score very high on the ham/spam scale are classified
as spam. This is done to minimize the number of false positives
(non-spam messages which are classified as spam).
If you need (or wish) to change bogofilter's configuration
options, the file is named "bogofilter.cf" and bogofilter first
checks for /etc/bogofilter.cf and then for
~/.bogofilter/bogofilter.cf. The configuration options are
described in file bogofilter.cf.example.
--- Training bogofilter ---
Bogofilter uses a database for storing its tokens and their ham
and spam counts. The file is commonly called "the wordlist" and
its standard location is ~/.bogofilter/wordlist.db.
As distributed, bogofilter doesn't include a wordlist. You, the
user, need to tell bogofilter what you consider spam and what you
consider ham. This is bogofilter's training process and involves
running bogofilter with appropriate flags and with messages you've
determined are ham and spam. As bogofilter can work with multiple
mail formats, e.g. mailboxes, maildirs, MH directories, etc, the
training commands will depend on your environment.
Useful options for training include:
-s - register message(s) as spam.
-n - register message(s) as non-spam.
-M - use mailbox mode, i.e. classify multiple messages in an
mbox formatted file.
-B file1, file2, ... - set bulk mode, i.e. process multiple
messages (files or directories) named on the command
line.
These options are documented in the bogofilter man page.
--- Setting up the mail transfer and delivery agents ---
Bogofilter works with many mail transfer agents (such as postfix,
sendmail, and qmail) and many mail delivery agents (for example
procmail and maildrop). Each of these has its own configuration
file and methods for invoking spam filters like bogofilter. The
documentation includes files "integrating-with-postfix" and
"integrating-with-qmail". Read them for ideas on how to setup
bogofilter for your environment.
The most common setup uses bogofilter's "-p" (passthrough) option
which adds an "X-Bogosity:" line as the end of the message's mail
header. Typical examples of this line are:
(for spam)
X-Bogosity: Spam, tests=bogofilter, spamicity=1.000000,
version=0.92.8
X-Bogosity: Spam, tests=bogofilter, spamicity=0.999765,
version=0.92.8
(for non-spam)
X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000,
version=0.92.8
X-Bogosity: Ham, tests=bogofilter, spamicity=0.000413,
version=0.92.8
X-Bogosity: Ham, tests=bogofilter, spamicity=0.373476,
version=0.92.8
(for "unsures")
X-Bogosity: Unsure, tests=bogofilter, spamicity=0.500332,
version=0.92.8
X-Bogosity: Unsure, tests=bogofilter, spamicity=0.463498,
version=0.92.8
X-Bogosity: Unsure, tests=bogofilter, spamicity=0.640426,
version=0.92.8
X-Bogosity: Unsure, tests=bogofilter, spamicity=0.824933,
version=0.92.8
Alternatively, bogofilter's return codes can be used by procmail
(or maildrop) rules to put spam in one mailbox and ham in another.
--- Use with mail user agent ---
Bogofilter is compatible with all mail user agents. MUA's with
filtering abilities can check the headers for "X-Bogosity: Spam"
and "X-Bogosity: Ham" and take the appropriate actions for spam and
ham.
Alternatively, if your MUA has sufficient scripting capabilities,
the MUA can run bogofilter and take the appropriate action.
As time goes by and bogofilter encounters messages that it can't
classify with certaintly, there will be messages classified as
"Unsure". As these messages are in the "gray" area, meaning "not
clearly ham and not clearly spam" it's useful to have your MUA
filter these messages so you can use them to train bogofilter.
--- Ongoing training ---
Bogofilter can only do a good job if it has accurate and
comprehensive information in its wordlist.
As time goes by and bogofilter classifies messages for you, it
will encounter problems time because it doesn't have enough
information to correctly classify each and every message. It's
important to check message classifications!
"False negatives", i.e. spam classified as ham, are easy since
they'll appear in your inbox and be noticed. "False positives"
are important to find because they're messages you want! All
messages in these groups should be used to train bogofilter.
Filtering "Unsure" messsages into a separate folder (or mailbox),
and separating them into spam and ham, gives a good set of
messages for training (using bogofilter's "-s" and "-n" flags).
--- Tuning bogofilter ---
Once you've use bogofilter for a while, you may wish to optimize
its classification parameters. The bogotune utility uses your
wordlist and additional ham and spam messages to check a large
variety of possible parameter values and find what'll work best
for your environment. For more info, read the bogotune man page
and file bogofilter-tuning.HOWTO.html.
--- Additional information ---
Bogofilter includes a number of files having more information.
You'll find them in /usr/share/doc (or comparable location). The
following files are included:
FAQs:
English - bogofilter-faq.html
French - bogofilter-faq-fr.html
General:
INSTALL
NEWS
README
RELEASE.NOTES
Man pages:
bogofilter
bogolexer
bogoutil
bogotune
bogoupgrade
(also distributed in html and xml formats)
HOWTOS:
bogofilter-tuning.HOWTO.html
integrating-with-postfix
integrating-with-qmail
Operating specific README files:
README.freebsd
README.hp-ux
README.RISC-OS
More information about the Bogofilter
mailing list