Globalcritical
It links three things: a selector, a sending domain and a private key — from a file or from a secrets vault. There can be any number of declarations, and they form a set from which the node chooses when signing.
The first matching declaration wins. The node goes down the list from top to bottom and takes the first key whose domain matches the signing domain or is its parent. A key for example.com will fit messages from mail.example.com; the reverse is not true. Keys inside <virtual-mta> are stronger than general ones.
The selector is the name of the DNS record. The public part is published as <selector>._domainkey.<domain>, and that is how the receiver finds the key. The “selector and domain” pair must match down to the character.
The asterisk goes last. A declaration with the * domain fits any message, and the search goes from top to bottom: placed higher, it will intercept messages for which an exact key lies further down. The manual advises exactly this.
A key from the vault goes after the exact declarations. A wildcard path in the vault is checked by querying it; the vendor advises keeping such entries lower so there are fewer queries.
Two limitations of the wildcard path. It does not catch subdomains, and the selector and domain in it are converted to lowercase — the vault is case-sensitive, and the path in it must be created in lowercase.
# exact domains higher, the asterisk last domain-key m, mail.port25.com, /etc/pmta/m.pem domain-key k1, example.org, /etc/pmta/k1.example.org.pemdomain-key base, *, /etc/pmta/base.pem
what people get wrong and how it ends3 mistakes▶
§ 3.3.1.55.1
our experience
§ 3.3.1.55.1
4 relations
domain-macroGlobalOne declaration can cover many domains — through a macro. § 3.3.1.55.1
Change a signing key without interrupting sendingThe line that the key rotation procedure adds and removes. § 1.6.2How the node signs messages and chooses a keyThe key selection rule in full — together with stream priority and the behavior when nothing matches. § 3.3.1.55.1
Headers the sender uses to control deliveryA header with a signing key replaces the declared keys for one message. § 3.3.7.46process-x-dkim-options<source>The header chooses among the keys declared with this directive and cannot name a key that does not exist. § 3.3.7.45dkim-sign<domain>Keys must be configured, otherwise enabling signing achieves nothing — the manual says so plainly. § 3.3.10.18dkim-identity<domain>The declaration’s domain is the signing domain; the signing identity must match it or be its subdomain. § 3.3.10.27arc-sign<domain>Keys must be configured, otherwise enabling it achieves nothing. § 3.3.10.30domain-key<virtual-mta>The full definition of the line — composition, selection rule, working with a secrets vault. § 3.3.1.55.1
dig +short TXT k1._domainkey.example.org grep -i 'DKIM-Signature' /var/log/pmta/pmta.log | tail -5
3 articles
◇How the node signs messages and chooses a keyThe key is chosen by the sending domain from the headers, going through the declarations from top to bottom.◇Headers the sender uses to control deliverySix control headers let the submitting side choose a stream, tag a message with a job, set signing options and the key, the envelope identifier and the schedule; each is allowed separately and per source.◇Backoff mode — the queue's second personalityA queue that a receiver has started refusing switches to a parallel set of limits, retries and routes — ten directives that act only in this mode.