Skip to content

Delegated Domains

A delegated domain is a DNS zone this cluster is authoritative for. Adding one does two things:

  1. It restricts service creation to names inside a verified zone (the original behaviour), and
  2. it makes the DNS server authoritative for the zone's whole subtree: SOA and NS at its apex, and NXDOMAIN — carrying that zone's SOA — for every name below it that is not a configured service or static record.

The zone set is the configured dns.domain plus every delegated domain. A name outside every zone is answered REFUSED.

Delegation is verified by checking that the zone's NS records point at the cluster's own nameserver(s) and, optionally, that a DS record is present in the parent zone. Verification is the parent's view of the delegation and does not gate serving: an unverified zone is served, because refusing to be authoritative until the parent is correct is the exact failure this feature exists to prevent.

Declaring a zone claims its whole subtree. Every name under the apex that Nexus does not know about answers NXDOMAIN, not "not my problem". A zone with zero services under it is almost always a mistyped apex.


Model

Field Type Description
id string UUID assigned on creation
domain string Fully-qualified domain name (trailing dot optional)
verified bool true if NS verification has passed
nsOk bool true if NS records point to this cluster
dsOk bool true if DS record is present in parent zone
lastVerifiedAt int64? Unix timestamp of last successful verification
verificationError string Last verification error, if any
createdAt int64 Unix timestamp of creation

Per-zone SOA / NS overrides

Every field below is optional. Empty string or 0 means inherit the cluster-wide default from config, so a zone states only what it overrides.

Field Type Inherits from Default
soaMname string dns.nsHostname ns1.<apex>
soaRname string dns.adminEmail hostmaster.<apex>

soaRname and dns.adminEmail accept either the wire form (hostmaster.example.com) or a plain address (hostmaster@example.com); the @ is converted to the RFC 1035 §8 label separator before the SOA is served, and a dot in the local part is escaped. A literal @ on the wire is rejected by strict software — Technitium, for one, refuses to build a stub zone against such an SOA. | soaSerial | int | — | 0 = auto (see below) | | soaRefresh | int | dns.soa.refresh | 3600 | | soaRetry | int | dns.soa.retry | 900 | | soaExpire | int | dns.soa.expire | 604800 | | soaMinimum | int | dns.soa.minimum | 300 | | soaTtl | int | dns.soa.ttl | 300 | | nsNames | []string | dns.nsNames | none | | nsTtl | int | dns.soa.nsTtl | 3600 | | dnssecEnabled | bool | — | false (see DNSSEC and zones) |

GET responses also carry a read-only signing field: whether the zone is actually being signed. It is a different question from dnssecEnabled — the configured dnssec.zone signs from config with the flag false, and a zone flagged enabled with no signer (no NATS, so nowhere to keep keys) reports signing: false. Surfaces show the truth from signing; gslbctl domains list prints dnssec:on, dnssec:cfg (signs from config) or dnssec:err (flagged but not signing).

MNAME, RNAME and NS entries are qualified rather than rejected when the trailing dot is missing. A single-label name (ns1) is rejected — that is a mistake, not an abbreviation. Duplicate NS entries are silently dropped.

An omitted nsNames inherits dns.nsNames; an explicitly empty array means the zone serves no NS records at all. That is legal but rarely what you want: a stub zone or conditional forwarder fetches the NS set from us and will not resolve without it.

The automatic serial

With soaSerial at 0 the serial comes from the cluster's zone-state version — the newest updated_at across pools, members, services and geo rules, plus health transitions. That gives two properties a wall-clock serial cannot:

  • Stable. Two queries with no state change in between return the same serial, so a secondary does not transfer on every poll.
  • Cluster-consistent. Every node derives it from the same replicated rows, so all of them publish the same serial for the same zone. A strict validator comparing nameservers, or a stub zone refreshing against two of them, sees one answer.

Set an explicit soaSerial only when something upstream requires a serial you control (a hidden-primary arrangement, or a migration from another server whose serial you must not go backwards from).

Delegation setup instructions

