DKIM

Introduction

DKIM is an authentication framework which stores public-keys in DNS and digitally signs emails on a domain basis.

Overview

A domain owner generates a private/public key-pairs that will be used to sign messages originating from that domain. The public-key is placed in DNS as a TXT record. The private-key is kept on the mail server which sends email for the domain.

When an email is submitted by an authorized user of that domain, dkim-milter uses the private-key to digitally sign the email associated with the sending domain. The DKIM-Signature header and signature is added to the email and the message is sent.

When a message is received with a DKIM-Signature header, dkim-milter extracts the signature and the sender's domain from the email. It does a DNS lookup on the TXT record to fetch the public-key for the sender's domain. Using the public-key, dkim-milter verifies whether the signature of the email is valid. An Authentication-Results: dkim=pass header is inserted in the email if the verification is successful.

Selectors

Selectors allows a domain to have more than one public-key in DNS. This allows you to administer and change the public-keys advertized in DNS. If the selector is test and the domain is example.com, the public-key will be retrieved from test._domainkey.example.com. The name before _domainkey is the selector.

Dkim-milter does not have default selector. If you are signing mail, you should specify a selector.

Canonicalization

Mail servers sometimes modify email in transit. This can invalidate the domainkeys signature. dkim-milter supports two canonicalization algorithms. The simple algorithm tolerates almost no modification. The relaxed algorithm tolerates common modifications such as white-space replacement and header line re-wrapping.

The default canonicalization used by dkim-milter is simple.

Installation

The following installation guide is based upon sendmail version 8.13.x. Sendmail version 8.14.x is recommended. The DKIM feature is implemented through a milter. The milter does not support any sendmail version prior to 8.13.x.

Prerequisites

You should be able to modify the DNS records for your domain.

You should have a OpenSSL library (version 0.9.8 or higher) installed.

You should have sendmail 8.13.x or higher installed.

Installing the DKIM milter

Download the source code for the sendmail DKIM milter from http://sourceforge.net/projects/dkim-milter/

