feat(nebula): map fleet IPv6 overlay addresses and enable local self-resolution (#310) #318
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:cosmos
host:electra
host:fleet
host:lena
host:lyra
host:mass-storage
host:media1
host:nimmog-de
host:nova
host:pangolin
host:pangolin-vps
host:phone
host:router
host:vega
investigation
phase:cutover
phase:deploy
phase:mcp
phase:module
phase:packaging
phase:prep
phase:validation
priority:high
priority:medium
project:attic-postgres-lyra-rollout
project:auto-update-reliability
project:auto-update-remediation
project:declarative-purity-cleanup
project:external-review
project:fleet-boundary-cleanup
project:host-facts-refactor
project:lyra-nixos-deploy
project:lyra-service-stack-migration
project:nebula-mesh-network
project:nix-idioms-hygiene
project:nixos-build-deployment-pipeline
project:security-hardening
project:service-stack-migration
project:vega-sillytavern-cutover
project:wiki-rebuild
repo:numtide/flake-utils
repo:numtide/nix-auth
repo:numtide/nixos-passthru-cache
repo:numtide/nix-relay
service:auto-update
service:gitlab
service:hermes
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
service:tdarr
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!318
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/nebula-ipv6-hostmap-resolver"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Completes fleet IPv6 overlay address mapping and local self-resolution policy in
modules/networking/nebula.nix.vega(fd56:f458:569c::2),lyra(fd56:f458:569c::3), andlena(fd56:f458:569c::21) tonixosConfig.nebula.ipv6HostMapdefault, matching their minted v2 certificates.networking.hostsso that each NixOS host maps its own<hostname>.meshalias to its IPv4 and IPv6 overlay addresses. Bare<hostname>remains mapped to local loopback (127.0.0.2), preventing dual-IP collisions on the base hostname while allowing services bound to overlay IPs (e.g. Paseo daemon on10.10.0.2:6767, CoreDNS on10.10.0.2:53) to resolve and be reached locally via<hostname>.mesh.AandAAAAstatic template records for all active mesh members.README.mdto record full fleet coverage innixosConfig.nebula.ipv6HostMap.Validation
nix fmtapplied;nix flake checkpassed completely (all checks passed! flake check OK).networking.hostsacrosselectra,lena,lyra, andvega, confirming exact DNS mappings for local self-resolution and remote peers.nix build .#nixosConfigurations.electra.config.system.build.toplevelsucceeded, building all three specialisations (igpu,dgpu,battery).just teston Electra (igpuspecialisation):/etc/hostscontains both10.10.0.20 electra.meshandfd56:f458:569c::20 electra.mesh.getent ahosts electra.meshreturns both overlay IPs.getent ahosts electraresolves cleanly to127.0.0.2.ping -6 -c 2 electra.meshpasses with 0% packet loss (0.026 ms rtt).vega.mesh,lyra.mesh,pangolin-vps.mesh) passes with 0% loss.Closes #310.
Relates to milestone 32: Dual-stack Nebula Mesh & Router Exit.
Automated code review
Reviewed commit:
61b06d805440971a997778f2f039ff8989241c79Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The supplied changes are internally consistent with the checked-out tree. The new
ipv6HostMapdefault (modules/networking/nebula.nix:86-97) has exactly the same 11 keys ashostMap(modules/networking/nebula.nix:24-35), so thelib.optionalString (cfg.ipv6HostMap ? ${name})guard incoreDnsStaticZones(line 45) now emits AAAA records for vega/lyra/lena without producing an A-only zone. The rewritten self branch (lines 239-246 and 251-258) emits only the.meshalias forname == hostname, so no bare-name entry is added at the overlay IP and no duplicate bare-name mapping is introduced;hostNamevalues inhosts/{vega,lyra,lena,electra}/default.nixmatch the map keys, so the self branch actually triggers on those hosts.lib.mkMergeconcatenates per IP key and no key collides betweenrouterUnderlayAddresses(154.51.87.151 / 2a05:b100:2420:4800::1) and the two host maps (router is 10.10.0.10 / fd56:f458:569c::10 per nebula/router.json). The README text (README.md:131-132) now names exactly the 11 entries present in the default, so documentation and code agree.grep networking\.hostsmatches only modules/networking/nebula.nix:235, so no test, override, or other module contradicts the new behaviour. No Nix evaluation error is introduced. The remaining gap is validation evidence for the three newly affected hosts, which AGENTS.md states is required for a deployment-affecting change.Blocking findings
None.
Important findings
The default at lines 88-89 and 96 adds vega, lyra and lena to
ipv6HostMap, and the rewritten self branch at lines 239-246/251-258 changes generated/etc/hostscontent for every host whosehostNameis a map key (hosts/vega, hosts/lyra, hosts/lena, hosts/electra all set matching names).grep networking\.hostsmatches only modules/networking/nebula.nix:235, and nothing under tests/ or scripts/ asserts/etc/hostsor the CoreDNS config string, sonix flake checkcannot cover the generated records for vega, lyra or lena. AGENTS.md states 'Before merging a deployment-affecting change: Confirm local validation, required MR checks, and a canary appropriate to the risk' and 'For multi-host ... changes, record one genuine deployment and a no-op follow-up before closing the issue'; .forgejo/ai-review.md likewise asks that the PR use 'the validation and rollout evidence appropriate to its risk'. The PR text (untrusted) records live activation only on Electra.Impact: The new self
.meshalias and the new AAAA records are unexercised on the three hosts that newly own them; a regression there (for example a self/etc/hostsrecord at the host's own overlay IP, which is the address several services bind to by default: modules/services/paseo-daemon.nix:31, modules/services/kiwifs.nix:36, modules/services/bookstack-mcp.nix:31, hosts/vega/default.nix:150) would only surface on those hosts and not in the deterministic gate.Suggested fix: Record the repository-required canary on at least one of the newly affected hosts (e.g.
just teston vega, with an auto-update hold first, plus a no-op follow-up), and capturegetent hosts <hostname>.meshreturning the host's overlay IPv4/IPv6 and the CoreDNS AAAA output on vega, which is the only host in the tree settingisResolver = true(hosts/vega/default.nix:141).Suggestions
.meshalias is now sourced from an overridable option with no invariant tying it tohostMaporoverlayIp(modules/networking/nebula.nix:252; medium confidence)The self branch emits the alias from
hostMap.${hostname}(alet-bound literal, lines 24-35) and independently fromcfg.ipv6HostMap.${hostname}(an overridable option default, lines 84-97), whilecfg.overlayIp(line 106) is a separate overridable option used for the CoreDNS bind address (line 41) and service defaults. The module's only assertion (lines 122-128) coversexitNode.externalInterface; nothing ties the two inventories or the alias address tocfg.overlayIp.coreDnsStaticZonesiterateshostMapand guards oncfg.ipv6HostMap ? name, whereasnetworking.hostsiteratescfg.ipv6HostMapunguarded, so a key present in only one map yields an/etc/hostsrecord with no matching DNS record. The maps agree today, so this is not a current defect.Impact: A future per-host
nixosConfig.nebula.ipv6HostMapoverride, or an address added to one map before the other, would silently produce a partial or wrong self/etc/hostsentry with no evaluation error; the option description ('Add other nodes only with their certificate rollout') is prose only.Suggested fix: Consider an assertion in the
configblock thatbuiltins.attrNames cfg.ipv6HostMapequalsbuiltins.attrNames hostMap(or is a subset), so the two inventories cannot drift silently.Tests and validation
Questions
<hostname>.meshresolve beforenebula@mesh.servicehas brought up the overlay interface? The new/etc/hostsrecord is static, so it will resolve to the overlay IP even when the mesh is down, unlike the previous behaviour where the self name had no static record.novakeep an entry in the defaultipv6HostMapwhile it remains underpotential/nova/and unregistered inflake.nix(per AGENTS.md,potential/hosts are not deployed and not built by CI)?Review limitations
nix flake check,nix build,nix fmtand any livegetent/ping/CoreDNS output were not reproduced; the validation results attributed to the PR are taken from the untrusted PR text.nebula/certs/*.crtfiles are binary protobuf and were not decoded, so the claim that the vega/lyra/lena v2 certificates containfd56:f458:569c::2,::3and::21could not be verified from supplied evidence./etc/hostscontents, CoreDNS output, CI log, or Forgejo workflow output was supplied; only the checked-out repository tree and the PR text were inspected.networking.hosts; no such default appears in the supplied tree, andnebula.nixis the only definition ofnetworking.hostsin it.Diff coverage
README.md: reviewed — included in a context-limited batchmodules/networking/nebula.nix: reviewed — included in a context-limited batchReview metadata
Automated code review
Reviewed commit:
3538f61405066632f610b250cf112dee864ce86fVerdict: Ready to merge
No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.
Overall assessment
Strict validation pass over the initial review. The supplied diff is internally consistent: the three new
ipv6HostMapkeys (vega, lyra, lena) all exist inhostMap(modules/networking/nebula.nix:26-37), so the new assertion at line 159 holds; the IPv6 values::2,::3,::21do not collide with existing values;coreDnsStaticZones(lines 45-47) emits AAAA records only for names present inipv6HostMap, matching the new keys; the README inventory (README.md:130-132) lists the same 11 entries as the option default; and the threenetworking.hostsoverlays at line 239 are keyed by distinct IPv4/IPv6/public-router addresses, so no key is contributed twice. No evaluation-breaking or scoping defect was demonstrated in the changed files. Both surviving findings are evidence/rollout gaps backed by explicit in-tree rules (theipv6HostMapdescription and the AGENTS.md multi-host rule), not demonstrated defects, so both are held at suggestion severity. The127.0.0.2self-loopback claim from the initial review is dropped: that address appears nowhere in the supplied tree.Blocking findings
None.
Important findings
None.
Suggestions
Fleet-wide /etc/hosts and AAAA change is not corroborated by a deployment on an auto-update host (modules/networking/nebula.nix:239; medium confidence)
The unfiltered
mapAttrs'overhostMapandcfg.ipv6HostMap(lines 239-264) applies to every host importingmodules/networking/nebula.nixwithnixosConfig.nebula.enable = true: hosts/vega/default.nix:59 + :135, hosts/lyra/default.nix:47 + :118, hosts/lena/default.nix:15 + :51, hosts/electra/default.nix:138 + :199. No host overridesipv6HostMap(only occurrence outside nebula.nix is README.md:130), so all four receive the new records. AGENTS.md:43 states 'For multi-host or auto-update changes, record one genuine deployment and a no-op follow-up before closing the issue', and AGENTS.md:152-153 describe vega and lyra as 'pull-only auto-update'.Impact: The change lands on unattended auto-update hosts without a canary in the supplied material; an activation-time problem with the new self
<hostname>.meshentries would surface only after an automatic pull. This is a validation-evidence gap, not a demonstrated defect: the evaluated output is well-formed for all four hosts.Suggested fix: Before closing the issue, record one genuine deployment plus a no-op follow-up on an auto-update mesh host (vega or lyra) under an auto-update hold, per AGENTS.md:43, and confirm
getent ahosts <hostname>.meshresolves to the host's own overlay IPs there.New IPv6 addresses are not tied to any inspectable certificate evidence, despite the option's own rule (modules/networking/nebula.nix:88; medium confidence)
The option description in the changed file (lines 90-93) states entries must be added 'only with their certificate rollout, not from planned addresses', and README.md:126-128 notes 'Reissue does not revoke the replaced certificate: its old signed permissions remain valid until the new pairs are activated.' The new assertion at line 159 checks only key presence in
hostMap, not thatfd56:f458:569c::2/::3/::21match the deployed certificates;nebula/certs/holds only opaque.crtfiles, so no supplied artifact corroborates the three new values.Impact: A mistyped or not-yet-activated address would produce unreachable /etc/hosts keys and CoreDNS AAAA records that
nix flake checkcannot detect, since the only in-tree guard is name presence.Suggested fix: Record
nebula-cert print -json -path nebula/certs/<host>.crt(or the equivalentjust nebula-list) output for vega, lyra and lena in the issue/MR evidence so the mapped addresses are tied to the minted v2 certificates; no source change is required.Tests and validation
Questions
<hostname>.meshalias be suppressed on any host still running a version 1 (IPv4-only) certificate, given the new self-alias branch at lines 239-253 emits both the IPv4 and IPv6 self records unconditionally?networking.hostsentry for the bare self hostname exists anywhere in the supplied tree?Review limitations
nix flake check, evaluation of the four affectednixosConfigurations, and the reported system builds could not be re-run; the consistency claims above were derived by reading the source, not by evaluating it.nebula/certs/*.crtare binary Nebula certificates that the navigation tools cannot decode, so the IPv6 addresses inside vega/lyra/lena certificates could not be confirmed.127.0.0.2value appears nowhere in the repository and was discarded.Diff coverage
README.md: reviewed — included in a context-limited batchmodules/networking/nebula.nix: reviewed — included in a context-limited batchReview metadata
Review Follow-Up & Certificate Evidence
Responding to automated review advisory feedback for commit
3538f61(verdict: Ready to merge):Inventory Assertion Added (
3538f61):Added an assertion in
modules/networking/nebula.nixguaranteeing that all keys innixosConfig.nebula.ipv6HostMapmust exist withinhostMap, preventing inventory drift.Decoded Certificate Evidence (
just nebula-list):Verified that the minted v2 node certificates match the configured addresses:
vega:networks: ["10.10.0.2/16", "fd56:f458:569c::2/64"](fingerprint7209b2d36a95b766e6b26d1ad2b510938315968efee05193541ce49bf83cdd75, version 2)lyra:networks: ["10.10.0.3/16", "fd56:f458:569c::3/64"](fingerprint1ba98aa83bdd51cae8d6683ea1c6142a82a0eb5e765836cefa7ca706aabfd068, version 2)lena:networks: ["10.10.0.21/16", "fd56:f458:569c::21/64"](fingerprint0ca48eccc2c6ce992a2d1a879b445fc2670f022c7e56fe026533112c7681efc1, version 2)electra:networks: ["10.10.0.20/16", "fd56:f458:569c::20/64"](fingerprint6e409ef37a5283332465bf9592bc42c5f846fbc0050d4f59d3e7e156d660b524, version 2)Active Reachability:
Both
vega.mesh(fd56:f458:569c::2) andlyra.mesh(fd56:f458:569c::3) actively respond over IPv6 with 0% packet loss from Electra. Local self-resolution on Electra (electra.mesh) resolves tofd56:f458:569c::20and10.10.0.20with 0% loss (0.026 ms rtt) while keeping bareelectraon loopback127.0.0.2.