GET /api/v1/domains/{id} and the create response both carry delegationSetup: the records to create in the parent zone, derived from the zone's effective NS set rather than the stored overrides, so it matches what is actually being served.

Field Meaning
parent The zone whose records must change — where the operator has to go
records[] NS, then any A/AAAA glue, then DS when the zone is signed
records[].glue The parent must hold this address itself (in-zone nameserver)
zoneFile The same records as a paste-ready block
problems[] Must be fixed here first (see below)
notes[] Non-blocking guidance

Glue is emitted only for a nameserver inside the delegated zone, and only from an address record this cluster actually serves for that name. A nameserver outside the zone needs no glue and gets a note instead: it has to resolve on its own. An in-zone nameserver with no address record here becomes a problem — never a guessed node IP, because glue pointing at whichever address the cluster happened to be listening on is harder to debug than glue that is absent.

Surfaces: gslbctl domains setup <zone> (also printed automatically by domains add and domains show when NS verification has not passed), and the zone editor on Admin → Domains, which opens automatically for a zone that was just added.

Nested zones

Zones may nest. The longest matching suffix wins, on label boundaries: with example.com and inner.example.com both declared, a.b.inner.example.com belongs to inner.example.com, while notinner.example.com belongs to example.com.

Each zone serves its own SOA everywhere it appears — at the apex, in a negative answer's authority section, and in an AXFR. A zone transfer of a parent does not hand over records belonging to a nested child; the child is transferred separately.

DNSSEC and zones

Signing is per zone. Each zone is either signed with its own KSK/ZSK pair or served unsigned; no zone is ever signed with another zone's keys.

Two ways a zone comes to be signed:

  • dnssec.zone in config. Its keys load from the configured PEM files or env vars at startup, exactly as before. This zone is pinned: a database row cannot switch it off. If dnssec.zone is not one of the configured zones, the daemon logs an error at startup rather than quietly signing nothing.
  • dnssecEnabled on a delegated domain. Set it and the cluster generates that zone's keys on first enable, stores them in the shared NATS KV bucket and starts signing — no restart, no openssl, no PEM to paste.

Turning dnssecEnabled off stops the signing but keeps the keys. Switching it back on resumes with the same DS, so the record an operator pasted at the registrar stays valid. Deleting the zone leaves its keys in KV too; re-declaring the same apex picks them up.

That does mean a deleted zone's keys are referenced by nothing. To see which zones still hold keys, open Admin → DNSSEC (the "Keys kept for unsigned zones" card, with a Purge keys button per zone) or run gslbctl dnssec kept-keys. The list shows only zones you may purge, so a deleted zone appears to a system admin only. To remove them from the command line:

gslbctl dnssec purge --zone old.example.com --confirm

It refuses while the zone is still signing, and it is deliberately not what disabling does: a purged zone signed again gets new keys and therefore a new DS, breaking the delegation at its parent until that one is published.

Generation uses Create on the KV key, not Put, so when several nodes notice the same newly-flagged zone at the same moment exactly one key pair wins and the rest adopt it. A zone therefore has one DNSKEY set cluster-wide, never one per node.

Per-zone signing requires NATS. Without a JetStream connection there is nowhere cluster-safe to keep a generated key — a node-local key would give each node a different DNSKEY for the same zone, which validators read as bogus — so enabling a zone without NATS fails and is logged. The configured dnssec.zone is unaffected: its keys come from files, which is why it alone can sign on a single node with no NATS.

Signing can also be started from the DNSSEC surfaces rather than the zone editor, which is where the import option lives:

gslbctl dnssec enable --zone shop.example.com                      # generate keys
gslbctl dnssec enable --zone shop.example.com \
  --ksk-pem ksk.pem --zsk-pem zsk.pem                              # import existing keys

POST /api/v1/dnssec/zones is the same operation, and Admin → DNSSEC exposes both forms with the resulting DS shown for copying. Importing matters for a zone moving here from another provider: its DS is already published at the parent, and signing with a fresh pair breaks validation for everyone until the new DS propagates. The keys must be ECDSA P-256 (algorithm 13) — the only algorithm the signer implements.

