Registrar: glue records for in-bailiwick name servers #87

Merged
calvin merged 2 commits from registrar-glue into master 2026-11-16 03:14:02 +00:00
Owner

Why

Salt's registrar module sent name servers as host names only. A domain served by name servers under itself (in bailiwick, e.g. trouweherverdeling.nl on ns1.trouweherverdeling.nl) needs glue: the registry cannot find those servers without their addresses. This adds glue to register, transfer and set_name_servers, through the module API and the HTTP registrar API.

What changed

  • SaltDns.Registrar.NameServers (new). Normalises a plain host name or a map/struct with name, optional ipv4 and ipv6; validates both address forms and normalises them (IPv4 4-tuple / IPv6 8-tuple, canonical text). prepare/3 enforces bailiwick and carries stored glue forward.
  • Context (SaltDns.Registrar). register/transfer and set_name_servers validate and normalise entries before anything is written or sent. In-bailiwick without an address is {:error, {:invalid, ...}} and nothing is sent. Out-of-bailiwick with an address is refused (not silently dropped) because registries ignore or refuse it; silent data loss was the hazard this change exists to remove. The addresses are stored in the new registrar_domains.name_server_addresses (migration 20261128090000, new column with a default); sync_domain keeps what the registrar reports; a later set_name_servers naming the same server without an address carries its glue forward.
  • Fingerprint. When any address is present, the canonical names+addresses are part of the operation fingerprint, so the same reference with other glue is reference_reuse. Plain-name requests keep their old fingerprint (no forced rehash of existing operations).
  • Openprovider adapter. Sends Openprovider's domainNameserver shape: {"name": ..., "ip": <IPv4>, "ip6": <IPv6>}. Field names confirmed from https://developer.openprovider.com/data/swagger.json (definitions domainNameserver / ns_groupNameServersSet). seq_nr is optional there and is not sent: array order gives the sequence, and plain names are sent exactly as before. A domain read keeps ip/ip6.
  • HTTP API. PUT /registrar/domains/{fqdn} accepts optional name_servers (strings or {name, ipv4, ipv6} objects); PUT /registrar/domains/{fqdn}/name-servers replaces them. Domain answers gain name_server_addresses. OpenAPI and docs/integrations/registrar.md updated; "Glue" section added to docs/registrar.md; CHANGELOG updated.
  • Console. There is no console view that shows a domain's name servers (the Registrar page lists name, status, expiry, auto-renew, lock only), so there was nothing to extend.

Acceptance criteria

  • Plain host names still accepted everywhere; map/struct entries with name, optional ipv4, optional ipv6 accepted.
  • Address forms validated and normalised (IPv4 vs IPv6 enforced).
  • In-bailiwick name server without an address refused with {:error, {:invalid, ...}}, nothing sent.
  • Out-of-bailiwick addresses refused (safer than silent dropping), documented with the reason.
  • Openprovider request body uses name/ip/ip6; plain names unchanged.
  • sync_domain keeps addresses; a later set_name_servers does not drop stored glue.
  • Fingerprint changes when glue changes; plain-name fingerprints unchanged.
  • Module API and HTTP registrar API (register/transfer input + name-servers route), OpenAPI + docs.
  • Tests added for adapter bodies (v4, v6, both), validation, out-of-bailiwick, plain names, sync, set, API, fingerprint.

Checks run

  • mise exec -- mix precommit — passed (hex.audit, format check, compile warnings-as-errors, deps.unlock, credo --strict, sobelow, deps.audit, mix test --warnings-as-errors): 1567 passed (49 properties, 1518 tests), 1696 excluded.
  • mise exec -- mix coveralls — passed, total 90.5%; new name_servers.ex 93.0%.
  • MIX_ENV=dev mise exec -- mix docs --warnings-as-errors — passed.
  • Registrar integration tests against a throwaway Postgres (mix test --only integration for registrar_test.exs, registrar_controller_test.exs, registrar_worker_test.exs): 174 passed.
  • Not run: the full :integration suite (it needs the complete Knot/PowerDNS/BIND stack, not only Postgres).

No deployment, no live Salt or Openprovider calls.

🤖 Generated with Claude Code

