DKIM Key Rotation: A Zero-Downtime Runbook
A practical, zero-downtime DKIM key rotation runbook with selector inventory, DNS overlap, canary validation, rollback criteria, and old-key retirement.
Overview
DKIM key rotation replaces a domain's signing key without breaking verification for legitimate email. The safe pattern is not to overwrite a live DNS record in place. Create a new selector and key pair, publish the new public key, verify it from outside your authoritative DNS, move signers to the new selector in controlled stages, retain the old public key while delayed mail can still arrive, and retire the old selector only after monitoring confirms the migration.
A selector is the s= value in a DKIM-Signature header. Receivers combine it with the signing domain in d= to query selector._domainkey.domain. Because selectors let multiple public keys coexist, they are the mechanism that makes a zero-downtime rollover possible. Rotation should cover every sending service, region, stream, and fallback path—not just the provider used by the last test email.
Inventory the real signing estate first
Start with messages, not a DNS-zone guess. Sample raw headers from each transactional, lifecycle, newsletter, support, and sales stream. Record the visible From domain, DKIM d= domain, selector s=, algorithm, sending provider, environment, owner, and whether DMARC currently passes through DKIM alignment. Include secondary regions, disaster-recovery providers, and queue workers that may send only during failures.
RFC 6376 uses selectors specifically so a signing domain can maintain multiple keys and phase keys in or out. That flexibility also makes stale selectors easy to forget. Build one row per signer and selector, then reconcile it against provider consoles and DNS. An unknown active selector is an investigation item; an unused record is not proof that its private key is safely retired.
- Inspect raw headers from every mailstream
- Map each selector to a named system and owner
- Confirm the DKIM d= domain aligns with the intended From domain
- Treat undocumented production selectors as a security finding
| Inventory field | Evidence to collect | Why it matters |
|---|---|---|
| Signing identity | DKIM d= and visible From domains | Confirms DMARC alignment will survive the change |
| Selector | DKIM s= from raw production messages | Identifies the exact DNS key receivers query |
| Signer | Provider, service, region, environment, owner | Prevents a quiet fallback path from keeping the old key |
| DNS behavior | Record type, TTL, delegation, DNSSEC status | Sets propagation and troubleshooting expectations |
| Algorithm and size | Provider-reported key details and DNS record | Flags legacy material that should not be copied forward |
Prepare a new selector instead of editing the live one
Generate the replacement through the sending provider or your controlled signing service. Choose a new selector that is operationally recognizable without embedding secrets—for example, a provider and rotation epoch. Publish only the public key in DNS; the private key remains in the signer or provider's protected key store. Do not paste private material into tickets, chat, source control, or the DNS record.
Use current cryptographic requirements rather than cloning a legacy key. RFC 8301 updates DKIM algorithm and key guidance, including treating RSA keys below 1024 bits as invalid for signing or verification. Provider support and DNS constraints vary, so follow the provider's supported configuration while ensuring the result meets the current standard. Rotation is the right moment to remove obsolete key material, not reproduce it under a new selector.
- Never overwrite or remove the current public key during preparation
- Keep old and new selector records available in parallel
- Account for negative caching if the selector name was queried before publication
- Document who can activate and roll back the signer
- Create a new selector and key pair in the authorized signing system.
- Publish the exact public-key record at the new selector name.
- Query the authoritative nameservers and independent recursive resolvers for the new record.
- Validate record syntax, selector name, d= domain, algorithm, and key value.
- Wait through the applicable DNS caching window before making the new selector the only signing path.
Canary the new signature before broad cutover
Once DNS is visible, activate the new selector for a test or low-risk stream. Send to external mailboxes where you can inspect the received source. Confirm that the DKIM-Signature contains the expected s= and d= values, Authentication-Results reports dkim=pass, and DMARC still passes through an aligned path. A successful provider dashboard test is useful, but it is not a substitute for receiver-side verification.
Expand in stages by signer, region, or mailstream. Keep the old private key available for rollback and keep its public key published throughout the transition. Do not rotate every provider and domain in one maintenance window; independent batches make failures attributable and rollback manageable.
- Validate at the receiver, not only at the sender
- Canary both HTML and plain-text or multipart message paths
- Test mail modified by your normal link, footer, and tracking pipeline
- Record the exact cutover time for later DMARC and log analysis
| Gate | Pass condition | Failure action |
|---|---|---|
| DNS | New selector resolves consistently with the expected public key | Pause activation and fix publication or delegation |
| Signature | Received header shows the intended d=, s=, and algorithm | Revert signer configuration |
| Verification | Independent receivers report dkim=pass | Inspect canonicalization, key, and message modification |
| Alignment | DMARC passes with aligned DKIM or the documented alternate path | Fix signing domain before expanding |
| Production canary | No unexplained authentication regression by stream/provider | Stop rollout and return that batch to the old selector |
Monitor by selector, then retire conservatively
During overlap, measure which selectors are still signing mail. Use sampled raw headers, provider logs, and DMARC aggregate data where available, while remembering that DMARC reports are delayed and aggregated. Segment failures by signing domain, selector, provider, mailstream, and recipient domain. A global DKIM pass rate can hide one old worker or fallback region that never moved.
Retire the old selector only when all authorized signers have stopped using its private key and the longest relevant queue, retry, and message-transit window has passed. DNS TTL alone is not the full waiting period: a delayed message signed before cutover may be verified after cutover. Keep the public key available during that overlap. After retirement, remove or securely destroy old private-key access, update the inventory, and use your DNS/key-management policy to decide whether to remove the record or publish a revoked-key value.
- Do not delete the old DNS key immediately after cutover
- Measure adoption per selector instead of relying on an account-wide pass rate
- Keep evidence from external receiver tests
- Close the work only after old private-key access is removed
- Confirm new-selector signatures and aligned DKIM passes across every mailstream.
- Search logs and sampled headers for any message still signed by the old selector.
- Wait out DNS caches plus the maximum realistic queue, retry, and delayed-transit window.
- Disable and securely retire the old private key before declaring the rotation complete.
- Retire or revoke the old public-key record according to the documented DNS policy.
- Update the selector inventory, evidence, owner, and next review date.
Separate routine rollback from emergency compromise response
For a routine rotation failure, rollback is straightforward because the old key remains valid: switch the affected signer back to the old selector, verify a new external message, and investigate the new key without deleting either DNS record. Define rollback triggers before cutover, such as receiver-side DKIM failures, wrong d= alignment, a missing selector in one region, or unexpected post-signing modification.
A suspected private-key compromise is different. Returning to the compromised key is not a safe rollback. Activate a known-good replacement selector, stop the affected signer, preserve evidence, revoke or remove the compromised key according to the incident plan, and assess unauthorized use. Coordinate DKIM action with DMARC monitoring, provider credentials, API keys, deployment secrets, and any system that could have copied the private key.
- Write rollback commands and owners before cutover
- Do not confuse a propagation problem with a cryptographic failure
- Treat compromise as an incident, not normal maintenance
- Preserve logs showing selector use and configuration changes
| Scenario | Immediate move | Old key treatment |
|---|---|---|
| New DNS record is wrong | Keep or restore signing on old selector | Leave valid while fixing DNS |
| One region cannot load new key | Roll back that region only | Keep valid during staged repair |
| Post-signing service breaks signatures | Pause expansion and fix message pipeline | Use old selector only if that path still verifies |
| Private key may be compromised | Stop affected signer and activate a known-good key | Do not use as rollback; follow incident revocation plan |
Make rotation a repeatable control
No internet standard gives every sender one universal calendar interval. Set a rotation policy from your security requirements, provider capabilities, key custody, audit obligations, and operational risk. Also define event-driven rotation triggers: suspected exposure, staff or vendor access changes, provider migration, deprecated algorithms, unexplained signing activity, or loss of confidence in key provenance.
Mailbase does not replace your provider's DKIM signer or DNS controls. Its relevant role is the workflow above delivery: sender-domain setup, scheduled campaigns, analytics, suppressions, and reply handling. When rotating a domain used by Mailbase or a connected useSend deployment, pause risky campaign changes, canary authenticated messages through the real path, and keep transactional and marketing streams separately observable.
- Assign named owners for signer, DNS, monitoring, and rollback
- Schedule rotations as controlled changes with evidence
- Trigger out-of-cycle rotation when key trust changes
- Review provider fallback paths during every rotation
| Control | Owner | Completion evidence |
|---|---|---|
| Selector inventory | Email/platform owner | Current signer-to-selector map |
| Key generation and custody | Security/platform owner | Provider or key-store audit record |
| DNS publication | DNS owner | Authoritative and recursive query results |
| Receiver canary | Deliverability/operator owner | Raw headers with DKIM and DMARC pass |
| Old-key retirement | Security and email owners | No old signatures plus revoked private access |
Common Mistakes
- Skipping SPF, DKIM, and DMARC, or assuming they're a one-time setup.
- Sending real volume from a brand-new, un-warmed domain.
- Reusing a stale list without re-verifying, so bounces spike.
- Ignoring complaint rate until a single bad campaign sinks the domain.
Sources & Further Reading
Official docs for current setup details, pricing, and API behavior — verify specifics there, since they change.
Related guides
More on dkim key rotation and the surrounding deliverability workflow:
FAQ
What is DKIM key rotation?
DKIM key rotation is the controlled replacement of an email domain's signing key. A safe rotation publishes a new public key under a new selector, moves signers in stages, keeps the old selector available during overlap, and retires old private-key access after verification.
Can DKIM keys be rotated without email downtime?
Yes. DKIM selectors allow old and new public keys to coexist. Publish and verify the new selector first, canary receiver-side authentication, cut signers over gradually, and retain the old public key while delayed messages may still be verified.
How long should an old DKIM key remain in DNS?
There is no single safe interval for every sender. Cover DNS caching and the longest realistic queue, retry, and delayed-message transit window, and confirm no authorized signer still uses the old selector before retirement.
Should I reuse the same DKIM selector when rotating a key?
Use a new selector for a controlled rollover. Replacing the key at a live selector can make cached old records disagree with new signatures. Parallel selectors provide clean overlap, staged activation, and straightforward rollback.
What changes if a DKIM private key is compromised?
Treat it as a security incident. Stop the affected signer, activate a known-good replacement, preserve evidence, revoke or remove the compromised key according to your incident plan, and review provider credentials and systems that could access the key.