The following steps are for dkim-milter 0.7.0 and higher:

  • Extract the files from the downloaded dkim-milter file
  • Copy the site.config.m4.dist file to devtools/Site/site.config.m4 and edit it as follows:

    dnl Build options for dkim-milter package
    dnl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    dnl Any options you set here are applied to all subdirectories of this
    dnl build. Also, you may override or augment the defaults of any of the
    dnl values described in devtools/README by setting your preferred values
    dnl in this file.

    dnl Debug binary
    dnl
    dnl If you are encountering coredumps and want to be able to analyze them
    dnl using something like "gdb", enable this next line by deleting the "dnl"
    dnl at the front of it.
    dnl define(`confOPTIMIZE', `-g')

    dnl Shared library for libdkim
    dnl
    dnl If you want libdkim to be built as a shared object library in addition
    dnl to a static library, enable this next line by deleting the "dnl" at the
    dnl front of it.
    dnl define(`bld_LIBDKIM_SHARED', `true')

    dnl Installation for libdkim and dkim.h
    dnl
    dnl If you want libdkim and dkim.h to be installed when you install
    dnl the package, enable this next line by deleting the "dnl" at the front
    dnl of it. This is done automatically if you've requested the shared
    dnl library.
    dnl define(`bld_LIBDKIM_INSTALL', `true')

    dnl Faster strtoul()/strtoull() implementations
    dnl
    dnl Some vendor implementations of strtoul() and strtoull() are slow.
    dnl A version has been contributed which optimizes away the slow bits.
    dnl If you'd like to use it, enable this next line by deleting the "dnl"
    dnl at the front of it.
    dnl APPENDDEF(`confENVDEF', `-DNEED_FAST_STRTOUL')

    dnl libar -- asynchronous resolver library
    dnl
    dnl If you want to use the asynchronous resolver library, enable this
    dnl next line by deleting the "dnl" at the front of it.
    dnl define(`bld_USE_ARLIB', `true')
    dnl
    dnl libar normally uses res_init() or res_ninit() to load the contents
    dnl of resolv.conf for its use. If neither of these work on your system
    dnl in multi-threaded programs (e.g. OpenBSD 3.7 and later), then you
    dnl may need to enable code that parses that file manually. This will
    dnl also be required if you've got any IPv6 addresses in /etc/resolv.conf.
    dnl In that case, enable this next line by deleting the "dnl" at the front
    dnl of it.
    dnl APPENDDEF(`conf_libar_ENVDEF', `-DAR_RES_MANUAL')

    dnl POPAUTH -- POP-before-SMTP authentication
    dnl
    dnl If you use any POP-before-SMTP authentication, dkim-filter can
    dnl query that database to see if a client sending a message for signing
    dnl is legitimate, enable this next line by deleting the "dnl" at the
    dnl front of it. Also see the section below called "BerkeleyDB".
    dnl APPENDDEF(`conf_dkim_filter_ENVDEF', `-DPOPAUTH ')

    dnl QUERY_CACHE -- Query caching
    dnl
    dnl If you would like libdkim to maintain a cache of key and policy records
    dnl it has seen, rather than relying on the DNS server to provide caching,
    dnl enable this next line by deleting the "dnl" at the front of it. Also
    dnl see the section below called "BerkeleyDB".
    dnl APPENDDEF(`confENVDEF', `-DQUERY_CACHE ')

    dnl BerkeleyDB -- Berkeley DB ("Sleepycat") database
    dnl
    dnl Several optional features in this package need the Berkeley DB library.
    dnl These include: POPAUTH, QUERY_CACHE, _FFR_BODYLENGTH_DB, _FFR_STATS
    dnl
    dnl Sometimes this is built into your libc, but perhaps not, or perhaps
    dnl you have a newer version that you want to use. If that's the case,
    dnl edit the following lines as needed and enable the ones that apply
    dnl by deleting "dnl" from the front of them:
    dnl APPENDDEF(`confINCDIRS', `-I/usr/local/BerkeleyDB/include ')
    dnl APPENDDEF(`confLIBDIRS', `-L/usr/local/BerkeleyDB/lib ')
    dnl APPENDDEF(`confLIBS', `-ldb ')

    dnl OpenSSL -- cryptography library
    dnl
    dnl DKIM requires several algorithms provided by this library. You must
    dnl have v0.9.8 or later for SHA256 support. If necessary, enable these
    dnl lines by deleting "dnl" from the front of them and edit paths as needed.
    dnl APPENDDEF(`confINCDIRS', `-I/usr/local/ssl/include ')
    dnl APPENDDEF(`confLIBDIRS', `-L/usr/local/ssl/lib ')

    dnl TRE -- Approximate regular expression matching
    dnl
    dnl If you want to use the dkim_diffheaders() function, you also need
    dnl to have the "tre" library and its header files installed. If necessary,
    dnl enable these lines by deleting "dnl" from the front of them and edit
    dnl paths as needed.
    dnl APPENDDEF(`confINCDIRS', `-I/usr/local/include/tre ')
    dnl APPENDDEF(`confLIBDIRS', `-L/usr/local/lib/tre ')
    dnl APPENDDEF(`confLIBS', `-ltre ')

    dnl Code For Future Release (FFRs):
    dnl
    dnl See the FEATURES file for descriptions of the features available
    dnl as options. Many of these are untested and/or undocumented, so use
    dnl at your own risk. To enable one, delete "dnl" from the front of its
    dnl line.
    dnl
    APPENDDEF(`confENVDEF', `-D_FFR_ANTICIPATE_SENDMAIL_MUNGE ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_AUTHSERV_JOBID ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_BODYLENGTH_DB ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_CAPTURE_UNKNOWN_ERRORS ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_DIFFHEADERS ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_DNS_UPGRADE ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_PARSE_TIME ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_REPLACE_RULES ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_REQUIRED_HEADERS ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_SELECT_CANONICALIZATION ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_SELECTOR_HEADER ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_STATS ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_VBR ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_ZTAGS ')

    dnl DomainKeys -- Yahoo DomainKeys verification support
    dnl
    dnl If you also want to verify messages signed with DomainKeys, enable this
    dnl line by deleting "dnl" from the front of it. See also the README as it
    dnl requires an additional library not included in this package.
    dnl define(`bld_VERIFY_DOMAINKEYS', `true')

    dnl libmilter -- Sendmail's milter library
    dnl
    dnl This must be in the search rules for your compile. If necessary,
    dnl adjust the paths below and enable the lines by deleting "dnl" from the
    dnl front of them.
    dnl APPENDDEF(`bld_dkim_filter_INCDIRS', `-I/usr/local/sendmail/include')
    dnl APPENDDEF(`bld_dkim_filter_LIBDIRS', `-L/usr/local/sendmail/lib')

    dnl smfi_addheader() -- older versions of libmilter
    dnl
    dnl If you run a version of libmilter too old to have the smfi_insheader()
    dnl primitive, you can enable this to have dkim-filter use smfi_addheader()
    dnl instead. It will still work, but it breaks the DKIM specification.
    dnl To enable this, remove the "dnl" from the front of the line.
    dnl APPENDDEF(`conf_dkim_filter_ENVDEF', `-DNO_SMFI_INSHEADER ')

    Follow the compiling steps.

If you are using a dkim-milter version prior to 0.7.0:

  • Extract the files from the downloaded dkim-milter file
  • Edit the dkim-filter/Makefile.m4 as follows:

    include(confBUILDTOOLSDIR`/M4/switch.m4')

    define(`confMT', `TRUE')
    define(`confREQUIRE_LIBSM', `true')

    APPENDDEF(`confLIBS', `-lssl -lcrypto ')
    dnl Enable and edit these paths as needed:
    dnl APPENDDEF(`confINCDIRS', `-I/usr/local/ssl/include ')
    dnl APPENDDEF(`confLIBDIRS', `-L/usr/local/ssl/lib ')

    dnl For _FFR_QUERY_CACHE or POPAUTH, enable and edit these as needed:
    dnl APPENDDEF(`confINCDIRS', `-I/usr/local/BerkeleyDB/include ')
    dnl APPENDDEF(`confLIBDIRS', `-L/usr/local/BerkeleyDB/lib ')
    dnl APPENDDEF(`confLIBS', `-ldb ')

    dnl If you want to do POP before SMTP:
    dnl APPENDDEF(`confENVDEF', `-DPOPAUTH ')

    dnl To use the asynchronous resolver library provided, enable this line:
    dnl bldPUSH_SMLIB(`ar')

    bldPUSH_SMLIB(`dkim')
    APPENDDEF(`confINCDIRS', `-I../libdkim/ ')

    dnl If you also want to verify messages signed with DomainKeys,
    dnl enable these lines. See also the README as it requires an additional
    dnl library not included in this package.
    dnl APPENDDEF(`confENVDEF', `-DVERIFY_DOMAINKEYS ')
    dnl bldPUSH_SMLIB(`dk')
    dnl APPENDDEF(`confINCDIRS', `-I../libdk/ ')

    bldPUSH_SMLIB(`sm')

    dnl Enable these next line if needed to specify the locations of libmilter.a
    dnl and the libmilter include files:
    dnl APPENDDEF(`confINCDIRS', `-I/usr/local/sendmail/include')
    dnl APPENDDEF(`confLIBDIRS', `-L/usr/local/sendmail/lib')

    dnl Enable for IPv6 support:
    dnl APPENDDEF(`confENVDEF', `-DNETINET6 ')

    dnl Compile time options, especially FFRs:
    dnl APPENDDEF(`confENVDEF', `-DNO_SMFI_INSHEADER ')

    dnl APPENDDEF(`confENVDEF', `-D_FFR_ALLMAN_SSP_02 ')
    APPENDDEF(`confENVDEF', `-D_FFR_ANTICIPATE_SENDMAIL_MUNGE ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_CAPTURE_UNKNOWN_ERRORS ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_FLUSH_HEADERS ')
    APPENDDEF(`confENVDEF', `-D_FFR_LOG_SSL_ERRORS ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_MULTIPLE_KEYS ')
    APPENDDEF(`confENVDEF', `-D_FFR_OMIT_HEADERS ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_QUARANTINE ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_QUERY_CACHE ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_REPORTINFO ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_REQUIRED_HEADERS ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_SELECT_CANONICALIZATION ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_SELECT_SIGN_HEADERS ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_SET_DNS_CALLBACK ')
    APPENDDEF(`confENVDEF', `-D_FFR_SET_REPLY ')
    dnl APPENDDEF(`confENVDEF', `-D_FFR_VBR ')

    bldPRODUCT_START(`executable', `dkim-filter')
    define(`bldSOURCES', `config.c dkim-filter.c util.c ')
    PREPENDDEF(`confLIBS', ifelse(index(confENVDEF, `-DCOMMERCIAL'), -1, `-lmilter ', `../libmilter/libmilter.a '))
    bldPRODUCT_END

    bldPRODUCT_START(`manpage', `dkim-filter')
    define(`bldSOURCES', `dkim-filter.8')
    bldPRODUCT_END

    bldFINISH

Compiling

Do not enable _FFR_ANTICIPATE_SENDMAIL_MUNGE if you are running sendmail 8.14.x or Postfix.

  • Change the current directory to directory where dkim-milter was extracted.
  • Enter the following command:

    sh Build

  • If there are no errors, you may continue with the installation.
  • Enter the following command:

    sh Build install

Compiling DKIM-milter for Postfix

The recommended Postfix version is 2.5.x. Compile dkim-milter with sendmail 8.14.x and set the milter_protocol to 6 in your Postfix configuration file.

Generating a public and private key

DKIM requires a public and private key. The private key should be saved in a safe location on your server. The public key will used in the DNS TXT record for DKIM.

  • Enter the following command to generate your private key:

    openssl genrsa -out rsa.private 1024

  • Enter the following command to generate your public key:
  • openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM

  • Move your private key to the domainkeys directory and rename it to mail.key.pem using the following command:

    mv rsa.private /var/db/domainkeys/mail.key.pem

    mail is the selector name in our example.

DNS TXT record for DKIM

Create a DNS TXT record for selector._domainkey.example.com as follows:

mail._domainkey.example.com. IN TXT "k=rsa; t=y; p=MEwwPQRJKoZIhvcNADAQCQADOwAwOAIxANPpYHdE2tevfEpvL1Tk2dDYv0pF28/f5MxU83x/0b sn4R4p7waPaz1IbOGs/6bm5QIDAQAB"

The string after p= is the base64 encoding of your public key.

If the rsa.public file which was generated contains

-----BEGIN PUBLIC KEY-----
MEwwPQRJKoZIhvcNADAQCQADOwAwOAIxANPpYHdE2tevfEpvL1Tk2dDYv0pF28/f 5MxU83x/0bsn4R4p7waPaz1IbOGs/6bm5QIDAQAB
-----END PUBLIC KEY-----

the base64 encoding is everything between the first ----- BEGIN PUBLIC KEY----- and -----END PUBLIC KEY----- lines. You should remove any spaces and newlines.

The t=y value pair means that the domain is using this key in test mode.

Starting DKIM-milter

The milter runs as a daemon in the background. If you are starting the milter as root, you should create an unprivileged user for the milter.

  • Create a system user called dkim, for example. This user should not be assigned a login shell.
  • Enter the following command to start the DKIM milter:

    /usr/bin/dkim-filter -l -p inet:8891@localhost -c simple -d example.com -s /var/db/dkim/mail.key.pem -S mail -u dkim -m MSA

    In the above example, all mail submitted through MSA (tcp port 587) with a sending domain of example.com will be signed by dk-filter using the simple canonicalization algorithm.

    The following example will sign mail for two domains:

    /usr/bin/dkim-filter -l -p inet:8891@localhost -c simple -d example.com,example.net -s /var/db/dkim/mail.key.pem -S mail -u dkim -m MSA

    Note: If you are running dkim-milter 0.3.0 or higher, the command to start the milter is:

    /usr/bin/dkim-filter -l -p inet:8891@localhost -c simple -d example.com -k /var/db/dkim/mail.key.pem -s mail -u dkim -m MSA

    If you are running DKIM 0.6.0 or higher with SHA256 support, the command to start the milter is:

    /usr/bin/dkim-filter -l -p inet:8891@localhost -c simple -d example.com -k /var/db/dkim/mail.key.pem -s mail -S rsa-sha256 -u dkim -m MSA

    Newer versions of dkim-milter can read the configuration from a file. Create a configuration file (dkim.conf for example) with the following contents:

    Canonicalization simple
    Domain example.com
    KeyFile /var/db/dkim/mail.key.pem
    MTA MSA
    Selector mail
    SignatureAlgorithm rsa-sha256
    Socket inet:8891@localhost
    Syslog Yes
    Userid dkim
    Version ietf-base-10

    and start the milter with:

    /usr/bin/dkim-filter -x dkim.conf

    Note: the Version setting should not be used with dkim-milter 1.0

Configuring sendmail with DKIM-milter

  • Edit the .mc configuration file that was used to build the sendmail.cf and add the following entry to it

INPUT_MAIL_FILTER(`dkim-filter', `S=inet:8891@localhost')

 

DKIM Author Domain Signing Practices

A DKIM Author Signing Practice lookup is done by the verifier to determine whether it should expect email with the From: address to be signed.

The Sender Signing Practice is published with a DNS TXT record as follows:

_adsp._domainkey.example.com. IN TXT "dkim=unknown"

The dkim tag denotes the outbound signing Practice. unknown means that the example.com domain may sign some emails.

You may decide to consider ASP as optional until the specifications are formalised.

Testing DKIM

You can perform a DKIM test by sending an email to autorespond+dkim@dk.elandsys.com.

The email address specified as the (envelope) sender, and not the author (From:), will receive the reply. If you do not receive a reply, it is likely that your mail server rejected the mail sent by our autoresponder.

This is an example of a signature header signed according to the standard (RFC 4871) with the SHA256 algorithm:

DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=example.net;
        s=mail; t=1172780279; bh=fdkeB/A0FkbVP2k4J4pNPoeWH6vqBm9+b0C3OY87Cw
        8=; h=DomainKey-Signature:Message-Id:X-Mailer:Date:To:From:Subject:
        Mime-Version:Content-Type; b=RvOV/N8wzWP36/W4KoMHYzmI4hCPDd1B+zwvH
        KAkT9Zuhpsylu0b8EKbuySVE7uNmb/+vzKcKvZtujs/5ywsfEkYa4MHwrh9Bt3lS91m
        ir8LC34e/vlsTYNXdf6jLaBEWSP4zBIozFSAARi/hsWlceEa93QnXiVA+ySBy/tdnbk
        =

The following formats were used prior to the publication of the standard. This header is an example of a SHA1 algorithm for the DKIM-Signature:

DKIM-Signature: a=rsa-sha1; c= simple/simple; d=example.com; s=mail; t=1133630840; h=Received:
         Date:Message-Id:From:To:Subject; b=c+whUn73dM6nvFUMLTzCug4IbskDZtKp
         v9FFk1DACg9zTADH60+2nIyuZCZwlPiL

The following header is an example of a SHA256 algorithm for the DKIM-Signature:

DKIM-Signature: a=rsa-sha256; c=simple/simple; d=example.net; s=mail;
         t=1146084277; bh=Mc3KzB+DuXADLu7r88jVCPK3VLXREvRc27ZqavHTKT8=;
         h=DomainKey-Signature:Received:Date:Message-Id:From:To:Subject;
         b=KZwq7bHE0EQW1iNP+oRRXVulNo4V90aIu1A5kegg2zsZMDe+AwiU0flO/KcIhf/Xmh53Oof6
         L92DBjB6Ieocm3ndSbpwV08umpixsClVnOsXw9GAUIATe44VgPMRacgQOxHn+YKBbJj41JOfw3
         hHNaQPphBTUUMT4LNiiJGy7s=

If the verification is successful, you should see the following header in your email:

Authentication-Results: mail.example.net; dkim=pass (1024-bit key) header.i=@dk.elandsys.com

A DKIM test for canonicalization relaxed can be performed by sending an email to autorespond+dkim-relaxed@dk.elandsys.com. Send an email to autorespond+dkim-simple@dk.elandsys.com to test simple canonicalization.

DKIM signature verification failures

DKIM uses the email headers and body to generate a signature. If the headers are rewritten or text is appended to the message body after it has been signed, the dkim verification fails.

DKIM Whitelist

We currently whitelist DKIM signed messages. Please send us an email or use the feedback link at the bottom of this webpage to contact us if you would like to have your domain whitelisted.

References

DomainKeys Identified Mail (DKIM) - RFC 4871
DKIM Author Domain Signing Practices (ADSP) - RFC 5617

DKIM-filter manual

NAME
dkim-filter - DKIM filter for sendmail

SYNOPSIS
dkim-filter -p socketspec [-a peerlist] [-A] [-b modes] [-c canon] [-C
config] [-d domains] [-D] [-f] [-F time] [-i ilist] [-I eilist] [-h]
[-k keyfile] [-K] [-l] [-L min] [-m mtas] [-M macro[=value][,...]] [-n]
[-o hdrlist] [-P pidfile] [-q] [-r] [-R] [-s selector] [-S signalg] [-t
testfile] [-T secs] [-u userid[:group]] [-U popdb] [-v] [-V] [-W] [-x
configfile]

DESCRIPTION
dkim-filter implements the DKIM standard for signing and verifying e-
mail messages on a per-domain basis.

dkim-filter uses the milter interface, originally distributed as part
of version 8.11 of sendmail(8), to provide DKIM signing and/or verify-
ing 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 -x option for details.

OPTIONS
-a peerlist
Identifies a file of "peers" which identifies clients whose con-
nections should be accepted without processing by this filter.
The peerlist 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 ("!") charac-
ter means "not", allowing exclusions of specific hosts that are
otherwise members of larger sets. The order of entries in this
file is therefore significant.

-A Automatically re-start on failures. Use with caution; if the
filter fails instantly after it starts, this can cause a tight
fork(2) loop. This can be mitigated using some values in the
configuration file to limit restarting. See dkim-fil-
ter.conf(5).

-b modes
Selects operating modes. modes is a concatenation of characters
that indicate which mode(s) of operation are desired. Valid
modes are s (signer) and v (verifier). The default is sv except
in test mode (see -t below) in which case the default is v.

-c canon
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 relaxed and simple as defined by the DKIM specification.
The default is simple. 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.

-C config
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 a "/").

In either case, the domain name(s) may contain the special char-
acter "*" 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 -K is in use; in that case,
the list of signed domains is implied by the lines in the key
file.

-D Sign subdomains of those listed by the -d option as well as the
actual domains.

-f Normally dkim-filter forks and exits immediately, leaving the
service running in the background. This flag suppresses that
behaviour so that it runs in the foreground.

-F time
Specifies a fixed time to use when generating signatures.
Ignored unless also used in conjunction with -t (see below).
The time must be expressed in the usual UNIX time_t (seconds
since epoch) format.

-h Causes dkim-filter to add a header indicating the presence of
this filter in the path of the message from injection to deliv-
ery. The product's name, version, and the job ID are included
in the header's contents.

-i ilist
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 the -a 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 address
explicitly.

-I eilist
Identifies a file of "external" hosts which may send mail
through the server as one of the signing domains without creden-
tials as such. Basically suppresses the "external host (host-
name) tried to send mail as (domain)" log messages. Entries in
the eilist file should be of the same form as those of the -a
option above. The list is empty by default.

-K Requests multiple-key processing. See also -k below.

-k keyfile
Without -K, gives the location of a PEM-formatted private key to
be used for signing all messages. With -K, gives the location
of a file listing rules for signing with multiple keys.

In the latter mode, the keyfile should contain a set of lines of
the form sender-pattern:signing-domain:keypath where sender-pat-
tern is a pattern to match against message senders (with the
special character "*" interpreted as "zero or more characters"),
signing-domain is the domain to announce as the signing domain
when generating signatures, and keypath is the path to the PEM-
formatted private key to be used for signing messages which
match the sender-pattern. The selector used in the signature
will be the filename portion of keypath.

If the file referenced by keypath cannot be opened, the filter
will try again by appending ".pem" and then ".private" before
giving up.

-l Log via calls to syslog(3) any interesting activity.

-L min[%+]
Instructs the verification code to fail messages for which a
partial signature was received. There are three possible for-
mats: min indicating at least min bytes of the message must be
signed (or if the message is smaller than min then all of it
must be signed); min% requiring that at least min percent of the
received message must be signed; and min+ meaning there may be
no more than min bytes of unsigned data appended to the message
for it to be considered valid.

-m mta[,...]
A comma-separated list of MTA names (a la the sendmail(8) Dae-
monPortOptions 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.

-M macro[=value][,...]
Defines a set of MTA-provided macros 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
value 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 mes-
sage should be signed.

The general format of the string is test1[,test2[,...]] where a
"test" is of the form macro[=value1[|value2[|...]]]; 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 value.

-n Parse the configuration file and command line arguments, report-
ing any errors found, and then exit. The exit value will be 0
if the filter would start up without complaint, or non-zero oth-
erwise.

-o hdrlist
Specifies a list of headers which should be omitted when gener-
ating signatures. hdrlist 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).

-p socketspec
Specifies the socket that should be established by the filter to
receive connections from sendmail(8) in order to provide ser-
vice. socketspec is in one of two forms: local:path which cre-
ates a UNIX domain socket at the specified path, or
inet:port[@host] which creates a TCP socket on the specified
port. If the host 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, local is assumed, meaning the
parameter is interpreted as a path at which the socket should be
created. This parameter is mandatory.

-P pidfile
Writes the process ID of the filter, once started, to the file-
name given.

-q Requests that messages which fail verification be quarantined by
the MTA. (Requires a sufficiently recent version of the milter
library.)

-r Checks all messages for compliance with RFC2822 header count
requirements. Non-compliant messages are rejected.

-R When a signature verification fails and the signing site adver-
tises a reporting address (i.e. r=user@host in its policy
record), send a structured report to that address containing
details needed to reproduce the problem.

-s selector
Defines the name of the selector to be used when signing mes-
sages. See the DKIM specification for details.

-S signalg
Selects the signing algorithm to use when generating signatures.
If the filter was compiled against version 0.9.8 or later of
OpenSSL then both rsa-sha1 and rsa-sha256 are available and the
latter is the default. Otherwise, only the former is available
and it is (obviously) the default.

-t testfile
Evaluates (verifies) an RFC2822-formatted message found in test-
file and exits. The value of testfile may be "-" if the message
should be read from standard input.

-T secs
Sets the DNS timeout in seconds. A value of 0 causes an infi-
nite wait. The default is 5. Ignored if not using the asyn-
chronous resolver package. See also the NOTES section below.

-u userid[:group]
Attempts to be come the specified userid before starting opera-
tions. The process will be assigned all of the groups and pri-
mary group ID of the named userid unless an alternate group is
specified.

-U popdb
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.

-v Increase verbose output during test mode (see -t above). May be
specified more than once to request increasing amounts of out-
put.

-V Print the version number and supported canonicalization and sig-
nature algorithms, and then exit without doing anything else.

-W If logging is enabled (see -l above), issues very detailed log-
ging 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 sec-
tion 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.

-x configfile
Read the named configuration file. See the dkim-filter.conf(5)
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.

ACTION CONFIGURATION
The value of the -C switch is a comma-separated list of settings of the
form result=action which defines what the filter should do with mes-
sages 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 in parentheses.

results
badsignature (bad) the signature found in the message did not
verify successfully against the message; dnserror (dns) an error
was encountered attempting to retrieve a public key from the
nameserver; internal (int) an internal error occurred; nosigna-
ture (no) no signature was present on the message; security
(sec) the message tripped internal security concerns (e.g.
unusually large header blocks). There is also a special result
called default (def) whose action is copied onto all of the
other results.

action accept (a) accept the message; discard (d) discard the message;
tempfail (t) temp-fail the message; reject (r) reject the mes-
sage.

In the interests of minimal initial impact, the defaults for badsigna-
ture and nosignature are accept, and the default for the others is
tempfail.

Results and actions are processed in order, so use of the default
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.

OPERATION
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 -d command line switch or the Domain
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 -i command line switch (or
be in the default list for that option), or (c) the client must be con-
nected to a daemon port named by the -m command line switch, or (d) the
MTA must have set one or more macros matching the criteria set by the
-M command line switch.

When signing a message, a DKIM-Signature: header will be prepended to
the message. The signature is computed using the private key provided.
You must be running a version of sendmail(8) recent enough to be able
to do header prepend operations (8.13.0 or later).

When verifying a message, an Authentication-Results: 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 com-
mand line overrides provided at startup time will be lost when this is
done. Also, the following configuration file values (and their corre-
sponding command line items, if any) are not reloaded through this
process: AutoRestart (-A), AutoRestartCount, AutoRestartRate, Back-
ground, MilterDebug, PidFile (-P), POPDBFile, Quarantine (-q),
QueryCache, Socket (-p), StrictTestMode, TestPublicKeys, UMask, UserID
(-u). The filter does not automatically check the configuration file
for changes and reload.

ENVIRONMENT
The following environment variable(s) can be used to adjust the behav-
iour of this filter:

DKIM_TMPDIR
The directory to use when creating temporary files. The default
is /var/tmp.

NOTES
When using DNS timeouts (see the -T option above), be sure not to use a
timeout that is larger than the timeout being used for interaction
between sendmail and the filter. Otherwise, the MTA could abort a mes-
sage 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 inet_addr(3) 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 "1.2.3.0/24" are not the same
thing).

HISTORY
DKIM is an amalgam of Yahoo!'s DomainKeys proposal, and Cisco's Inter-
net Identified Mail (IIM) proposal.

VERSION
This man page covers version 2.8.0 of dkim-filter.

DKIM-filter.conf manual

NAME
dkim-filter.conf - Configuration file for dkim-filter

LOCATION
/etc/mail/dkim-filter.conf

DESCRIPTION
dkim-filter(8) implements the DKIM specification for signing and veri-
fying e-mail messages on a per-domain basis. This file is its configu-
ration file, read on startup only.

Blank lines are ignored. Lines containing a hash ("#") character are
truncated at the hash character to allow for comments in the file.

Other content should be the name of a parameter, followed by white
space, followed by the value of that parameter, each on a separate
line.

For parameters which are Boolean in nature, only the first byte of the
value is processed. For positive values, the following are accepted:
"T", "t", "Y", "y", "1". For negative values, the following are
accepted: "F", "f", "N", "n", "0".

Many, but not all, of these parameters are also available as command
line options to dkim-filter(8). However, new parameters are generally
not added as command line options so the complete set of options is
available here, and thus use of the configuration file is encouraged.
In some future release, the set of available command line options is
likely to get trimmed.

See the dkim-filter(8) man page for details about how and when the con-
figuration file contents are reloaded.

PARAMETERS
AllowSHA1Only (Boolean)
Permit verify mode when only SHA1 support is available. RFC4871
requires that verifiers implement both SHA1 and SHA256 support.
Setting this feature changes the absence of SHA256 support from
an error to a warning.


AlwaysAddARHeader (Boolean)
Add an "Authentication-Results:" header even to unsigned mes-
sages from domains with no "signs all" policy. The reported
DKIM result will be "none" in such cases. Normally unsigned
mail from non-strict domains does not cause the results header
to be added.

AlwaysSignHeaders (string)
Specifies a list of headers which should be included in all sig-
nature header lists (the "h=" tag) even if they were not present
at the time the signature was generated. The string should be a
comma-separated list of header names. The list is empty by
default. The purpose of listing an absent header is to prevent
its addition between the signer and the verifier, since the ver-
ifier would include that header if it were added when performing
verification, which would mean the signed message and the veri-
fied message were different and the verification would fail.

ADSPDiscard (Boolean)
If "true", requests rejection of messages which are determined
to be suspicious according to the author domain's published
signing practises (ADSP) record if that record also recommends
discard of such messages.

ADSPNoSuchDomain (Boolean)
If "true", requests rejection of messages which are determined
to be from nonexistent domains according to the author domain
signing practises (ADSP) test.

AuthservID (string)
Sets the "authserv-id" to use when generating the Authentica-
tion-Results: header after verifying a message. The default is
to use the local machine's hostname.

AuthservIDWithJobID (Boolean)
If "true", requests that the authserv-id portion of the added
Authentication-Results: headers contain the job ID of the mes-
sage being evaluated.

AutoRestart (Boolean)
Automatically re-start on failures. Use with caution; if the
filter fails instantly after it starts, this can cause a tight
fork(2) loop.

AutoRestartCount (integer)
Sets the maximum automatic restart count. After this number of
automatic restarts, the filter will give up and terminate. A
value of 0 implies no limit; this is the default.

AutoRestartRate (string)
Sets the maximum automatic restart rate. If the filter begins
restarting faster than the rate defined here, it will give up
and terminate. This is a string of the form n/t[u] where n is
an integer limiting the count of restarts in the given interval
and t[u] defines the time interval through which the rate is
calculated; t is an integer and u defines the units thus repre-
sented ("s" or "S" for seconds, the default; "m" or "M" for min-
utes; "h" or "H" for hours; "d" or "D" for days). For example,
a value of "10/1h" limits the restarts to 10 in one hour. There
is no default, meaning restart rate is not limited.

Background (Boolean)
Normally dkim-filter forks and exits immediately, leaving the
service running in the background. This flag suppresses that
behaviour so that it runs in the foreground.

BaseDirectory (string)
If set, instructs the filter to change to the specified direc-
tory using chdir(2) before doing anything else. This means any
files referenced elsewhere in the configuration file can be
specified relative to this directory. It's also useful for
arranging that any crash dumps will be saved to a specific loca-
tion.

BodyLengths (Boolean)
Requests that dkim-filter include the "l=" body length tag when
generating signatures. This indicates to the verifier that only
a certain amount of the original message was signed, allowing
tolerance of things like mailing list managers which append
list-specific text to the end of mailings it processes. How-
ever, this also enables an abuse attack. See the DKIM specifi-
cation for more information.

BogusKey (string)
(Only available if the filter was compiled with libunbound to
enable DNSSEC support.) Instructs the filter to treat a passing
signature associated with a bogus (forged) key in a special way.
Possible values are neutral (return a "neutral" result), none
(take no special action) and fail (return a "fail" result; this
is the default).

BogusPolicy (string)
(Only available if the filter was compiled with libunbound to
enable DNSSEC support.) Instructs the filter to treat an ADSP
policy found in an bogus (forged) DNS record in a special way.
Possible values are apply (apply the policy) and ignore (ignore
the policy; this is the default).

Canonicalization (string)
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 relaxed and simple as defined by the DKIM specification.
The default is simple. 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.

ClockDrift (integer)
Sets the tolerance in seconds to be applied when determining
whether a signature was either expired or generated in the
future. The default is 300.

Diagnostics (Boolean)
Requests the inclusion of "z=" tags in signatures, which encode
the original header set for use by verifiers when diagnosing
verification failures. Not recommended for normal operation.

DNSTimeout (integer)
Sets the DNS timeout in seconds. A value of 0 causes an infi-
nite wait. The default is 5. Ignored if not using the asyn-
chronous resolver package. See also the NOTES section below.

DontSignMailTo (string)
A comma-separated list of e-mail addresses (with "*" allowed as
a wildcard character), mail to which should never be signed by
the filter. Note that this is an "any" feature; if any one of
the recipients of the message matches a member of this list, the
message will not be signed.

Domain (string)
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 a "/").

In either case, the domain name(s) may contain the special char-
acter "*" which is treated as a wildcard character matching zero
or more characters in a domain name.

This parameter is not required if a KeyList is in use; in that
case, the list of signed domains is implied by the lines in that
file.

EnableCoredumps (boolean)
On systems which have such support, make an explicit request to
the kernel to dump cores when the filter crashes for some rea-
son. Some modern UNIX systems suppress core dumps during
crashes for security reasons if the user ID has changed during
the lifetime of the process. Currently only supported on Linux.

ExternalIgnoreList (string)
Identifies a file of "external" hosts which may send mail
through the server as one of the signing domains without creden-
tials as such. Basically suppresses the "external host (host-
name) tried to send mail as (domain)" log messages. Entries in
the file should be of the same form as those of the PeerList
option below. The list is empty by default.

FixCRLF (Boolean)
Requests that the DKIM library convert bare CRs and LFs to CRLFs
during body canonicalization, anticipating that an MTA somewhere
before delivery will do that conversion anyway. The default is
to leave them as-is.

Include (string)
Names a file to be opened and read as an additional configura-
tion file. Nesting is allowed to a maximum of five levels.

InsecureKey (string)
(Only available if the filter was compiled with libunbound to
enable DNSSEC support.) Instructs the filter to treat a passing
signature associated with an insecure key in a special way.
Possible values are neutral (return a "neutral" result), none
(take no special action; this is the default) and fail (return a
"fail" result).

InsecurePolicy (string)
(Only available if the filter was compiled with libunbound to
enable DNSSEC support.) Instructs the filter to treat an ADSP
policy found in an insecure DNS record in a special way. Possi-
ble values are apply (apply the policy; this is the default) and
ignore (ignore the policy).

InternalHosts (string)
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 the PeerList option below. 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 address
explicitly.

KeepTemporaryFiles (boolean)
Instructs the filter to create temporary files containing the
header and body canonicalizations of messages which are signed
or verified. The location of these files can be set using the
TemporaryDirectory parameter. Intended only for debugging veri-
fication problems.

KeyFile (string)
Gives the location of a PEM-formatted private key to be used for
signing all messages. Ignored if KeyList is defined.

KeyList (string)
Gives the location of a file listing rules for signing with mul-
tiple keys. If present, overrides any KeyFile setting in the
conifguration file. The file named here should contain a set of
lines of the form sender-pattern:signing-domain:keypath where
sender-pattern is a pattern to match against message senders
(with the special character "*" interpreted as "zero or more
characters"), signing-domain is the domain to announce as the
signing domain when generating signatures, and keypath is the
path to the PEM-formatted private key to be used for signing
messages which match the sender-pattern. The selector used in
the signature will be the filename portion of keypath. If the
file referenced by keypath cannot be opened, the filter will try
again by appending ".pem" and then ".private" before giving up.

LocalADSP (string)
Allows specification of local ADSP overrides for domains. This
is expected to be a file containing entries, one per line, with
comments and blank lines allowed. An entry is of the form
domain:policy where domain is either a fully-qualified domain
name (e.g. "foo.example.com") or a subdomain name preceded by a
period (e.g. ".example.com"), and policy is either unknown, all,
or discardable, as per the current ADSP draft specification.
This allows local overrides of policies to enforce for domains
which either don't publish ADSP or publish weaker policies than
the verifier would like to enforce.

LogWhy (boolean)
If logging is enabled (see Syslog below), issues very detailed
logging about the logic behind the filter's decision to either
sign a message or verify it. 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 OPERATIONS section of the dkim-filter(8) man
page. 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.

MacroList (string)
Defines a set of MTA-provided macros 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
value is specified, the value of the macro must match a value
specified (matching is case-sensitive), otherwise the macro must
be defined but may contain any value. The set is empty by
default, meaning macros are not considered when making the sign-
verify decision. The general format of the string is
test1[,test2[,...]] where a "test" is of the form
macro[=value1[|value2[|...]]]; if one or more value is defined
then the macro must be set to one of the listed values, other-
wise the macro must be set but can contain any value.

MaximumHeaders (integer)
Defines the maximum number of bytes the header block of a mes-
sage may consume before the filter will reject the message.
This mitigates a denial-of-service attack in which a client con-
nects to the MTA and begins feeding an unbounded number of
header fields of arbitrary size; since the filter keeps a cache
of these, the attacker could cause the filter to allocate an
unspecified amount of memory. The default is 65536; a value of
0 removes the limit.

MaximumSignedBytes (integer)
Specifies the maximum number of bytes of message body to be
signed. Messages shorter than this limit will be signed in
their entirety. Setting this value forces BodyLengths to be
"True".

MilterDebug (integer)
Sets the debug level to be requested from the milter library.
The default is 0.

Minimum (string)
Instructs the verification code to fail messages for which a
partial signature was received. There are three possible for-
mats: min indicating at least min bytes of the message must be
signed (or if the message is smaller than min then all of it
must be signed); min% requiring that at least min percent of the
received message must be signed; and min+ meaning there may be
no more than min bytes of unsigned data appended to the message
for it to be considered valid.

Mode (string)
Selects operating modes. The string is a concatenation of char-
acters which indicate which mode(s) of operation are desired.
Valid modes are s (signer) and v (verifier). The default is sv
except in test mode (see the dkim-filter(8) man page) in which
case the default is v.

MTA (string)
A comma-separated list of MTA names (a la the sendmail(8) Dae-
monPortOptions Name parameter) whose mail should be signed by
this filter. There is no default, meaning MTA name is not con-
sidered when making the sign-verify decision.

MustBeSigned (string)
Specifies a list of headers which, if present, must be covered
by the DKIM signature when verifying a message. The string
should be a comma-separated list of header names. If a header
in this list is present in the message and is not signed, the
filter will treat even an otherwise valid signature as invalid.
The default is an empty list.

OmitHeaders (string)
Specifies a list of headers which should be omitted when gener-
ating signatures. The string 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).
Note that specifying a list with this parameter replaces the
default entirely.

On-BadSignature (string)
Selects the action to be taken when a signature fails to vali-
date. Possible values (with abbreviated forms in parentheses):
accept (a) accept the message; discard (d) discard the message;
tempfail (t) temp-fail the message; reject (r) reject the mes-
sage. The default is accept.

On-Default (string)
Selects the action to be taken when any verification or internal
error of any kind is encountered. This is processed before the
other "On-" values so it can be used as a blanket setting fol-
lowed by specific overrides.

On-DNSError (string)
Selects the action to be taken when a transient DNS error is
encountered. Possible values are the same as those for On-
BadSignature. The default is tempfail.

On-InternalError (string)
Selects the action to be taken when an internal error of some
kind is encountered. Possible values are the same as those for
On-BadSignature. The default is tempfail.

On-NoSignature (string)
Selects the action to be taken when a message arrives unsigned.
Possible values are the same as those for On-BadSignature. The
default is accept.

On-Security (string)
Selects the action to be taken when a message arrives containing
properties that may be a security concern. Possible values are
the same as those for On-BadSignature. The default is tempfail.

PeerList (string)
Identifies a file of "peers" which identifies clients whose con-
nections should be accepted without processing by this filter.
The file 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 ("!") charac-
ter means "not", allowing exclusions of specific hosts that are
otherwise members of larger sets. The order of entries in this
file is therefore significant.

PidFile (string)
Specifies the path to a file which should be created at process
start containing the process ID.

POPDBFile (string)
Requests that the filter consult a POP authentication database
named in the string for IP addresses that should be allowed for
signing. The filter must be compiled with the POPAUTH flag to
enable this feature, since it adds a library dependency.

Quarantine (Boolean)
Requests that messages which fail verification be quarantined by
the MTA. (Requires a sufficiently recent version of the milter
library.)

QueryCache (Boolean)
Instructs the DKIM library to maintain its own local cache of
keys and policies retrieved from DNS, rather than relying on the
nameserver for caching service. Useful if the nameserver being
used by the filter is not local. The filter must be compiled
with the QUERY_CACHE flag to enable this feature, since it adds
a library dependency.

RemoveARAll (Boolean)
Removes all Authentication-Results: header fields which also
satisfy the requirements of RemoveARFrom below. By default,
only those containing a DKIM result are removed.

RemoveARFrom (string)
Lists patterns of hostnames whose Authentication-Results: header
fields should be removed before the message is passed for deliv-
ery. By default only those headers matching the local host's
canonical name will be removed. If more than one pattern is
desired, the list should be comma-separated. Matching is only
done on full hostnames (e.g. "host.example.com") or on domain
names (e.g. ".example.com").

RemoveOldSignatures (Boolean)
Removes all existing signatures when operating in signing mode.

ReportAddress (string)
Specifies the string to use in the From: header field for outgo-
ing reports (see SendReports and SendADSPReports below). If not
specified, the executing user and local hostname will be used to
construct the address.

RequiredHeaders (boolean)
Checks all messages for compliance with RFC2822 header count
requirements. Non-compliant messages are rejected.

Selector (string)
Defines the name of the selector to be used when signing mes-
sages. See the DKIM specification for details. Used only when
signing with a single key; see the KeyList parameter above for
more information.

SendADSPReports (Boolean)
If true, when a policy evaluation fails and the signing site
advertises a reporting address (i.e. r=user in its policy
record) and a request for reports of such failures, the filter
will send a structured report to that address containing details
of the incident.

SendReports (Boolean)
If true, when a signature verification fails and the signing
site advertises a reporting address (i.e. r=user in its policy
record) and a request for reports of such failures, the filter
will send a structured report to that address containing details
needed to reproduce the problem.

SignatureAlgorithm (string)
Selects the signing algorithm to use when generating signatures.
If the filter was compiled against version 0.9.8 or later of
OpenSSL then both rsa-sha1 and rsa-sha256 are available and the
latter is the default. Otherwise, only the former is available
and it is (obviously) the default.

SignatureTTL (integer)
Sets the time-to-live, in seconds, of signatures generated by
the filter. If not set, no expiration time is added to signa-
tures.

SignHeaders (string)
Specifies the list of headers which should be included when gen-
erating signatures. The string should be a comma-separated list
of header names. If the list omits any header which is mandated
by the DKIM specification, those headers are implicitly added.
By default, those headers listed in the DKIM specification as
"SHOULD" be signed will be signed by the filter. Specifying a
list here replaces that list entirely. See the OmitHeaders con-
figuration option for more information.

Socket (string)
Specifies the socket that should be established by the filter to
receive connections from sendmail(8) in order to provide ser-
vice. socketspec is in one of two forms: local:path which cre-
ates a UNIX domain socket at the specified path, or
inet:port[@host] which creates a TCP socket on the specified
port. If the host is not given as either a hostname or an IP
address, the socket will be listening on all interfaces. This
option is mandatory either in the configuration file or on the
command line.

StrictTestMode (Boolean)
Selects strict CRLF mode during testing (see the -t command line
flag in the dkim-filter(8) man page); messages for which all
header fields and body lines are not CRLF-terminated are consid-
ered malformed and will produce an error.

SubDomains (Boolean)
Sign subdomains of those listed by the Domain parameter as well
as the actual domains.

Syslog (Boolean)
Log via calls to syslog(3) any interesting activity.

SyslogFacility (string)
Log via calls to syslog(3) using the named facility. The facil-
ity names are the same as the ones allowed in syslog.conf(5).
The default is mail .

SyslogSuccess (Boolean)
Log via calls to syslog(3) additional entries indicating suc-
cessful signing or verification of messages.

TemporaryDirectory (string)
Specifies the directory in which temporary canonicalization
files should be written. The default is to use the libdkim
default location, currently /var/tmp.

TestPublicKeys (string)
Names a file from which public keys should be read. Intended
for use only during automated testing.

TrustAnchorFile (string)
Specifies a file from which trust anchor data should be read
when doing DNS queries and applying the DNSSEC protocol.
Requires that the filter be compiled with USE_UNBOUND set. See
the Unbound documentation at http://unbound.net for the expected
format of this file.

TrustSignaturesFrom (string)
Like Domain, this value consists of either a comma-separated
list of domain names or a file containing a list of domains. In
either case, the list of domains is used to decide which domains
are considered trustworthy in terms of third-party signatures.
That is, if a message arrives with a signature from a domain
that doesn't match the domain in the From: header, this setting
determines whether or not that signature will be trusted. If
this value is undefined, all signatures are trusted.

UMask (integer)
Requests a specific permissions mask to be used for file cre-
ation. This only really applies to creation of the socket when
Socket specifies a UNIX domain socket, and to the PidFile (if
any); temporary files are created by the mkstemp(3) function
which enforces a specific file mode on creation regardless of
the process umask. See umask(2) for more information.

UserID (string)
Attempts to become the specified userid before starting opera-
tions. The value is of the form userid[:group]. The process
will be assigned all of the groups and primary group ID of the
named userid unless an alternate group is specified.

X-Header (Boolean)
Causes dkim-filter to add a header indicating the presence of
this filter in the path of the message from injection to deliv-
ery. The product's name, version, and the job ID are included
in the header's contents.

NOTES
When using DNS timeouts (see the DNSTimeout option above), be sure not
to use a timeout that is larger than the timeout being used for inter-
action between sendmail 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.

Features that involve specification of IPv4 addresses or CIDR blocks
will use the inet_addr(3) 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 "1.2.3.0/24" are not the same
thing).

VERSION
This man page covers version 2.8.1 of dkim-filter.

Feedback

If you have any comments, you can contact the author here.

 

http://www.elandsys.com/resources/sendmail/dkim.html