## Why Salt's registrar module sent name servers as host names only. A domain served by name servers under itself (in bailiwick, e.g. `trouweherverdeling.nl` on `ns1.trouweherverdeling.nl`) needs glue: the registry cannot find those servers without their addresses. This adds glue to `register`, `transfer` and `set_name_servers`, through the module API and the HTTP registrar API. ## What changed - **`SaltDns.Registrar.NameServers` (new).** Normalises a plain host name or a map/struct with `name`, optional `ipv4` and `ipv6`; validates both address forms and normalises them (IPv4 4-tuple / IPv6 8-tuple, canonical text). `prepare/3` enforces bailiwick and carries stored glue forward. - **Context (`SaltDns.Registrar`).** `register`/`transfer` and `set_name_servers` validate and normalise entries before anything is written or sent. In-bailiwick without an address is `{:error, {:invalid, ...}}` and nothing is sent. Out-of-bailiwick **with** an address is refused (not silently dropped) because registries ignore or refuse it; silent data loss was the hazard this change exists to remove. The addresses are stored in the new `registrar_domains.name_server_addresses` (migration `20261128090000`, new column with a default); `sync_domain` keeps what the registrar reports; a later `set_name_servers` naming the same server without an address carries its glue forward. - **Fingerprint.** When any address is present, the canonical names+addresses are part of the operation fingerprint, so the same reference with other glue is `reference_reuse`. Plain-name requests keep their old fingerprint (no forced rehash of existing operations). - **Openprovider adapter.** Sends Openprovider's `domainNameserver` shape: `{"name": ..., "ip": <IPv4>, "ip6": <IPv6>}`. Field names confirmed from `https://developer.openprovider.com/data/swagger.json` (definitions `domainNameserver` / `ns_groupNameServersSet`). `seq_nr` is optional there and is not sent: array order gives the sequence, and plain names are sent exactly as before. A domain read keeps `ip`/`ip6`. - **HTTP API.** `PUT /registrar/domains/{fqdn}` accepts optional `name_servers` (strings or `{name, ipv4, ipv6}` objects); `PUT /registrar/domains/{fqdn}/name-servers` replaces them. Domain answers gain `name_server_addresses`. OpenAPI and `docs/integrations/registrar.md` updated; "Glue" section added to `docs/registrar.md`; CHANGELOG updated. - **Console.** There is no console view that shows a domain's name servers (the Registrar page lists name, status, expiry, auto-renew, lock only), so there was nothing to extend. ## Acceptance criteria - [x] Plain host names still accepted everywhere; map/struct entries with `name`, optional `ipv4`, optional `ipv6` accepted. - [x] Address forms validated and normalised (IPv4 vs IPv6 enforced). - [x] In-bailiwick name server without an address refused with `{:error, {:invalid, ...}}`, nothing sent. - [x] Out-of-bailiwick addresses refused (safer than silent dropping), documented with the reason. - [x] Openprovider request body uses `name`/`ip`/`ip6`; plain names unchanged. - [x] `sync_domain` keeps addresses; a later `set_name_servers` does not drop stored glue. - [x] Fingerprint changes when glue changes; plain-name fingerprints unchanged. - [x] Module API and HTTP registrar API (register/transfer input + name-servers route), OpenAPI + docs. - [x] Tests added for adapter bodies (v4, v6, both), validation, out-of-bailiwick, plain names, sync, set, API, fingerprint. ## Checks run - `mise exec -- mix precommit` — passed (hex.audit, format check, compile warnings-as-errors, deps.unlock, credo --strict, sobelow, deps.audit, `mix test --warnings-as-errors`): **1567 passed (49 properties, 1518 tests), 1696 excluded**. - `mise exec -- mix coveralls` — passed, total **90.5%**; new `name_servers.ex` **93.0%**. - `MIX_ENV=dev mise exec -- mix docs --warnings-as-errors` — passed. - Registrar integration tests against a throwaway Postgres (`mix test --only integration` for `registrar_test.exs`, `registrar_controller_test.exs`, `registrar_worker_test.exs`): **174 passed**. - **Not run:** the full `:integration` suite (it needs the complete Knot/PowerDNS/BIND stack, not only Postgres). No deployment, no live Salt or Openprovider calls. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Registrar: glue records for in-bailiwick name servers
Some checks failed
ci/woodpecker/pr/integration Pipeline is pending
ci/woodpecker/pr/quality Pipeline was canceled
ci/woodpecker/pr/image Pipeline was canceled
7433edeb46
A name server passed to register, transfer or set_name_servers may now be
a plain host name (as before) or an entry with name, ipv4 and ipv6. A name
server that is the domain itself or under it needs an address; an address
on one outside the domain is refused rather than dropped.

The Openprovider adapter sends the addresses as ip and ip6 (the registrar's
own domainNameserver field names), and a domain read back keeps the
addresses in registrar_domains.name_server_addresses (migration
20261128090000, a new column with a default). A later set_name_servers that
names a stored server without an address carries its glue forward, and the
addresses are part of a spending call's fingerprint.

The HTTP registrar API accepts name_servers on PUT /registrar/domains/{fqdn}
and has PUT /registrar/domains/{fqdn}/name-servers; both are in the OpenAPI
document. Docs: the new "Glue" section of docs/registrar.md.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Registrar: say that glue is part of the fingerprint
All checks were successful
ci/woodpecker/pr/image Pipeline was successful
ci/woodpecker/pr/quality Pipeline was successful
ci/woodpecker/pr/integration Pipeline was successful
808dff384e
The module documentation, the operation schema and docs/registrar.md listed
the fields a spending call's fingerprint covers; name servers and their glue
addresses are now among them. Documentation only.

Co-Authored-By: Claude Code <noreply@anthropic.com>
calvin merged commit 365468c32b into master 2026-11-16 03:14:02 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
external/salt-dns!87
No description provided.