Every DNSSEC endpoint and gslbctl dnssec subcommand takes an optional zone:

gslbctl dnssec zones                          # what is signed
gslbctl dnssec ds     --zone shop.example.com # the DS to publish at the parent
gslbctl dnssec zsk rotate --zone shop.example.com   # roll one zone only

Omitting the zone means the configured dnssec.zone, which is what these commands always acted on. A roll addresses one zone's keys and leaves every other zone's tags untouched.

CDS and CDNSKEY — letting the parent update its own DS

Every signed zone publishes CDS and CDNSKEY at its apex (RFC 7344). They are the zone's own statement of what the parent's DS RRset should contain, so a registry that polls for them updates the delegation without anyone copying a digest by hand:

dig @ns1.example.com shop.example.com CDS +dnssec

Two details matter operationally:

  • They are signed with the KSK, not the ZSK. The parent checks them against the DS it already holds, and that DS covers the KSK — a ZSK signature would be unverifiable with the only key the parent knows.
  • During a KSK roll both keys are published, outgoing and incoming, and the RRset is signed by both. The parent should end up with a DS RRset covering both for the length of the double-signing window. Publishing only the incoming key would break validation for every resolver still holding the old DS; publishing only the outgoing key would never finish the roll. Once gslbctl dnssec ksk commit runs, the CDS drops back to the single new key.

Delegation health (below) watches the other half of this: while a roll is in flight and the parent has not yet published the incoming key's DS, the zone reports

KSK roll in progress: parent has not published the DS for the incoming key
(tag 14014, CDS is published) — do not commit the roll yet

which is exactly the condition under which committing breaks the zone.

gslbctl dnssec status prints the CDS records for a registrar that does not poll for them, and GET /api/v1/dnssec/status returns the same list as cds.

The RFC 8078 §4 delete sentinel is not published. A CDS with algorithm 0 asks the parent to remove the DS and take the zone insecure, but it only counts if it is signed — and a zone that has stopped signing has no signer to sign it with. Going insecure therefore stays a manual step at the registrar. (Disabling signing here deliberately keeps the keys, so the existing DS stays valid until you remove it yourself.)


API

List delegated domains

GET /api/v1/domains

Response 200 OK: array of DelegatedDomain objects.

[
  {
    "id": "abc123...",
    "domain": "gslb.example.com.",
    "verified": true,
    "nsOk": true,
    "dsOk": false,
    "lastVerifiedAt": 1716100000,
    "createdAt": 1716090000
  }
]

Create a delegated domain

POST /api/v1/domains

Field Type Required Description
domain string yes Domain to delegate (e.g. gslb.example.com)

Any of the SOA/NS override fields above may be sent alongside domain.

Response 201 Created: the created DelegatedDomain object. 409 when the apex — or a zone above it — already belongs to another tenant, or the apex is dns.domain and the caller is not the system admin. See Zone ownership.

curl -X POST https://nexus-api.example.com/api/v1/domains \
  -H "Authorization: Bearer $GSLB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain":"gslb.example.com"}'

Get one domain, with what is actually being served

GET /api/v1/domains/{id}

Returns the stored zone plus effectiveSoa (overrides merged over the config defaults, auto serial resolved to its current value) and the services covered by the zone. A serviceCount of 0 is the tell-tale of a mistyped apex.

{
  "id": "abc123...",
  "domain": "gslb.example.com",
  "effectiveSoa": {
    "apex": "gslb.example.com.",
    "mname": "ns1.gslb.example.com.",
    "rname": "hostmaster.gslb.example.com.",
    "serial": 1754740000, "autoSerial": true,
    "refresh": 3600, "retry": 900, "expire": 604800, "minimum": 300, "ttl": 300,
    "nsNames": ["ns1.gslb.example.com.", "ns2.gslb.example.com."], "nsTtl": 3600
  },
  "serviceCount": 2,
  "services": ["www.gslb.example.com", "api.gslb.example.com"]
}

