Schedule DKIM key rotation as a gated release for each customer publication domain, with a separate emergency path for suspected key exposure. The deciding constraint is whether the intended signing configuration agrees with the DNS TXT records customers have actually published. A date on a calendar cannot establish that agreement.
Short answer: plan routine rotation, publish and verify the replacement before switching signing, then retire the previous key only after an explicit observation period. If a key may be compromised, use the incident path and accept that restoring trust can take priority over preserving verification for older messages. Neither path should treat a successful queue delivery as proof that a domain is ready.
For a media product that lets customers point their own domains at a publication, distinguish the website connection from mail authentication. A working publication address does not establish that mail using the publication's domain passes DMARC. RFC 7489 describes DMARC in terms of authenticated identifiers and their alignment with the message's From domain. That makes mail evidence part of the release decision, even when the customer's immediate request was simply to connect a domain.
Should a DKIM key rotation schedule wait for an incident?
Use the schedule to create a reviewable change, not an unconditional DNS mutation. Record the intended customer domain, replacement signing identity, expected DNS data, current revision, and the person responsible for publishing the record. For an illustrative publication at dispatch.example, that record of intent is the unit of work. A recurring job can request its next revision; it should not infer that the customer has completed publication because the request is old enough.
Start with evidence.
An operational policy might review rotation readiness every 30 days. That number is an example policy choice, not a rotation interval required by RFC 7489, and it does not mean replacing every key on every review. Choose the actual replacement interval through the team's security policy and its ability to complete customer DNS changes. A shorter interval increases the frequency of publication and verification work. A longer interval leaves the same key in service longer. Neither choice excuses skipping the release gates.
The signal that needs attention is a mismatch: a requested revision has advanced while the last verified publication still describes an earlier revision. Give that state an owner and an age. Paging on every pending customer action is noisy; silently allowing it to remain pending forever is worse. Separate a customer publication reminder from an urgent alert that active mail authentication has regressed.
The trade-off is coordination overhead. This gated workflow is not suitable for emergency containment if its routine approvals delay a necessary security response. Use an incident commander and emergency authorization in that case. Another limitation: a scheduler cannot publish records in customer-controlled DNS without the required authority, so the workflow must support a human handoff rather than promising unattended completion.
Don't bypass ownership.
Gate the change on publication evidence
Use 3 gates: approve intent, verify publication, and authorize retirement. These are proposed release controls, not additional DMARC protocol requirements. Keeping them distinct makes an interrupted rollout explainable: the runbook can say which evidence is missing instead of labeling the entire domain as failed.
At the intent gate, bind approval to one revision of one customer's change. Record who controls DNS and who can change the signer. If those are different teams, the handoff belongs in the release record. Otherwise a scheduler can repeatedly ask for a change that nobody has authority to finish. Publication instructions also need to identify exactly which expected record belongs to that revision; the customer's website setup instructions are insufficient evidence for mail.
At the publication gate, compare observed DNS TXT data with the approved intent. Preserve the observation time and query context. An observation describes what was visible from that query, at that time; it should not be recorded as universal proof about every receiver. Require the evidence appropriate to the rollout before authorizing the signing change, and invalidate approval when the intended revision changes.
The dangerous shortcut is to check only that a record exists.
An older value can satisfy an existence check while leaving the replacement unready. In the dispatch.example example, a customer might acknowledge the publication request while the verifier still sees the previous data. Keep the release pending and show the discrepancy. Repeating the signing cutover will not repair a mismatch in the published record.
After publication verification, send a controlled message through the intended signing path and inspect authentication evidence at the receiving side. RFC 7489 allows DMARC to pass through an aligned DKIM result or an aligned SPF result. A DMARC pass alone therefore does not prove the replacement DKIM path succeeded. Check the DKIM result and its alignment with the From domain explicitly. That distinction prevents a passing alternative authentication path from hiding an unverified signing change.
Make repeated jobs preserve the same decision
Treat a rotation worker as a reconciler of approved state. Its output should be the next permitted action for a revision, with the evidence that justified it. Retrying the same job must not manufacture a fresh rotation, overwrite a newer approval, or interpret completion of a DNS request as verification.
The following Go example encodes only the release decision. It leaves DNS queries, key handling, signing, and persistence to their own components. The booleans represent recorded checks for the same revision, not unchecked values supplied by a customer. Every new revision starts without approval; the executor must establish those checks before it calls this decision function.
package rotation type Evidence struct { Revision uint64 ApprovedRevision uint64 PublicationVerified bool ReplacementVerified bool RetirementApproved bool } func NextAction(e Evidence) string { if e.Revision == 0 || e.Revision != e.ApprovedRevision { return "await approval" } if !e.PublicationVerified { return "verify publication" } if !e.ReplacementVerified { return "verify replacement signing" } if !e.RetirementApproved { return "observe before retirement" } return "retire previous key" } This function does not make a workflow idempotent by itself. The executor must persist transitions conditionally against the revision it read, reject stale work, and make a repeated action safe. Keep private key material out of job payloads and ordinary logs; retain references and release evidence instead. A retry should recover the existing change. It should not create another one.
Test the interruption points before putting the schedule into production. Deliver an old job after a new revision is approved. Repeat the publication-verification job. Stop execution after a signing change but before its completion is recorded. In each case, verify that recovery reads the actual state and preserves the approved intent. These tests target the failure boundaries that a happy-path scheduled run leaves unexamined.
Verify retirement and rehearse rollback
The retirement gate needs its own approval because successful replacement signing does not establish that every older message has finished its journey. Define the observation period using the mail system's documented delivery and retry behavior and the team's tolerance for older-message verification failures. Do not borrow a universal waiting period from an unrelated deployment. Record the rationale alongside the release.
During observation, watch the requested revision, verified publication revision, active signing revision, and age of the oldest unfinished change. DMARC aggregate reports can provide receiver feedback under RFC 7489, but use them alongside controlled message checks rather than treating report arrival as a synchronous cutover acknowledgment. Operationally, a domain with passing mail and a stuck retirement approval is a different problem from a domain whose replacement messages fail authentication.
Rehearse routine rollback while the previous key remains trusted and usable. The runbook should identify the prior signing configuration, require a fresh check of its published verification data, and specify who can authorize restoration. Preserve the failed revision's observations so the next attempt addresses the mismatch instead of repeating it.
Compromise changes that decision.
Stop routine rollback.
If the previous key is suspected to be exposed, returning to it is not an acceptable routine rollback. Follow the security incident process, explicitly decide how to handle its continued trust, and document any expected impact on messages already sent. This is why scheduled maintenance and emergency response need separate authorization rules even if they share verification machinery.
A rotation is complete when approved intent, published verification data, and observed signing behavior agree, and retirement has been authorized. For customer publication domains, that agreement is the release criterion. The calendar starts the work; evidence closes it.
References
- RFC 7489 — Domain-based Message Authentication, Reporting, and Conformance (DMARC), including identifier alignment, policy evaluation, and reporting: https://datatracker.ietf.org/doc/html/rfc7489
