ADR-0037: Mail on a subdomain through SES, while the apex still refuses it#

  • Status: accepted. Answers ADR-0008's Revisit when for one subdomain; the apex keeps ADR-0008.
  • Date: 2026-11-28

Context#

ADR-0008 locks mail out of testz.dev because none was wanted. Mail is now wanted, to demonstrate what a domain that refuses mail can only refuse: DKIM signing, DMARC reports, and MTA-STS and TLSRPT, the radar's Hold items whose condition this meets. Those two contradict a null MX, and are correct with a real one.

No person holds AWS credentials day to day (security posture), so nobody can sign in to read mail. SES receipt rules have no monthly fee: about $0.10 per 1,000 messages each way, plus $0.09 per 1,000 incoming chunks of 256 KB.

Decision#

  1. Mail lives on mail.testz.dev. The apex still refuses mail (ADR-0008); the subdomain's own DMARC record overrides sp=reject for that name. Its records are in the apex zone, behind enable_mail, whose off path tofu test covers.
  2. SES receives into S3. One receipt rule names exact recipients, and SES blocks any other. It requires TLS, scans for spam and viruses, and writes each message to a private bucket: SSE-S3, writable only by this account's rule, with a 30-day expiry.
  3. A forwarder sends each message to the alarm address, unparsed. A standard-library Lambda function attaches the stored message whole, as message/rfc822; nothing from it reaches the forward's headers. A message failing the spam or virus verdict is stored, not forwarded.
  4. Sending stays in the SES sandbox: verified recipients only, 200 a day, which caps what a mistake can send. Easy DKIM's CNAME records also verify the domain. The MAIL FROM domain rejects rather than fall back to amazonses.com.
  5. The subdomain publishes:
    • at mail, MX 10 inbound-smtp.us-east-1.amazonaws.com and SPF v=spf1 -all, since no envelope uses the name;
    • at bounce.mail, the MAIL FROM domain, MX 10 feedback-smtp.us-east-1.amazonses.com and SPF v=spf1 include:amazonses.com -all;
    • three Easy DKIM CNAMEs, and v=DKIM1; p= at *._domainkey.mail, revoking any other selector: a wildcard never matches a name that exists (RFC 4592);
    • at _dmarc.mail, v=DMARC1; p=reject; adkim=s; aspf=s; rua=mailto:dmarc@mail.testz.dev;
    • MTA-STS at _mta-sts.mail (RFC 8461), and TLSRPT at _smtp._tls.mail reporting to tlsrpt@mail.testz.dev (RFC 8460);
    • mta-sts.mail, aliased to the existing distribution.
  6. MTA-STS starts in testing, and moves to enforce under this decision once TLS reports show senders validating SES's certificate. The existing distribution serves the policy, with mta-sts.mail.testz.dev added to its certificate, and never redirects on that name.
  7. Checked from outside: the health check reads the subdomain's records and policy, but makes no SMTP connection.

Alternatives considered#

Mail on the apex. A mistake would weaken the domain's own spoofing defence (principle 6), and the contrast with a name that refuses mail would go.

Reading mail in the S3 console. Needs root, kept for three named jobs, or a human identity, which ADR-0014 removed.

SES's SNS action. No code, but it bounces any message over 150 KB.

A forwarder that rewrites the original's headers, ADR-0008's route. It parses untrusted MIME.

A home mail server relaying through SES. Invisible from outside, and it needs long-lived SES and S3 credentials outside CI (principle 4) and a server to patch.

A forwarding or hosted provider. A third party reads every message (principle 5).

SES Mail Manager. $50 a month, about thirty times the bill.

aspf=r. SES's MAIL FROM domain must be a subdomain, so only relaxed alignment lets SPF count. Strict, as on the apex, rests DMARC on DKIM, which SES applies to every message.

Consequences#

Positive: the four standards work beside an apex that refuses mail, for about $0.00 a month, with no server, credential or third party added. It gives security.txt, a CAA iodef and the apex's DMARC reports (ADR-0038) an address on the domain.

Negative:

  • The first thing here that accepts anyone's input: messages are billed, only the budget's forecast notification catches a flood, and they are other people's data.
  • A Lambda function to maintain, and forwarded spam the owner reports counts against SES reputation.
  • SES's inbound TLS is seen only in senders' reports, and no DANE can be published for it: the MX host is Amazon's.
  • A sender that cannot fetch the policy over TLS 1.3 (ADR-0004) sees none.
  • The CI roles gain SES and Lambda permissions (ADR-0030), applied in the bootstrap layer first, and the certificate gains a name.

Neutral: the forwarder's tests are its only new mechanism, a check target that goes with it (ADR-0029). The AWS WAF Hold condition is not met: WAF does not front SMTP, and the policy file is static.

Revisit when#

  • Mail must reach unverified addresses, or be read as a mailbox.
  • DANE is wanted: it needs an MX whose key this project controls.
  • Spam shows on the bill, or SES retires receipt rules.

Built 2026-12-01 from commit 5f3eb2c4b04f9d8367364b6f4598a05a364e2263. This page was generated from the same source that provisions the infrastructure it describes.