Replace a zone's SOA/NS overrides

PUT /api/v1/domains/{id}

Takes the same override fields. This is a full replace, not a patch: an omitted field is stored as "inherit", so clearing an override is just leaving it out.

curl -X PUT https://nexus-api.example.com/api/v1/domains/$DOMAIN_ID \
  -H "Authorization: Bearer $GSLB_API_KEY" -H "Content-Type: application/json" \
  -d '{"soaMname":"ns1.gslb.example.com","soaRefresh":7200,
       "nsNames":["ns1.gslb.example.com","ns2.gslb.example.com"]}'

Verify a delegated domain

POST /api/v1/domains/{id}/verify

Triggers an immediate NS and DS check. Returns the updated DelegatedDomain.

curl -X POST https://nexus-api.example.com/api/v1/domains/$DOMAIN_ID/verify \
  -H "Authorization: Bearer $GSLB_API_KEY"

Delete a delegated domain

DELETE /api/v1/domains/{id}

Response 204 No Content.


gslbctl

# List delegated domains
gslbctl domains list --server https://nexus.example.com:8880

# Add a domain
gslbctl domains add gslb.example.com --server https://nexus.example.com:8880

# Verify a domain (triggers NS/DS check)
gslbctl domains verify <domain-id> --server https://nexus.example.com:8880

# Delete a domain
gslbctl domains delete <domain-id> --server https://nexus.example.com:8880

# Show the effective zone: merged SOA/NS, resolved auto serial, covered services
gslbctl domains show gslb.example.com

# Replace the zone's overrides (unset flags mean "inherit")
gslbctl domains set gslb.example.com \
  --mname ns1.gslb.example.com --refresh 7200 \
  --ns ns1.gslb.example.com,ns2.gslb.example.com

Terraform

resource "nexus_domain" "gslb" {
  domain = "gslb.example.com"

  # All optional — omit to inherit the cluster defaults.
  soa_mname   = "ns1.gslb.example.com"
  soa_refresh = 7200
  ns_names    = ["ns1.gslb.example.com", "ns2.gslb.example.com"]
}
Attribute Type Required Description
domain string yes Domain to delegate (ForceNew)
soa_mname, soa_rname string no SOA MNAME / RNAME; empty inherits
soa_serial number no Fixed serial; 0 = auto
soa_refresh, soa_retry, soa_expire, soa_minimum, soa_ttl number no SOA timers; 0 inherits
ns_names list(string) no Apex NS names; omit to inherit
ns_ttl number no NS RRset TTL; 0 inherits

verified, ns_ok, ds_ok and verification_error are read-only.


Delegation health monitoring

Adding a zone makes us authoritative for it. It does not make the parent correct, and the parent is the half that breaks: an NS record left behind after a migration, missing glue, a DS that no longer matches the KSK, a secondary that quietly stopped transferring. None of that is visible from a dig on a machine whose resolver already has the delegation cached — which is exactly why this class of outage is discovered by customers rather than by monitoring.

