postfix_bayes(8) Expaminator postfix_bayes(8)
NAME
postfix_bayes
SYNOPSIS
postfix_bayes [-D level] [-h] [-v] [-c config-file]
DESCRIPTION
A Bayesean spamfilter for postfix
postfix_bayes is a postfix-friendly spam filter which nor
mally runs as a daemon. It, in effect, "sits between" two
postfix processes, acting as a server to the upstream pro
cess, and as a client to the downstream process.
Command-line options:
-D Set the Debug level; 'level' should be a positive inte
ger 0..50. Higher values for debug-level cause more
internal variables to be dumped to stdout. This is not
associated with the error-logging level, ´debug´; '-D'
should not be used during normal mail processing.
-X Don't daemonise; useful only for debugging.
-h Help; print the command-line options and exit.
-v Version; print the version number and exit.
-c specify a Configuration file. If '-c config-file' is
omitted, the environment variable 'SPAMCONFIG' is used.
CONFIGURATION
postfix_bayes' configuration file is composed of simple
keyword-value pairs, one pair per line. Keywords are not
case-sensitive; keyword and value are separated by one or
more spaces or tabs. A comment symbol, '#' anywhere on a
line causes all following text to be ignored. post
fix_bayes will stop scanning for a keyword at the first
occurence in the file.
This configuration file is shared by the database mainte
nance and testing utilities.
approval_message <headername>
Optional; default is 'X-judged-non-spam'
When a message has been judged legitimate, a header is
added to it containing an indication that it has been
passed through the filter. The host name, which may be
overridden by 'force_hostname', is appended automatically.
condemnation_message <message text>
Optional; default is 'Message has been comdemned as SPAM'
When a message has been judged to be spam, the filter
return a status code of 556 to the upstream process, and
appends this message.
downstream <host>:<port>
Required. The host and portnumber of the 'downstream'
server.
If a message is judged to acceptable, it is passed on to
another (probably postfix) process. 'downstream' specifies
the host and port number of that process, in the form
'host:portnumber'. 'host' may be a hostname, 'localhost',
or an IP address. 'port' must be a numeric port number.
force_hostname <hostname>
Optional; defaults to the host's fully qualified domain
name. ´force_hostname´ substitutes the specified string
for the hostname in any headers the filter adds to the
message. (Currently, only one header is added, an ´accep
tance´ header, if the message is judged not to be spam.)
force_domainname <domain-name>
Optional; defaults to the host's DNS domain name.
When a ´rcpt to:´ command is received, and a user-hash
exists, the filter will append the hosts domain to user
names which are not fully qualified before looking up the
name in the user-hash. ´force_domainname´ will cause the
specified string to be appended, instead.
guess <number>
Optional; defaults to 0.4
This supplies a probability to any word found in a message
which cannot be found in the probability hash. Valid val
ues are in the range 0 .. 1.0
logfile <pathname>
Required. Normally, will be the same logfile used by post
fix.
loglevel <name>
Optional; defaults to "INFO".
Valid values are, in order of decreasing severity,
"EMERG", "ALERT", "CRIT", "ERROR", "WARNING", "NOTICE",
"INFO", and "DEBUG".
number_to_consider <integer>
Optional; defaults to 100
When all words in a message have been assigned a proba
bilty, the probabilities are sorted according to the abso
lute value of their difference from 0.5; ´number_to_con
sider´ is the number of the highest-ranking probabilities
to use in the calculation of "spam probability". Low
values for number_to_consider may result in unreliable
judgements; high values impose a slightly higher cpu load.
postfix_listen <portnumber>
Required. The internet-domain port to listen on for con
nections from an upstream postfix process.
probabilityhash <filename>
Required. This is the name of the probability hash (or
more usually, the symbolic link to it) produced by
´make_new_database´. Only a simple filename is required;
the directory is supplied by ´spamdatadir´.
spamdatadir <directory>
Required. The directory containing the probability hash
and the optional username hash.
spamlimit <number>
Optional; defaults to 0.999
The value which the estimated spam probability must exceed
before being condemned and rejected as spam. Valid values
are in the range 0 .. 1.0
user <username | userid>
Optional; defaults to the userid of the process running
the filter.
If found, the filter will setuid to this user before
entering the milter library code. May be a username or
user ID.
username_db <filename>
Optional; the user ´opt-in´ database; no default.
If no username hash is specified, the filter will be used
on all messages, regardless of recipient.
If one is specified, filtering will be done only for mes
sages destined for names found in the hash.
Only a simple filename must be specified; the directory is
specified by ´spamdatadir´. as the probability hash,
POSTFIX CONFIGURATION
The matching postfix configuration is done in two files:
master.cf and main.cf. Assuming that everything is on one
host, that our filter listens on port 10025, and connects
to the downstream postfix process on port 10026, then:
In main.cf, there sould be a line like:
content_filter = smtp:localhost:10025
and in master.cf, an entry like:
localhost:10026 inet n - n - 10 smtpd
-o content_filter=
-o local_recipient_maps=
-o myhostname=
ENVIRONMENT
$SPAMCONFIG can be used to supply the full pathname of the
configuration file. (The ´-c config-file´ option will
override $SPAMCONFIG)
FILES
Required: a configuration file and a probability hash
Optional(but recommended): a username hash
COPYRIGHT
Copyright (c) 2002, J.B.Ward
<bward2@users.sourceforge.net>
Expaminator Nov.22,2002 postfix_bayes(8)