standard for signing and verifying e-mail messages on a per-domain basis.
interface, originally distributed as part of version 8.11 of
to provide DKIM signing and/or verifying service for mail transiting
a milter-aware MTA.
Most, if not all, of the command line options listed below can also be set
using a configuration file. See the
option for details.
Identifies a file of "peers" which identifies clients whose connections
should be accepted without processing by this filter. The
should contain on each line a hostname, domain name (e.g. ".example.com"),
IP address, an IPv6 address (including an IPv4 mapped address), or a
CIDR-style IP specification (e.g. "192.168.1.0/24"). An entry beginning
with a bang ("!") character means "not", allowing exclusions of specific
hosts that are otherwise members of larger sets. The order of entries
in this file is therefore significant.
Automatically re-start on failures. Use with caution; if the filter
fails instantly after it starts, this can cause a tight
loop. This can be mitigated using some values in the configuration file
to limit restarting. See
Selects operating modes.
is a concatenation of characters that indicate which mode(s) of operation
are desired. Valid modes are
(verifier). The default is
except in test mode (see
below) in which case the default is
Selects the canonicalization method(s) to be used when signing messages.
When verifying, the message's DKIM-Signature: header specifies
the canonicalization method. The recognized values are
as defined by the DKIM specification. The default is
The value may include two different canonicalizations separated by a
slash ("/") character, in which case the first will be applied to the
headers and the second to the body.
Configuration control. See the CONFIGURATION section for details.
-d domain [,...]
A comma-separated list of domains whose mail should be signed by this
filter. Mail from other domains will be verified rather than being signed.
The value of this parameter may also be a filename from which domain names
will be read. The "#" character in such a file is assumed to indicate a
comment. An absolute path must be used (i.e. the first character must be
In either case, the domain name(s) may contain the special character "*"
which is treated as a wildcard character matching zero or more characters
in a domain name.
Matching is case-insensitive.
This parameter is not required if
is in use; in that case, the list of signed domains is implied by the
lines in the key file.
Sign subdomains of those listed by the
option as well as the actual domains.
forks and exits immediately, leaving the service running in the background.
This flag suppresses that behaviour so that it runs in the foreground.
Specifies a fixed time to use when generating signatures. Ignored unless
also used in conjunction with
(see below). The time must be expressed in the usual UNIX
(seconds since epoch) format.
to add a header indicating the presence of this filter in the path of
the message from injection to delivery. The product's name, version, and
the job ID are included in the header's contents.
Identifies a file of internal hosts whose mail should be signed rather
than verified. Entries in this file follow the same form as those of
option above. If not specified, the default of "127.0.0.1" is applied.
Naturally, providing a value here overrides the default, so if mail from
127.0.0.1 should be signed, the list provided here should include that
Identifies a file of "external" hosts which may send mail through the server
as one of the signing domains without credentials as such. Basically
suppresses the "external host (hostname) tried to send mail as (domain)"
log messages. Entries in the
file should be of the same form as those of the
option above. The list is empty by default.
Requests multiple-key processing. See also
gives the location of a PEM-formatted private key to be used for signing
all messages. With
gives the location of a file listing rules for signing with multiple keys.
In the latter mode, the
should contain a set of lines of the form
is a pattern to match against message senders (with the special character
"*" interpreted as "zero or more characters"),
is the domain to announce as the signing domain when generating signatures, and
is the path to the PEM-formatted private key to be used for signing messages
which match the
The selector used in the signature will be the filename portion of
If the file referenced by
cannot be opened, the filter will try again by appending ".pem"
and then ".private" before giving up.
Log via calls to
any interesting activity.
Instructs the verification code to fail messages for which a partial
signature was received. There are three possible formats:
indicating at least
bytes of the message must be signed (or if the message is smaller than
then all of it must be signed);
requiring that at least
percent of the received message must be signed; and
meaning there may be no more than
bytes of unsigned data appended to the message for it to be considered
A comma-separated list of MTA names (a la the
DaemonPortOptions Name parameter) whose mail should be signed by this
filter. If not set, the MTA name is not used when deciding whether or not
a message should be signed.
Defines a set of MTA-provided
which should be checked to see if the sender has been determined to be a
local user and therefore whether or not the message should be signed. If a
is specified, the value of the macro must match the value specified
(matching is case-insensitive), otherwise the macro must be defined
but may contain any value. Multiple tests may be specified, separated
by commas. The set is empty by default, meaning macros are not used when
deciding whether or not a message should be signed.
The general format of the string is
where a "test" is of the form
if one or more value is defined then the macro must be set to one of the
listed values, otherwise the macro must be set but can contain any
Parse the configuration file and command line arguments, reporting any
errors found, and then exit. The exit value will be 0 if the filter would
start up without complaint, or non-zero otherwise.
Specifies a list of headers which should be omitted when generating
should be a comma-separated list of header names. If an entry in the list
names any header which is mandated by the DKIM specification, the entry
is ignored. A set of headers is listed in the DKIM specification as
"SHOULD NOT" be signed; the default list for this parameter contains those
headers (Return-Path, Received, Comments, Keywords, Bcc, Resent-Bcc and
DKIM-Signature). To omit no headers, simply use the string "-" (or any
string which will match no headers).
Specifies the socket that should be established by the filter to receive
in order to provide service.
is in one of two forms:
which creates a UNIX domain socket at the specified
which creates a TCP socket on the specified
is not given as either a hostname or an IP address, the socket will be
listening on all interfaces. If neither socket type is specified,
is assumed, meaning the parameter is interpreted as a path at which
the socket should be created. This parameter is mandatory.
Writes the process ID of the filter, once started, to the filename given.
Requests that messages which fail verification be quarantined by the
MTA. (Requires a sufficiently recent version of the milter library.)
Checks all messages for compliance with RFC2822 header count requirements.
Non-compliant messages are rejected.
When a signature verification fails and the signing site advertises a
reporting address (i.e.
in its policy record), send a structured report to that address containing
details needed to reproduce the problem.
Defines the name of the selector to be used when signing messages.
specification for details.
Selects the signing algorithm to use when generating signatures.
If the filter was compiled against version 0.9.8 or later of
are available and the latter is the default. Otherwise, only the former
is available and it is (obviously) the default.
Evaluates (verifies) an RFC2822-formatted message found in
and exits. The value of
may be "-" if the message should be read from standard input.
Sets the DNS timeout in seconds. A value of 0 causes an infinite wait.
The default is 5. Ignored if not using the asynchronous resolver package.
See also the NOTES section below.
Attempts to be come the specified
before starting operations. The process will be assigned all of the groups
and primary group ID of the named
unless an alternate
Requests that the filter consult a POP authentication database for IP
addresses that should be allowed for signing. The filter must be specially
compiled to enable this feature, since it adds a library dependency.
Increase verbose output during test mode (see
above). May be specified more than once to request increasing amounts of
Print the version number and supported canonicalization and signature
algorithms, and then exit without doing anything else.
If logging is enabled (see
above), issues very detailed logging about the logic behind the filter's
decision to either sign a message or verify it. The "W" stands for "Why?!"
since the logic behind the decision is non-trivial and can be confusing to
administrators not familiar with its operation. A description of how
the decision is made can be found in the OPERATION section of this
document. This causes a large increase in the amount of log data generated
for each message, so it should be limited to debugging use and not enabled
for general operation.
Read the named configuration file. See the
man page for details. Values in the configuration file are overridden
when their equivalents are provided on the command line until a configuration
reload occurs. The OPERATION section describes how reloads are triggered.
The value of the
switch is a comma-separated list of settings of the form
which defines what the filter should do with messages that produce
certain results. Each result and each action has a full name and an
abbreviated name. Either is accepted. Below, the abbreviated name appears
(bad) the signature found in the message did not verify successfully
against the message;
(dns) an error was encountered attempting to retrieve a public key from
(int) an internal error occurred;
(no) no signature was present on the message;
(sec) the message tripped internal security concerns (e.g. unusually large
header blocks). There is also a special result called
(def) whose action is copied onto all of the other results.
(a) accept the message;
(d) discard the message;
(t) temp-fail the message;
(r) reject the message.
In the interests of minimal initial impact, the defaults for
and the default for the others is
Results and actions are processed in order, so use of the
action can be overridden by later specifications. For example, using
"def=a,int=t" sets all result actions to "accept" except for internal
errors which will generate a temporary failure.
A message will be verified unless it conforms to the signing criteria,
which are: (1) the domain on the From: address or Sender: address (if present)
must be listed by the
command line switch or the
configuration file setting, and (2) (a) the client connecting to the MTA must
have authenticated, or (b) the client connecting to the MTA must be listed in
the file referenced by the
command line switch (or be in the default list for that option), or (c)
the client must be connected to a daemon port named by the
command line switch, or (d) the MTA must have set one or more macros
matching the criteria set by the
command line switch.
When signing a message, a
header will be prepended to the message. The signature is computed using
the private key provided. You must be running a version of
recent enough to be able to do header prepend operations (8.13.0 or later).
When verifying a message, an
header will be prepended to indicate the presence of a signature and whether
or not it could be validated against the body of the message using the
public key advertised by the sender's nameserver. The value of this header
can be used by mail user agents to sort or discard messages that were not
signed or could not be verified.
Upon receiving SIGUSR1, if the filter was started with a configuration
file, it will be re-read and the new values used. Note that any
command line overrides provided at startup time will be lost when this is
done. Also, the following configuration file values (and their corresponding
command line items, if any) are not reloaded through this process:
UserID (-u). The filter does not automatically check the configuration
file for changes and reload.
The following environment variable(s) can be used to adjust the behaviour
of this filter:
The directory to use when creating temporary files. The default is
When using DNS timeouts (see the
option above), be sure not to use a timeout that is larger than the timeout
being used for interaction between
and the filter. Otherwise, the MTA could abort a message while waiting for
a reply from the filter, which in turn is still waiting for a DNS reply.
The POP authentication database is expected to be a Sleepycat DB file
(formerly known as a Berkeley DB) in hash format with keys containing
the IP address in text form without a terminating NULL. The values of
these records are not checked; only the existence of such records is of
interest. The filter will attempt to establish a shared lock on the
database before reading from it, so any programs which write to the
database should keep their lock use to a minimum or else this filter
will appear to hang while waiting for the lock operation to complete.
Features that involve specification of IPv4 addresses or CIDR blocks
will use the
function to parse that information. Users should be familiar with the
way that function handles the non-trivial cases (for example, "1.2.3/24"
and "22.214.171.124/24" are not the same thing).
DKIM is an amalgam of Yahoo!'s
proposal, and Cisco's
Internet Identified Mail
This man page covers version 2.8.0 of
Copyright (c) 2005-2008, Sendmail, Inc. and its suppliers. All rights