Relay: relays in the domains' MX and SPF records (RL-25) #268

Merged
jcoffey-dev merged 1 commits from relay/dns into main 2026-10-30 22:01:32 +00:00
Owner

Relays in the domains' MX and SPF records (relay spec, RL-25).

  • Which relays: a relay counts for a domain when it's enabled, joined, has a public name, and its domains name the domain or name none. With none, a domain's records are made as before.
  • MX: the relays, each at its new mxPreference (10 by default; on inbuxa:Relay get and set). The server's own MX hosts are left out.
  • SPF: v=spf1 a:<host> ... -all, naming the relays not marked inboundOnly, plus this server's own MX hosts unless an enabled relay has sendThrough on. It uses a: because a relay's link address isn't the one it sends from. Each host under the domain gets v=spf1 a -all for its HELO name. With more than ten hosts, SPF's lookup limit would make every check fail, so the domain's SPF record is left as it is and a dns.build-error event says why.
  • Republishing: the DNS task only ran when a domain was saved, so the link service now keeps a hash of what the relays put in any domain's records. When it changes, it queues the MX and SPF records again for every domain with Automatic DNS that publishes them, and only then records the new hash. With nothing recorded and no relays, nothing is queued, so upgrading a server without relays publishes nothing new.
  • MX guard: a publish never cuts a published MX set of two or more hosts down to one. That record set is left alone, and the task fails with a reason that says so. This also applies without relays.
  • The zone file a domain with Manual DNS exports uses the same records.

Not in this PR: the console field for mxPreference (next, in inbuxa-admin), certificates (RL-27) and upgrades (RL-29).

Tests:

  • relay::dns unit tests (MX set, senders, sendThrough, SPF limit, what changes the hash) and the MX-guard unit test pass.
  • relay_link_tests now checks that the joined test relay is example.com's only MX host, at 10 and then 20 after an mxPreference change, and that SPF names it and this server. It passes, as does relay_tests.
  • fmt, clippy on the changed files, and the fork checks are clean.
Relays in the domains' MX and SPF records (relay spec, RL-25). - **Which relays:** a relay counts for a domain when it's enabled, joined, has a public name, and its `domains` name the domain or name none. With none, a domain's records are made as before. - **MX:** the relays, each at its new `mxPreference` (10 by default; on `inbuxa:Relay` get and set). The server's own MX hosts are left out. - **SPF:** `v=spf1 a:<host> ... -all`, naming the relays not marked `inboundOnly`, plus this server's own MX hosts unless an enabled relay has `sendThrough` on. It uses `a:` because a relay's link address isn't the one it sends from. Each host under the domain gets `v=spf1 a -all` for its HELO name. With more than ten hosts, SPF's lookup limit would make every check fail, so the domain's SPF record is left as it is and a `dns.build-error` event says why. - **Republishing:** the DNS task only ran when a domain was saved, so the link service now keeps a hash of what the relays put in any domain's records. When it changes, it queues the MX and SPF records again for every domain with Automatic DNS that publishes them, and only then records the new hash. With nothing recorded and no relays, nothing is queued, so upgrading a server without relays publishes nothing new. - **MX guard:** a publish never cuts a published MX set of two or more hosts down to one. That record set is left alone, and the task fails with a reason that says so. This also applies without relays. - The zone file a domain with Manual DNS exports uses the same records. Not in this PR: the console field for `mxPreference` (next, in inbuxa-admin), certificates (RL-27) and upgrades (RL-29). Tests: - `relay::dns` unit tests (MX set, senders, `sendThrough`, SPF limit, what changes the hash) and the MX-guard unit test pass. - `relay_link_tests` now checks that the joined test relay is example.com's only MX host, at 10 and then 20 after an `mxPreference` change, and that SPF names it and this server. It passes, as does `relay_tests`. - fmt, clippy on the changed files, and the fork checks are clean.
jcoffey-dev added 1 commit 2026-10-30 21:48:18 +00:00
Relay: relays in the domains' MX and SPF records (RL-25)
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 8m46s
00bd215cc1
A relay that is enabled, joined and has a public name is in the records
of the domains it serves: their MX set is the relays, each at its new
mxPreference (10 by default), and SPF names each sending host by its
address records. The relays marked inboundOnly are left out of SPF, and
this server's own hosts are in it unless a relay has sendThrough on.
Hosts under the domain get their own HELO policy. Past SPF's ten
lookups, the domain's SPF record is left as it is, with an event.

When what the relays put in the records changes, the link service
queues the MX and SPF records again for every domain with Automatic DNS
that publishes them. A hash of it is kept in the store, so a server with
no relays publishes nothing new.

A publish never cuts an MX set of two or more hosts down to one: that
record set is left as it is and the task says why.
jcoffey-dev merged commit a1575595d3 into main 2026-10-30 22:01:32 +00:00
jcoffey-dev deleted branch relay/dns 2026-10-30 22:01:32 +00:00
Sign in to join this conversation.