Lesson 3 of 14 · 16m
DKIM Signs Bytes, Not People
DKIM is a domain-level signature over selected headers and a body hash — it proves a domain's MTA handled the message, not that the listed author wrote it.
What Actually Happens
Before your MTA transmits a message, it hashes the body, folds that hash together with a list of named headers — h=From:To:Subject:Date:Message-ID is the sensible minimum — canonicalizes both (the relaxed mode normalizes whitespace and ignores header case; simple tolerates nothing), and signs the result with its private key. The signature lands in a DKIM-Signature: header:
DKIM-Signature: v=1; a=rsa-sha256; d=sudosecurity.org;
s=v1-rsa-20261103; h=From:To:Subject:Date:Message-ID;
bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=...The receiver reads d= and s=, fetches v1-rsa-20261103._domainkey.sudosecurity.org as a DNS TXT record (v=DKIM1; k=rsa; p=<base64 public key>), recanonicalizes, rehashes, verifies. dkim=pass means: some MTA holding the private key for d=sudosecurity.org signed exactly these bytes as they passed through.
The Wrong Mental Model
The assumption: DKIM proves authorship. It proves custody. d= is whatever domain the signer chose to claim. A phishing operation's own MTA signs its own mail with d=phisher.example and gets a clean dkim=pass header.i=@phisher.example — perfectly valid, perfectly useless, because DMARC alignment (d= matching the From: domain) is a separate check SPF-and-DKIM alone don't perform. dkim=pass in isolation tells you a domain signed something. Which domain, and whether it matches From:, is your job to read.
Second half of the wrong model: that signatures survive relaying. They survive transport, not modification. A mailing list that appends a footer — "You received this because you subscribed" — changes the body hash and invalidates bh=. List software also routinely rewrites the Subject: ([listname]), which breaks the signature if Subject was in h=. This is why ARC exists (later lesson): the list preserves the original authentication results and seals them under its own identity.
Keys, Selectors, and the ed25519 Problem
The s= selector exists so you can run multiple keys at once — rotation, different senders, different algorithms. The sane convention is date-stamped names: v1-rsa-20261103._domainkey alongside v1-ed25519-20261103._domainkey, which is exactly what a Stalwart install generates today. Rotating means publishing the new selector's TXT, reconfiguring the signer, waiting for TTLs, then revoking the old key by publishing the same selector with an empty p= — not deleting the record. A deleted record looks like a DNS failure; p= empty means "this key is retired," which is an explicit, cacheable statement.
Two DNS-level gotchas live here. An RSA-2048 public key exceeds the 255-character limit of a single TXT string, so the record must be published as multiple quoted strings that resolvers concatenate — every DNS provider UI handles this differently, and a mangled paste produces dkim=permerror on every message. And resist the l= body-length tag: it tells receivers to verify only the first N bytes of the body, which is precisely the hole a signature-replay attacker wants — append their own content after byte N and your signature still validates. The spec allows it; operational reality says never use it.
Now the production caveat that bites people: ed25519 DKIM was standardized in RFC 8463 and is cryptographically better — smaller keys, faster verify — but verifier support is still uneven, and uneven in the direction people don't expect. When the mailop list ran ed25519-signed mail through the public testers in 2023, port25's check-auth@verifier.port25.com was the only one that recognized the signature cleanly — meanwhile the biggest receivers do worse: Gmail treats it as unsigned (dkim=neutral), and Microsoft 365 and Yahoo fail it outright. RSA-2048 sha256 remains the baseline that verifies everywhere; run ed25519 as a second signature if you want it, never as the only one.
Evidence
Gmail's bulk-sender rules — effective February 2024, enforced from April — made this mandatory at scale: anyone pushing more than ~5,000 messages a day to Gmail must carry SPF, DKIM, and DMARC. Yahoo matched. DKIM stopped being optional hygiene and became the admission ticket to the inbox.
Correct Practice
Sign From:To:Subject:Date:Message-ID at minimum — From must always be covered or the signature is decorative. Use relaxed/relaxed canonicalization if mailing lists or footers are in your future. Date-stamp selectors, revoke with empty p=, verify every new signer against port25's check-auth@ before you trust it. And remember what dkim=pass actually purchased: provenance of bytes through a domain, nothing about the human.
Keep reading
Related articles from the SudoSecurity blog.
Self-Hosted Email in 2026: Mailcow vs Mailu vs Stalwart — Which Mail Server Should You Trust?
Self-hosted email in 2026 comes with more choices than ever. This guide compares Mailcow, Mailu, and Stalwart across security, performance, resource usage, scalability, administration, and deliverability to help you choose the right mail server for your needs.
Stalwart 1.0 Says It's the Fastest Mail Server on the Planet. Here Are the Numbers.
After five years, Stalwart hit its first stable release on October 26 with benchmarks claiming it beats Postfix and Dovecot in 35 of 38 head-to-head tests. Every one of those numbers was produced by the vendor.
How to Self-Host Your Own Email Server With Mailcow in 2026 — Complete Setup Guide
How to Self-Host Your Own Email Server With Mailcow in 2026 — Complete Setup Guide Meta Description: Stop letting Google and Microsoft read your email. This guide sets up a complete private email server with Mailcow on a NetCup VPS — DNS, SPF, DKIM, DMARC, TLS, webmail, and mobile clients.
What Self-Hosters Are Ripping Out of Their Stacks in 2026
Self-hosted email is losing to Gmail's hard SMTP rejections. Self-hosted password managers are split down the middle. And self-hosted music is doing the opposite of what you'd expect.