A background checker (Solo #607) asks the parent's own nameservers, with recursion off, once per interval per delegated zone:

Check What it compares
Parent NS set the NS the parent hands out, against the NS we serve at the apex — reported as missing at parent and extra at parent
Glue in-zone nameservers (ns1.gslb.example.com serving gslb.example.com) must have A/AAAA glue at the parent
DS the parent's DS key tags against the live KSK. Skipped for zones DNSSEC does not sign; a leftover DS on an unsigned zone is reported
Secondary lag each dns.axfr.notify target's SOA serial against ours, using RFC 1982 serial arithmetic. A secondary that is ahead is not a fault — that is the normal state for a moment after a change

Only delegated domains are checked. The zone that comes from dns.domain alone is not: on a fresh install it is a placeholder (gslb.local) that nobody has delegated, and checking it would alert forever about a delegation that was never meant to exist.

The checker runs on the rqlite Raft leader only. Every input is a fact about the outside world that all nodes would observe identically, so running it everywhere would triple the query load on other people's nameservers and page three times per fault — the same reasoning that gates the MaxMind fetch alert. During a leader election nobody checks, and the next tick picks it up.

dns:
  delegationCheck:
    enabled: true       # default; only delegated domains are ever checked
    interval: 15m       # default; minimum 1m
    resolver: 1.1.1.1:53  # used ONLY to discover the parent's nameservers

Alerts go through the existing webhook / PagerDuty / OpsGenie / email channels as delegation.unhealthy, at most once per 6 hours per zone — a wrong DS stays wrong until somebody edits the parent, so this is not a flap suppressor. A zone that recovers has its cooldown cleared, so a fault that returns pages again.

API

GET /api/v1/delegation returns the latest check for every zone; the same result is on GET /api/v1/domains/{id} as delegation. Both use domain:read.

[
  {
    "zone": "gslb.example.com.",
    "checkedAt": 1786293609,
    "healthy": false,
    "problems": [
      "parent does not publish NS ns2.gslb.example.com.",
      "secondary 198.51.100.5:53 is 3 serial(s) behind (has 1786290000)"
    ]
  }
]
gslbctl domains health

Configuration

Cluster-wide SOA defaults, inherited by every zone that does not override them:

dns:
  domain: gslb.example.com     # the default zone, always present
  nsHostname: ns1.gslb.example.com
  adminEmail: hostmaster.gslb.example.com
  nsNames: [ns1.gslb.example.com, ns2.gslb.example.com]
  soa:
    refresh: 3600
    retry: 900
    expire: 604800
    minimum: 300     # negative-cache TTL (RFC 2308)
    ttl: 300         # TTL of the SOA record itself
    nsTtl: 3600

With no delegated domains configured, the zone set is exactly dns.domain and behaviour is identical to before zones existed.


Setting Up Delegation

For the parent-side walkthrough (Microsoft DNS, Technitium, BIND), see Zone Delegation.

  1. Add the domain via WebUI (Admin → Domains → Add Domain), API, or gslbctl.
  2. Update your registrar to point the zone's NS records to the Nexus cluster's nameserver IPs.
  3. Trigger verification — the cluster checks that NS records resolve to itself.
  4. Optional DNSSEC: once verified, enable DNSSEC signing via Admin → DNSSEC and add the DS record to the parent zone.

Verification runs automatically on a background interval. nsOk and dsOk reflect the most recent check.


Delegating a subzone out (the other direction)

Everything above is about a zone being delegated to Nexus. The reverse — carving a subtree out of a zone Nexus already serves and handing it to someone else — is a static NS record, not a delegated-domain row:

gslbctl records create --name ns1.eu.example.com --type A  --value 192.0.2.53
gslbctl records create --name eu.example.com     --type NS --value ns1.eu.example.com.
# Optional, if the child is signed:
gslbctl records create --name eu.example.com     --type DS --value "12345 13 2 49FD…"

Queries at or below eu.example.com then get a referral (AA=0, child NS in AUTHORITY, glue in ADDITIONAL) instead of being resolved here. Full rules — glue requirements, what may coexist at a delegation point, and how signed zones prove a secure vs insecure delegation — are in StaticRecords.md → Delegating a subzone.

Choosing between the two: if the subzone is served by another operator, delegate with NS. If Nexus itself should be authoritative for it, add it as a delegated domain here instead — the two zones then coexist directly and no referral is involved. Declaring a delegated domain wins: a zone we serve is never reachable as a delegation point.


Notes

  • Domains are per-tenant. Different tenants can manage different zones on the same cluster.
  • A domain conflict (same FQDN registered by two tenants) is rejected with a 409 Conflict.
  • Trailing dot is normalised — gslb.example.com and gslb.example.com. are treated as identical.
  • The zone set is refreshed from the database every 5 seconds, and immediately on the node that served the write. Adding a zone never needs a restart.
  • AXFR and RFC 2136 UPDATE address a zone, so their question must be an exact apex of a configured zone; a name inside one is answered NOTAUTH.