skip to content

When an outside sending service asks you to publish a CNAME at a DKIM selector under your domain, what do you hand over compared with publishing its key yourself?

level: seniorimportance: should knowfreq 34%

answer

  1. the alias target decides the answer
  2. who writes p=
  3. key generated by the signer
  4. no t=s, no veto
  5. the alias outlives the contract

basics

~20 s

A CNAME-delegated selector hands the key record to the service: it holds the private key and writes p=, key length, flags and rotation timing in its own zone. Publishing its public key yourself keeps the record and revocation yours.

solid answer

~50 s

With a CNAME at `s1._domainkey.example.com` pointing into the service's zone, a verifier asking for the key follows the alias and reads whatever TXT record the service publishes at the target. The service generates the key pair, so the private key never leaves it, which RFC 5863 recommends, and it can change keys without touching your zone. The price is control: you cannot add `t=s`, choose the key length or algorithm, or see a change before it is live, and every message the service signs with your domain as `d=` is vouched for by that domain. Publishing the record yourself, with only the public half sent to you, keeps those choices yours but turns each key change into a change in your DNS. Either way, prefer a dedicated subdomain as `d=`, keep an inventory, and remove the selector when the contract ends.

code

dns · 7 lines
dns
$ORIGIN _domainkey.news.example.com.
; service A: key generated by the service, record published by you
svca-s2026a  IN TXT   ( "v=DKIM1; k=rsa; t=s; p=MIIBIjANBgkqh..."
                        "...IDAQAB" )
; service B: selectors delegated by alias into the service's zone
svcb1        IN CNAME svcb1.dkim.sender.example.net.
svcb2        IN CNAME svcb2.dkim.sender.example.net.

go deeper

for a junior

Recall that an outside service can sign as your domain only if a key record exists under your selector name, either published by you or aliased to the service.

for a middle

Explain how a CNAME at a selector name is followed to a TXT record in the service's zone, and who generates and holds the private key.

for a senior

Weigh what each model gives away, such as tags, key length and revocation, and show the controls: subdomain d=, inventory, target checks and removal at contract end.

for a principal

Set the rule for which services may hold a delegated selector at all, and make the alias's removal part of ending the contract.

## Two ways an outside service signs as your domain A **DKIM** signature is checked against the key record at `<selector>._domainkey.<d=>` (RFC 6376). When an outside sending service, such as a newsletter or ticketing platform, is to sign mail with your domain as `d=`, the key record has to exist under your name. There are three ways to arrange that: | Model | Who generates the key pair | Who writes the key record | Who can change or revoke it | |---|---|---|---| | **Self-published record** | the service, sending you the public key | you, in your zone | you; the service must ask you for every change | | **CNAME-delegated selector** | the service | the service, at the alias target in its zone | the service changes content; you can only delete the alias | | **Delegated subzone** | the service | the service, on its own name servers | the service, for every record under that subdomain | RFC 6376 itself does not mention CNAMEs; the alias works because of ordinary DNS behaviour, covered with DNS record types: a resolver asked for a TXT record at a name that holds a CNAME follows the alias and returns the TXT record at the target. ## How a delegated selector resolves 1. A message arrives signed with `d=news.example.com; s=svcb1`. 2. The verifier queries the TXT record at `svcb1._domainkey.news.example.com`. 3. Your zone answers with a CNAME to `svcb1.dkim.sender.example.net`. 4. The resolver follows the alias, and the service's zone returns its key record. 5. The verifier checks the signature with that key. Nothing in the result shows that an alias was involved; the signature counts for `news.example.com`. ## What you keep and what you give up With a **self-published** record you keep: - the **tags**: you can add `t=s` (no subdomain `i=` values) and `s=email`, and see that `k=` and `h=` are what you expect; - the **key length**: you can refuse a key shorter than RFC 8301 requires (signers MUST use at least 1024 bits and SHOULD use 2048 or more); - **unilateral revocation**: you can empty `p=` or remove the record on your own. You pay with **friction**: each new key from the service is a change request to your DNS team. With a **CNAME-delegated** selector the service can rotate keys on its own schedule, which is why services ask for it, and the private key stays with the signer, as RFC 5863 section 3.4 and RFC 4686 section 4.1.2 recommend. You give up: - any say over `p=`, its length and algorithm, and the flags; - advance notice: a change is live at the target before you could see it; - the record's content, which can be read only by querying the target. You keep one control: **deleting the CNAME** makes the selector stop answering. ## Risks the domain owner carries - **A grant of trust.** Any message the service signs with `d=` set to your domain or subdomain verifies as that domain. RFC 9989 section 11.8 warns that whoever controls DKIM selector records for a subdomain of an organizational domain can produce mail that passes DMARC for it under relaxed alignment. - **A leftover alias.** When the contract ends but the CNAME stays, whoever controls the target name can keep publishing a key that verifies for your domain. If the target name is ever given up, control of it may pass to someone you never contracted with. - **Invisible weak keys.** A service that publishes a 1024-bit key at its target is within RFC 8301's floor but below its recommendation, and you see it only if you look. ## Controls 1. **Prefer a dedicated subdomain as `d=`**, such as `news.example.com`; RFC 5863 section 7.4 suggests keys for an outsourced function sit preferably under a designated subdomain. 2. **Record every delegated selector** with its service, owner and contract end. 3. **Query the targets periodically** and read `k=`, the `p=` length and any `t=y` left in place. 4. **Delete the CNAME on the day the contract ends**; with a self-published record, revoke or remove it, in the order key rotation sets out. 5. **Watch receiver evidence**, such as `header.s` in `Authentication-Results` and the selector in aggregate reports, for selectors nobody recognises.

  • What should happen to a delegated DKIM selector when the contract with the sending service ends?
    Delete the CNAME. While it stays, whoever controls the target name can keep publishing a key that verifies for your domain, and if that name is ever released, control may pass to someone else. RFC 6376 names a terminated outsourcing contract as a reason to make a selector fail. With a self-published record, the same end is an emptied `p=` or a removed record.
  • Why should the sending service generate the DKIM key pair rather than the domain owner?
    So the private key never travels. RFC 5863 section 3.4 says the third-party signer should generate the key pair and send the domain holder the public half, rather than the domain holder sending a private key out. RFC 4686 adds that the public key received should be checked as really coming from the signer, so a substituted key is not published by mistake.
  • Can a delegated selector make a service's mail pass DMARC for your organizational domain?
    Yes, when the service signs with your domain or a subdomain of it as `d=` and the From address is in your domain: RFC 9989 section 11.8 warns that control of DKIM selector records for a subdomain is enough for a DMARC pass under relaxed alignment. Alignment itself is DMARC's subject; the point here is that delegating a selector is a grant of trust.

  • With a CNAME at the selector, the private key stays with us.
  • We can still add t=s to a selector we delegated by CNAME.
  • Removing the service from our SPF record also stops its DKIM signatures verifying.
  • Delegated selectors are harmless to leave in place after the contract ends.
  • The domain owner should generate the key pair and send the private key to the service.
  • Receivers refuse DKIM keys reached through a CNAME.