General-Purpose Mail Filter
This chapter contains a detailed list of steps you need to undertake in order to configure and build the package.
mailfromd you will need to have following
packages on your machine:
GNU mailutils is a general-purpose library for handling electronic mail. It is available from http://mailutils.org.
GNU adns is an advanced DNS client library. The recent version can be downloaded from http://www.chiark.greenend.org.uk/~ian/adns/adns.tar.gz. Visit http://www.gnu.org/software/adns, for more information.
Mailfromdis able to link with any flavor of DBM supported by GNU mailutils. As of version 8.11 it will refuse to build without DBM. By default,
configurewill try to find the best implementation installed on your machine (preference is given to Berkeley DB) and will use it. You can, however, explicitly specify which implementation you want to use. To do so, use the --with-dbm configure option. Its argument specifies the type of database to use. It must be one of the types supported by GNU mailutils. At the time of this writing, these are:
Berkeley DB (versions 2 to 6).
To check what database types are supported by your version of mailutils, run the following command:
$ mailutils dbd gdbm kc tc ndbm
For backward compatibility,
configure accepts the following
Same as --with-dbm=gdbm.
Same as --with-dbm=bdb.
Sendmail users, it often makes sense to configure
mailfromd to use the same database flavor as
The following table will help you do that. The column ‘DB type’ lists
types of DBM databases supported by
The column ‘confMAPDEF’ lists the value of
configuration macro corresponding to that database type. The column
‘configure option’ contains the corresponding option to configure.
|DB type||confMAPDEF||configure option|
After startup, the program drops root privileges. By default,
it switches to the privileges of user ‘mail’, group ‘mail’.
If there is no such user on your system, or you wish to use another
user account for this purpose, override it using DEFAULT_USER
environment variable. For example for
mailfromd to run as
user ‘nobody’, use
The user name can also be changed at run-time (see --user).
mailfromdand where its filter script and data files will be located.
As usual, the default value for the installation prefix is /usr/local. If it does not suit you, specify another location using --prefix option, e.g.: ‘--prefix=/usr’.
During installation phase, the build system will install several files. These files are:
Main daemon. See mailfromd.
Default main filter script file. It is installed only if it is
not already there. Thus, if you are upgrading to a newer version of
mailfromd, your old script file will be preserved
with all your changes.
See MFL, for a description of the mail filtering language.
MFL modules. See Modules.
MTA simulator program for testing
scripts. See mtasim.
Pmilter multiplexor for
MeTA1. See pmult.
It is build only if
MeTA1 version ‘PreAlpha29.0’ or
newer is installed on the system. You may disable it by using the
--disable-pmilter command line option.
When testing for
its default location. If it is not found there, inform
configure about its actual location by using the following
where prefix stands for the
MeTA1 installation prefix.
It is advisable to use the same settings for file name prefixes
as those you used when configuring
mailutils. In particular,
try to use the same --sysconfdir, since it will facilitate
configuring the whole system.
Another important point is location of local state
directory, i.e. a directory where
mailfromd keeps its
data files (e.g. communication socket, PID-file and database
files). By default, its full name is
localstatedir/mailfromd. You can change it by setting
DEFAULT_STATE_DIR configuration variable. This value can be
changed at run-time using the
statement (see state-directory).
Milterport notation (see milter port specification). If the socket name does not begin with a protocol or directory separator, it is assumed to be a UNIX socket, located in the local state directory. The default value is mailfrom, which is equivalent to unix:localstatedir/mailfromd/mailfrom.
To alter this, use
DEFAULT_SOCKET environment variable, e.g.:
The communication socket can be changed at run time using
--port command line option (see --port) or the
listen configuration statement (see listen).
mailfromddatabase is considered valid. It is described in more detail in Databases. The default value is 86400 seconds, i.e. 24 hours. It is OK for most sites. If, however, you wish to change it, use DEFAULT_EXPIRE_INTERVAL environment variable.
DEFAULT_EXPIRE_RATES_INTERVAL variable sets default expiration time for mail rate database (see Rate limiting functions).
Expiration settings can be changed at run time using
database statement in the
mailfromd configuration file
syslogimplementation to use.
syslog for diagnostics output. The
syslog implementation on most systems (most notably, on
GNU/Linux) uses blocking
AF_UNIX SOCK_DGRAM sockets. As a
result, when an application calls
syslogd is not responding and the socket buffers get full,
the application will hang.
mailfromd, as for any daemon, it is more important
that it continue to run, than that it continue to log. For this
mailfromd is shipped with a non-blocking
syslog implementation by Simon Kelley. This implementation,
instead of blocking, buffers log lines in memory. When the buffer log
overflows, some lines are lost, but the daemon continues to run. When
lines are lost, this fact is logged with a message of the form:
async_syslog overflow: 5 log entries lost
To enable this implementation, configure the package with --enable-syslog-async option, e.g.:
Additionally, you can instruct
mailfromd to use
asynchronous syslog by default. To do so, set
DEFAULT_SYSLOG_ASYNC to 1, as shown in example below:
./configure --enable-syslog-async DEFAULT_SYSLOG_ASYNC=1
You will be able to override these defaults at run-time by using the --logger command line option (see Logging and Debugging).
configurewith all the desired options.
For example, the following command:
./configure DEFAULT_SOCKET=inet:999@localhost --with-berkeley-db=3
will configure the package to use Berkeley DB database, version 2, and ‘inet:999@localhost’ as the default communication socket.
At the end of its run
configure will print a concise
summary of its configuration settings. It looks like that (with the
long lines being split for readability):
******************************************************************* Mailfromd configured with the following settings: External preprocessor..................... /usr/bin/m4 -s DBM version............................... Berkeley DB v. 3 Default user.............................. mail State directory........................... $(localstatedir)/$(PACKAGE) Socket.................................... mailfrom Expiration interval....................... 86400 Negative DNS answer expiration interval... 3600 Rates expire interval..................... 300 Default syslog implementation............. blocking Readline (for mtasim)..................... yes Documentation rendition type.............. PROOF Enable pmilter support.................... no Enable GeoIP support...................... no *******************************************************************
Make sure these settings satisfy your needs. If they do not, reconfigure the package with the right options.
This document was generated on May 26, 2021 using makeinfo.Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.