|
Requirements
Sendmail (version 8.10.1 or above), including the "libmilter" library, must
be built before the filter program can be compiled. Information on building
Sendmail and libmilter, so that the Mail Filter API is available, is
distributed with Sendmail in the
file "sendmail-8.1N.N/libmilter/README". Please
read the relevant parts of that file first.
Installing the Filter
- Download the "tar" file or the "gzipped tar" file appropriate to the
version of Sendmail that you are running. Save the file in a convenient
directory outside the Sendmail source directory tree.
- Unzip and uncompress the tar archive, e.g.:
% gunzip rays-filter-1.NN.tar.gz
% tar xvf rays-filter-1.NN.tar
This should create a subdirectory
called rays-filter-1.NN which contains the following
files. The ones marked with "*" are required to produce a
working filter:
Shell scripts * |
build
mail-filter
mf-reset
mf-start
mf-stop
|
C source files * |
rays-filter.c
rays-filter.h
|
Configuration files * |
header_list.conf
mail-filter.conf
string_list.conf
|
Utilities |
mf-archive
mf-analyze
mf-memory
|
Documentation (HTML) |
rays-filter.html
install.html
configure.html
operate.html
utilities.html
|
Licence & Copyright |
README
GNU-public-licence.txt
copyright.txt
|
- Make the following changes to the files as required:
build
|
This is just a handy script to save having to type out the whole
command line when you want to compile rays-filter.c.
Edit the following values as required:-
SRCDIR should equal the absolute path to your sendmail
source directory, e.g.
SRCDIR=/usr/local/src/sendmail/sendmail-8.11.0
OBJDIR should be the location, relative to SRCDIR, of
the platform-specific object directory which is created when you build
sendmail, e.g.
OBJDIR=obj.OSF1.V4.0.alpha
Depending on your operating system and/or C compiler, you may also
have to modify the compiler command (e.g. gcc instead of cc)
and/or some of the compiler options. See the
file libmilter/README (distributed with Sendmail) for more
information.
|
mail-filter.conf
|
The WORK_DIR variable specifies the directory that you
wish the filter to use as its working directory. This directory
must be created before the filter program is started. It will
contain the log files produced by the scripts and utilities, and
the rejects subdirectory, where the rejected messages
will be saved. E.g.:
WORK_DIR="/users/mf-user/mail-filter"
The SOCKET variable specifies the socket that you want
the mail filter to create and use to communicate with Sendmail.
The socket can be a local file or an internet port. The way
that sockets are specified varies between different
versions of Sendmail. Refer to the
file libmilter/README, distributed with Sendmail, for
the various socket options. (See also the table of
known bugs). If a
local file socket is specified,the user who will run the filter
must have read, write and execute access to the directory where
it will reside. E.g.:
SOCKET="local:/users/mf-user/mail-filter/mf-socket"
|
header-list.conf
string-list.conf
|
These configuration files specify the criteria by which the filter will
accept or reject messages. These files can be edited at any time, even
while the filter is running. See the
Configuration Page for details.
|
rays-filter.h
|
The text part of the
SMTP reply can be specified
in this file if you don't want to use the default message. Other
parameters can also be changed. See the comments in the file for details.
|
- Compile and link the program using the build script (or the
command line given in the libmilter/README file referred to above):
% ./build rays-filter
If successful, this will produce a binary file, rays-filter.
- Copy the following files into /usr/local/bin:-
rays-filter
mail-filter
mf-reset
mf-start
mf-stop
If you wish to use the utilities, then also
copy the following files:-
mf-analyze
mf-archive
mf-memory
Ensure that the user who will run the filter has read and execute rights to
these files. (The filter does not have to be run by root - however, see the
remarks about sockets in the table of
known bugs.)
- Create the directory /usr/local/etc/mail-filter, and copy the
following files into it:-
header-list.conf
mail-filter.conf
string-list.conf
Ensure that the user who will run the filter has read and write privileges to
these files.
- Create the filter's working directory, as specified
in mail-filter.conf. Within this directory, create a
sub-directory called rejects. If you intend to use the
Analysis Utility, then
also create a subdirectory called analysis, i.e.
% mkdir WORK_DIR
% mkdir WORK_DIR/rejects
% mkdir WORK_DIR/analysis
where WORK_DIR is the value of the WORK_DIR variable
specified in mail-filter.conf. Ensure that the user who will run the
filter has read, write and execute privileges in all of these directories.
- At this point the filter can be started and stopped, as described in the
Operation Page to make sure it will run and
make entries in its log file, mail-filter.log, and the system log
file. However, it will not actually filter any messages until references
to it are added to the Sendmail configuration file, sendmail.cf.
- Insert the following lines into sendmail.cf,
after the definitions of mail delivery agents (lines beginning
M...)
Xrays-filter, S=local:/users/mf-user/mail-filter/mf-socket, F=R, T=S:60s;R:60s;E:5m
O InputMailFilters=rays-filter
Note that the socket specification, "S=...", must match
the SOCKET specified in mail-filter.conf. Please see the
file distributed with Sendmail, libmilter/README, for information
about the "F=..." and "T=..." parameters.
- Shut down sendmail.
- Start the filter:
% /usr/local/bin/mail-filter start
- Re-start sendmail.
- Check the system log files to verify that Sendmail and the filter are
both functioning correctly.
Ray's Mail Filter Home Page
Filter Configuration
Running the Filter
Utilities
butlerra@sbu.ac.uk
08 March 2001
|