# Automatic DKIM rotation doesn't carry over custom signed headers

**URL:** https://support.stalw.art/t/automatic-dkim-rotation-doesnt-carry-over-custom-signed-headers/2420
**Category:** Issues
**Created:** [November 17, 2026, 2:37pm UTC](https://support.stalw.art/t/automatic-dkim-rotation-doesnt-carry-over-custom-signed-headers/2420 "2026-11-17T14:37:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![passibe15](https://support.stalw.art/letter_avatar_proxy/v4/letter/p/a9a28c/32.png) [@passibe15](https://support.stalw.art/u/passibe15)
#### Post date: [November 17, 2026, 2:37pm UTC](https://support.stalw.art/t/automatic-dkim-rotation-doesnt-carry-over-custom-signed-headers/2420/1 "2026-11-17T14:37:49Z")

</div>

### Issue Description

I have a DKIM signature configured for a domain. In the `DkimSignature` object, some headers to be signed were added manually under “Signed Headers”, e.g. `CC`.

When I now enable automatic DNS management for this domain, after the task runs (or is manually triggered) a new `DkimSignature` object gets created. However, this new object does not include the headers previously added to “Signed Headers”. Thus, they are no longer signed after the key rotates.

### Expected Behavior

The new `DkimSignature` object uses the same “Signed Headers” as the one it replaces, they get carried over.

### Actual Behavior

The new `DkimSignature` object uses only the default “Signed Headers”.

### Reproduction Steps

1. Create a `DkimSignature` object
2. Add a non-default header to “Signed Headers”
3. Enable automatic DKIM management
4. Wait or force DKIM key rotation
5. Observe new `DkimSignature` object does not include non-default header set in step 2.

### Stalwart Version

v1.x

### Installation Method

Docker

### Database Backend

PostgreSQL

### Blob Storage

PostgreSQL

### Search Engine

PostgreSQL

### Directory Backend

Internal

### I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

### I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

### I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

---

<div class="post-metadata">

### Author: ![helpbot](https://support.stalw.art/user_avatar/support.stalw.art/helpbot/32/13_2.png) [@helpbot](https://support.stalw.art/u/helpbot)
#### Post date: [November 17, 2026, 2:38pm UTC](https://support.stalw.art/t/automatic-dkim-rotation-doesnt-carry-over-custom-signed-headers/2420/2 "2026-11-17T14:38:06Z")

</div>

Paths probably lack the leading “server/”.

This looks like a real gap in v1.0, not a configuration mistake on your side.

When the automatic DKIM management task creates a signature, it builds the new `DkimSignature` from scratch. It sets only the stage, domain, selector, private key and (on Enterprise) the tenant, then fills everything else with `..Default::default()`. I found no code that reads the existing signature for the domain and copies its `Signed Headers` onto the replacement. The task only looks at the existing signatures to decide which algorithms still need a new key and which rotation stage each one is in. So any non-default signed headers, such as your `CC`, are lost when the replacement key is created. This matches what you observed.

I only read the creation path in `crates/services/src/task_manager/tasks/dkim.rs`. I didn’t find a setting that changes this, and I can’t promise there isn’t one elsewhere. As far as I can tell, you’d have to re-add the headers to each new `DkimSignature` object after each rotation. You can do that in the WebUI or with `stalwart-cli`. A permanent fix would need a code change, so a staff member will need to confirm and follow up here.

_This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong._

---

<div class="post-metadata">

### Author: ![stalwart](https://support.stalw.art/user_avatar/support.stalw.art/stalwart/32/12_2.png) [@stalwart](https://support.stalw.art/u/stalwart)
#### Post date: [November 19, 2026, 9:51am UTC](https://support.stalw.art/t/automatic-dkim-rotation-doesnt-carry-over-custom-signed-headers/2420/3 "2026-11-19T09:51:33Z")

</div>

Fixed for the next weekly Stalwart release. When automatic management rotates a key, the new `DkimSignature` now starts from the one it replaces: signed headers, canonicalization, expiry, AUID, the report flag and the third-party settings all carry over, and only the selector, key and rotation dates are new.

The new key is copied from the current active one, so after upgrading, check that the active signature for each algorithm still has `Cc` in “Signed Headers”. If a rotation already reset it, add it back once and every key after that will keep it. Until the release is out, re-adding the extra headers to the new signature after each rotation is the workaround.
