Bogom
A simple sendmail milter to interface bogofilter
Manual page
BOGOM(8) OpenBSD System Manager's Manual BOGOM(8)
**NAME**
bogom - simple sendmail milter to interface bogofilter
**SYNOPSIS**
bogom [-R | -D] [-t] [-v] [-S] [-u user] [-s conn] [-b bogo_path] [-x
exclude_string] [-c conf_file] [-l body_limit] [-p pidfile] [-f
forward_spam] [-q quarantine_mdir] [-d]
**DESCRIPTION**
The bogom plugin can be used with the milter API of sendmail(8) to filter
mails using bogofilter(1) bayesian filter.
bogom is intended to be used with only one words database for the whole
system.
The options are as follows:
-R Reject mail classified as spam
-D Discard mail classified as spam
-t Train bogofilter with the mail classified as spam/ham
-v Verbose logging
-S Use spamicity header. Read configuration file section
for further details.
-u user User to run the milter. Default: bogofilter
-s conn Path to the pipe to connect sendmail. Default:
unix:/var/spool/bogofilter/milter.sock
-b bogo_path Path to the bogofilter(1) binary. Default:
/usr/local/bin/bogofilter
-x exclude_string If this string is found in the Subject of a message,
it will be automatically accepted and no filtering op-
eration will be done.
-c conf_file Path to the configuration file. Default:
/etc/bogom.conf
-l body_limit Length limit in bytes to be processed from mail body.
The rest of the body will be discarded and not ana-
lyzed by the filter. Default: no limit
-p pidfile Path to the file to store the pid of the milter. The
pidfile is created after the milter drops privileges
and the user to run the milter must have write permis-
sion to the specified file. Default:
/var/spool/bogofilter/bogom.pid
-f forward_spam Set a recipient to forward any message classified as
spam. Read configuration file section for further de-
tails.
-q quarantine_mdir
Path to a directory to deliver a copy of any message
classified as spam. The messages are stored in
maildir(5) format.
-d Enable debug messages (implies verbose logging)
Default policy is to add the X-Bogosity header (Yes, No, Unsure) and de-
liver the mail. This can be changed with -R or -D when bogofilter classi-
fies the mail as spam.
In bogofilter's configuration the bogofilter_dir token should be set to
the directory with system database, usually /var/spool/bogofilter, in bo-
gofilter's configuration, or simply the words database of the unprivi-
leged user running the milter can be used.
bogom uses a temporal file to store each individual message and forks a
new process to scan it with bogofilter. This temporal file uses /tmp di-
rectory by default, it's owned by the user running the milter and has
0600 mode. When a directory is specified in quarantine_mdir, the tmp sub-
directory in that maildir is used as temporal directory.
The option -t registers the mail after classifying it as spam or ham.
This option can be dangerous because the filter may register errors, so
you should read carefully bogofilter's manual regarding this point.
**SENDMAIL SETUP**
Milter support in sendmail binary can be verified with:
# sendmail -d0.1 -bv root | grep MILTER
Compiled with: DNSMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8
MIME8TO7
The milter can be added to sendmail's configuration by adding the follow-
ing lines to the mc file:
INPUT_MAIL_FILTER(`bogom',
`S=unix:/var/spool/bogofilter/milter.sock, T=S:30s;R:1m')
It assumes the default place for the communication socket.
The cf file must be rebuilt and sendmail restarted.
**CONFIGURATION FILE**
Configuration file supports following tokens:
# line comment
policy (pass|reject|discard)
default: policy pass
reject "<text for the SMTP reply>"
default: empty
(sendmail default is "Command rejected")
subject_tag "<text to tag the subject>"
default: empty
verbose (0|1)
default: verbose 0
bogofilter "<path to bogofilter binary>"
default: bogofilter "/usr/local/bin/bogofilter"
training (0|1)
default: training 0
body_limit <length in bytes>
default: no limit
user "<username to run the milter>"
default: user "bogofilter"
connection "<type>:<location>"
default: connection "unix:/var/spool/bogofilter/milter.sock"
pidfile "<path to milter pidfile>"
default: pidfile "/var/spool/bogofilter/bogom.pid"
exclude_string "<subject exclude string>"
default: empty
forward_spam "<rcpt>"
default: empty
quarantine_mdir "<path to maildir directory>"
default: empty
re_connection "<case insensitive extended re>"
default: empty
re_envfrom "<case insensitive extended re>"
default: empty
re_envrcpt "<case insensitive extended re>"
default: empty
Configuration takes precedence over command line.
By default X-Bogosity header will use 'Yes, tests=bogofilter', 'No,
tests=bogofilter' and 'Unsure, tests=bogofilter'. With spamicity_header
activated, the classification of 'Ham', 'Spam' or 'Unsure' plus the value
of spamicity will be used to tag the messages.
subject_tag string will be prepend to message subject when it is identi-
fied as spam and policy is pass.
body_limit specifies the amount of bytes (K suffix for Kilobytes and M
for Megabytes) of message body that will be passed to bogofilter to be
processed. This option should help busy servers but is incompatible with
quarantine_mdir feature.
forward_spam recipient will receive a copy of any message classified as
spam when policy is pass. Notice that the original destination recipients
won't be modified and general RELAY restrictions will apply.
If a directory in quarantine_mdir is specified, any message classified as
spam will be delivered there in maildir format. Neither reject nor dis-
card policy affect this delivery, but body_limit option is ignored. When
a message is delivered, necessary subdirectories are created (tmp and new
only). Notice that tmp subdirectory in maildir is used as temporal direc-
tory for bogom process when this option is active.
The re_* tokens allow to add items to connection, envfrom and envrcpt
white lists. Any message with client connection (both host and hostname,
if available), sender address or destination address matching the case
insensitive extended regular expression (explained in re_format(7)) will
be accepted and no filtering operation will be done. Those token can be
used more than once and all the regular expressions will be checked.
Quoted strings can use single and double quotes, using backslash to es-
cape both characters.
**LOGGING**
bogom sends messages to syslogd(8) using facility daemon and levels err,
notice, info and debug.
By default only info and, when needed, err levels will be used. With -v
option, extra information will be addressed with notice level plus the
log facility provided in bofogilter.
-d option enables debug level with very verbose logging.
bogom activity can be logged to a separate file with following lines in
syslog.conf(5):
!bogom
*.* /var/log/bogom
!bogofilter
*.* /var/log/bogom
**FILES**
/etc/bogom.conf
**SEE ALSO**
sendmail(8), bogofilter(1), bogoutil(1), syslog.conf(5), syslogd(8),
re_format(7), maildir(5)
http://www.usebox.net/jjm/bogom/
**CAVEATS**
By now SIGHUP is ignored.
**HISTORY**
The first version of bogom was written in the end of 2004.
**AUTHORS**
Juan J. Martinez <jjm@usebox.net>
OpenBSD 3.6 December 25, 2004 4
Download
bogom is released under GNU Public License terms.
This software is considered final and no further development is planed.
bogom-1.9.2.tar.gz - CHANGELOG -
README - README.solaris
(MD5 eed19c240e273ecc5037b5ac6a44d502
)
IMPORTANT: bogom errata notice 2006-1: please update to 1.8.2 or later.
Known ports and packages
- FreeBSD: mail/milter-bogom
Contributed patches
- -f logFacility patch: allows choosing the logging facility (instead of relying on syslog configuration). Thanks to Takao Abe for the contribution.
Related links
Here follow some links related to bogom: