Repository navigation
feat: select DKIM signers by sender domain - #18
Merged
Merged
Conversation
Support multiple DKIM identities through an array of domain configurations, selecting each signer from the message From header. Preserve global signing for existing single-table configurations. Reject ambiguous or unconfigured senders before queue acceptance, reload signer registries atomically, and defer queued messages when their signing domain is removed. Add domain-aware key generation, documentation, and an end-to-end verifier for both queue backends. Validation: cargo fmt --check, cargo test --workspace (328 unit tests and one doc test), and cargo clippy --workspace --all-targets (existing warnings only). Docker verification passed for both log and filesystem queues, including RSA/Ed25519 signature verification, reloads, sender rejection, and queued domain removal.
Deploying hedwig with
|
| Latest commit: |
494a4b1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ff3a8282.hedwig-1mq.pages.dev |
| Branch Preview URL: | https://feat-multi-domain-dkim.hedwig-1mq.pages.dev |
Preserve field-specific TOML and HUML deserialization errors and report the failing DKIM entry during key preparation. Retain configured key algorithms when generating replacement keys, and require an explicit key path when overriding a single configured domain. Document strict validation of queued messages when switching signing modes. Correct deferred-attempt logging and share retry-delay calculation. Add regression coverage for configuration errors, key-generation defaults, rejection before queue writes, and pipelined SMTP recovery after rejected DATA. Validation: 332 unit tests and one doc test passed; cargo fmt and cargo clippy --workspace --all-targets completed with existing warnings only. Docker verification passed for log and filesystem queues, including cryptographic DKIM verification and removed-domain deferral through retry exhaustion.
Require an explicit private-key path when changing a configured DKIM algorithm in either configuration mode. Identify invalid and duplicate domain entries in preparation errors, and document algorithm rotation requirements. Share bounded retry backoff across filesystem and log queues to prevent exponent overflow at high attempt counts. Cover both algorithm transitions, unchanged algorithms, domain error indexes, and retry-count boundaries with regression tests. Validation: 334 unit tests and one doc test pass; formatting and clippy complete with existing warnings only. Docker verification passes for both queue backends, including RSA/Ed25519 signatures and removed-domain retry exhaustion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hedwig currently has one global DKIM signer, so independently signing mail for multiple domains requires separate instances. This adds per-domain signing in one instance:
From: alice@example.comselects theexample.comkey, whileFrom: bob@another.comselects theanother.comkey.[[server.dkim]]. Matching uses the message From header, is case-insensitive and exact, and rejects missing, malformed, ambiguous, or unconfigured senders with550 5.7.1before queue acceptance.[server.dkim]configurations signing all outgoing messages with one key. Omitting DKIM configuration retains existing relay behavior; no migration is required.dkim-generate, configuration examples, documentation, and a Docker verifier covering both queue backends. Key generation retains the configured algorithm when overriding a selector; overriding a single configured domain or changing the configured algorithm requires an explicit private-key path.To enable domain selection, replace the single table with one array entry per domain, configure each private key, and publish each domain's DKIM DNS record. SMTP users still share the configured sending identities; per-user domain authorization is outside this change. Switching to array mode applies stricter From validation to pending mail; malformed or ambiguous messages bounce, while valid unconfigured domains retry. Drain the queue first to retain the previous rules for pending messages.
Validation:
cargo fmt --checkandgit diff --checkcargo test --workspace: 334 unit tests and one doc test passedcargo clippy --workspace --all-targets: completed with nine existing test warnings in metrics and log-queue stateuv run --with dkimpy --with pynacl dev/verify-multi-domain.py tmp/config-reload-e2e/target/release/hedwig: passed for log and filesystem queues; cryptographically verified RSA/Ed25519 signatures, From-based routing with a different envelope sender, rejection and session reuse, key rotation, failed-reload rollback, single-table compatibility, and deferral followed by retry exhaustion after queued-domain removal