Restrict administrative service access to local and Nebula paths #317
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!317
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/issue-38-service-exposure"
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?
Lyra admitted administrative/media ports across physical interfaces after its SWAG routes were replaced by native Newt. Restrict Tdarr and Ollama to Nebula, bind Immich to loopback, and remove Jellyfin’s general HTTP opening and obsolete SWAG/wishlist/Beszel openings. Preserve host-local clients and existing Wyoming speech access. Nova’s unregistered NixOS draft defaults Ollama to loopback and drops its historical administrative-port list.
Related to #38; milestone: Security Hardening. Live Docker changes were applied separately in their existing Compose owners: Nova’s AI/media administrative ports and Lyra’s Stash are mesh-only; Signal is loopback-only with its private voice-pipeline route preserved. Compose validation, mesh/LAN probes, Pangolin routes, health checks, and no-op follow-ups passed. Existing dirty stack edits were preserved. Nova’s migrated PostgreSQL/Adminer deployment is excluded at the user’s instruction.
The evaluated-host guard checks global and physical-interface port lists/ranges, mesh openings for loopback-only backends, declared listener addresses, and every enabled local Tdarr node’s loopback URL. Ports derive from evaluated service options where available. Jellyfin’s verified 8096 target remains an external UI/Pangolin contract; the pinned NixOS module has no Jellyfin port option.
Validation: rebased onto main
f131213after MR #318; range-diff confirmed all four patches unchanged. Combined nix flake check and full Lyra build passed, as did injected exposure-regression rejection checks. Required MR CI passed on1bcc2d7. Existing upstream Framework stdenv deprecation warnings are unrelated.Native acceptance: operator completed just test-remote lyra twice, including the identical no-op follow-up. All seven affected native services are active. Tdarr/Ollama are reachable over Nebula and rejected on the physical LAN; Immich/Jellyfin backends reject direct mesh and LAN access while Pangolin routes return HTTP 200. Local and Vega Tdarr consumers work. Beszel remains active with fresh post-canary hub metrics via its outbound transport; no inbound 45876 listener is required. Evidence and review assessment are recorded in comments 3293 and 3294.
This MR does not close #38: test activation reverts on reboot. Persistent activation and its follow-up acceptance remain to be recorded.
Automated code review
Reviewed commit:
e85582f2751d487774b7257a09746ab9babbc339Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The supplied changes are internally consistent and I found no evaluation-breaking defect in them. Lyra's global openings for 80/443/3280/8888/9999/45876 are dropped, 8265/8266/11434 move to networking.firewall.interfaces."nebula.mesh".allowedTCPPorts (hosts/lyra/default.nix:210-214), Immich moves to host = "127.0.0.1" with its 2283 opening removed (modules/services/immich.nix:121), Jellyfin's 8096 opening is removed (modules/services/jellyfin.nix:89), and the unregistered Nova draft drops its historical port list and defaults Ollama to loopback. Cross-checks confirm the removals are safe within the tree: modules/services/immich.nix and modules/services/jellyfin.nix are imported only by hosts/lyra (vega uses the unrelated modules/databases/immich.nix), modules/services/beszel-agent.nix:18 already sets openFirewall = false so 45876 was never opened by that module, no module imported by Lyra reopens any port in the new restrictedPorts list (the only global openings reachable from Lyra are slskd's 50300, mosh/SSH ports, and 10200/10300), and the sibling check pattern in scripts/check-token-tv-config.nix:35 shows the same interface-scoped idiom. The remaining issues are gaps in what the new flake check actually enforces plus an unexercised runtime behaviour change.
Blocking findings
None.
Important findings
The change removes host-wide firewall openings and re-scopes 8265/8266/11434 to the nebula.mesh input interface (hosts/lyra/default.nix:210-214), leaves 10200/10300 as the only global openings (hosts/lyra/default.nix:225-228), and removes the 8096/2283 openings from the shared modules (modules/services/jellyfin.nix:89, modules/services/immich.nix:134). The added gate is a pure evaluation assert (scripts/check-service-exposure.nix, wired at flake.nix:223) and cannot observe iptables or route reachability. The README addition states that deployment and the live Docker audit are deferred to issue #38. AGENTS.md:43 requires a canary appropriate to the risk before merging a deployment-affecting change, and AGENTS.md:45 requires
just test(not rawnixos-rebuild test) for test deployments.Impact: Nothing in the supplied material demonstrates that Jellyfin/Immich remain reachable through the Newt/Pangolin routes, that Tdarr and Ollama remain reachable over the mesh, or that direct LAN access is in fact rejected; all of that only becomes observable after activation on Lyra.
Suggested fix: Before closing the change: hold auto-update, run
just teston Lyra, then probe Tdarr/Ollama from a mesh consumer, Jellyfin/Immich through the Newt/Pangolin routes, and confirm a direct LAN request is refused; follow with the no-op pass and record the canary.Suggestions
New check guards only global firewall lists, not interface-scoped openings (scripts/check-service-exposure.nix:21; medium confidence)
globallyAllowedinspects onlyfirewall.allowedTCPPortsandfirewall.allowedTCPPortRanges(lines 21-22). The repo's established idiom opens ports per interface instead: modules/services/bookstack.nix:249 opens 80 onnebula.mesh, modules/services/searxng.nix:93, modules/services/paseo-daemon.nix:95 (6767), modules/services/sabnzbd.nix:278 (8383), hosts/vega/default.nix:274. The check asserts membership only for the literalnebula.meshkey (line 27), so a restricted port fromrestrictedPorts(80, 443, 8096, 2283, 11434, ...) admitted on any other interface would keepnix flake checkgreen.Impact: The stated invariant ('no native proxy backend or mesh API is LAN-exposed') is only partly enforced; a future or already-present interface-scoped opening escapes the guard.
Suggested fix: Also assert that no
firewall.interfaces.<name>.allowedTCPPorts/allowedTCPPortRangesoutsidenebula.meshcontains a port fromrestrictedPorts, e.g. by filteringfirewall.interfacesattribute names rather than reading one key.Check hard-codes the Lyra host and duplicates its port literals, so the guard can drift from the host policy (scripts/check-service-exposure.nix:4; medium confidence)
cfg = flake.nixosConfigurations.lyra.config;is an unguarded lookup, and the mesh expectation at line 27 ([ 8265 8266 11434 ]) restates the literals in hosts/lyra/default.nix:210-214. The sibling check in the same directory derives its expectation from configuration instead: scripts/check-token-tv-config.nix:35 assertscfg.nixosConfig.tokenTv.portis a member ofcfg.networking.firewall.interfaces."nebula.mesh".allowedTCPPorts, and lines 20-21 enumerate hosts withbuiltins.attrNames flake.nixosConfigurations.Impact: Two copies of the same port list must be edited together, so the assertion can silently stop matching the host policy; and if Lyra is ever unregistered or renamed (the pattern used for
potential/nova),nix flake checkfails with an attribute error rather than a diagnostic about the exposure policy.Suggested fix: Derive the expected mesh ports from a shared option consumed by both hosts/lyra/default.nix and the check (as token-tv does via
nixosConfig.tokenTv.port), and guard the host lookup (flake.nixosConfigurations ? lyra) or select hosts by an enabled option as check-token-tv-config.nix does.Tests and validation
Questions
nodes.lyra-intel.serverURL = "http://10.10.0.3:8266", i.e. Lyra's own Nebula overlay address (modules/networking/nebula.nix). With 8266 now admitted only via-i nebula.mesh, can you confirm that a locally generated request from the tdarr-node-lyra-intel unit to that overlay address is attributed to the nebula.mesh interface at runtime, rather than being filtered by the now-closed global rules?https://ollama-nova.nimmog.uk/v1. Is that route served by the live Fedora host today, and will it survive the draft's registration?Review limitations
nix flake check,just test, or any repository code; the claim that the full Lyra build and the new check evaluate successfully comes from the pull-request text, not from anything I verified.Diff coverage
README.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchhosts/lyra/default.nix: reviewed — included in a context-limited batchmodules/services/immich.nix: reviewed — included in a context-limited batchmodules/services/jellyfin.nix: reviewed — included in a context-limited batchpotential/nova/default.nix: reviewed — included in a context-limited batchscripts/check-service-exposure.nix: reviewed — included in a context-limited batchReview metadata
Review assessment before fixes:
No changes to deployed Docker images, model configuration or database services are planned in this review response.
Review fixes are published as
cdd8e84120. Full flake checks and the exact clean Lyra build pass. Injecting either an administrative port or an administrative port range on eth0 makes the exposure check fail as intended. Read-only live checks confirm local overlay routing uses dev lo, Tdarr loopback responds (302), and the Intel node is active.Prepared an isolated operator canary checkout on Lyra at /home/nimmo/nixos-issue38-canary, clean at the current MR head. No native activation has been performed. Repository constraints prohibit agent sudo except nixos-rebuild, while the required hold and just test recipes use other privileged commands; operator execution is needed for that acceptance step. Keep the MR unmerged and #38 open until the canary/no-op and post-activation reachability checks pass. The automated review timer has restarted for this push.
Automated code review
Reviewed commit:
cdd8e841200ee4056bec24ba26977ea69c6a3b3bVerdict: Ready to merge
No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.
Overall assessment
The change set narrows Lyra's host firewall (Tdarr/Ollama admitted only on the
nebula.meshinterface, Immich bound to loopback, Jellyfin/Immich/SWAG/wishlist/Beszel openings removed), stops the Nova draft from pre-opening a historical port list, and adds aservice-exposureflake check that evaluatesflake.nixosConfigurations.lyra.configand asserts the restricted ports stay closed globally and on non-mesh interfaces while the mesh ports are open onnebula.mesh. I checked the new gate against the composed Lyra config: the onlynetworking.firewall.allowedTCPPortscontributions reachable fromhosts/lyra/default.nixare the retained 10200/10300 speech ports and slskd's 50300 (modules/containers/slskd.nix:115), and every other module that opens ports does so oninterfaces."nebula.mesh"only, so none of the asserted restricted ports (80, 443, 2283, 3280, 8096, 8888, 9999, 45876, or the mesh ports) is added globally; the gate's wiring inflake.nixmatches the existingcheck-*.nixstyle, and its assertions match the values set inhosts/lyra/default.nix(identicalserverURLexpression,services.newt.enable = trueviamodules/services/newt.nix). Vega's unchanged Tdarr node still targetshttp://10.10.0.3:8266, which Lyra now admits on the mesh interface, consistent with the establishedinterfaces."nebula.mesh"pattern used on Vega/Lena/Electra. I found no defect demonstrable from the supplied evidence; the two findings are coverage gaps in the new guard itself.Blocking findings
None.
Important findings
None.
Suggestions
The new guard never asserts the loopback-only ports are absent from
nebula.mesh(scripts/check-service-exposure.nix:41; medium confidence)nonMeshInterfacesfilters outnebula.mesh(line 31), and the only mesh-interface assertion islib.all (port: allowsPort firewall.interfaces."nebula.mesh" port) meshPorts, which tests membership of the three mesh ports but never tests the other members ofrestrictedPorts(80, 443, 2283, 3280, 8096, 8888, 9999, 45876) against that interface. Several unchanged modules already use exactly this mesh-interface form to open ports (modules/services/trilium-web.nix:194,kiwifs.nix:194,token-tv.nix:52,paseo-daemon.nix:95,bookstack.nix:249opens 80 onnebula.mesh).Impact: The stated policy in the changed comments (
modules/services/immich.nix: 'no direct LAN/mesh listener';modules/services/jellyfin.nix: 'do not admit direct LAN/mesh HTTP traffic') is enforced only against the global list, not against the mesh interface, so a module that opens 2283 or 8096 onnebula.meshwould satisfy the gate while contradicting the policy the change introduces.Suggested fix: Add an assertion that the loopback-only ports (at minimum
cfg.services.immichport 2283 and Jellyfin's 8096) are absent fromfirewall.interfaces."nebula.mesh".allowedTCPPortsand itsallowedTCPPortRanges, so the policy is enforced on every interface rather than only globally.The guard pins one Tdarr node by literal attribute name and leaves the other node's serverURL unchecked (scripts/check-service-exposure.nix:43; medium confidence)
cfg.services.tdarr.nodes.lyra-intel.serverURLnames one attribute literally.hosts/lyra/default.nixdefines two nodes (nodes.lyraandnodes.lyra-intel), andnodes.lyrasets noserverURL, so it inherits the upstream default;modules/services/tdarr.nix:13derives the unit set frombuiltins.attrNames enabledNodes, so the check is not tied to the nodes that actually exist.Impact: Renaming or retiring
lyra-intelturns the gate into an opaque 'attribute is not in attribute set' evaluation failure rather a diagnostic message, and the node that relies on an upstream default is not covered, so a default that resolves to a non-loopback address would depend on a firewall hole Lyra no longer provides.Suggested fix: Iterate over
cfg.services.tdarr.nodesand assert each node'sserverURLis a loopback URL or an explicitly intended mesh address, with an assertion message naming the offending node, instead of asserting one hardcoded attribute.Tests and validation
Questions
dashboard.nimmog.ukever contact a host's agent by address (e.g.10.10.0.3:45876over the mesh)?modules/services/beszel-agent.nixsetsopenFirewall = falseand posts toHUB_URL, which suggests the agent only pushes to the hub, so removing 45876 from Lyra's firewall appears safe; the hub owner is outside this repository and was not supplied.localhost:8096and127.0.0.1:2283? The route definitions are not in the supplied material, so the change's reliance on Newt for ingress cannot be verified here.potential/nova/default.nixonce it is registered inflake.nix; no supplied check evaluates its firewall or its loopback Ollama setting today?Review limitations
nix flake check, the newservice-exposuregate, and Lyra's build were not run here; the passing status is inferred from reading the composed configuration, not from evaluation.services.tdarr.nodes.*.serverURL,services.immich.host,services.jellyfin.openFirewall,services.ollama.openFirewall,services.newt.enable,networking.firewall.interfaces) were not inspected; option names and defaults were inferred only from their usage in this repository, so an assertion such as!cfg.services.ollama.openFirewallcould fail if an upstream default differs from that inference.nixosConfigurations.lyra; the exposure of other registered hosts (e.g. Vega'sallowedTCPPorts = [ 5432 ]athosts/vega/default.nix) is outside the changed files and was not assessed as a defect.Diff coverage
README.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchhosts/lyra/default.nix: reviewed — included in a context-limited batchmodules/services/immich.nix: reviewed — included in a context-limited batchmodules/services/jellyfin.nix: reviewed — included in a context-limited batchpotential/nova/default.nix: reviewed — included in a context-limited batchscripts/check-service-exposure.nix: reviewed — included in a context-limited batchReview metadata
Assessment of review63 before fixes: both coverage suggestions are reasonable. I will assert that Immich/Jellyfin backend ports are also closed on nebula.mesh, explicitly configure both Lyra-local Tdarr nodes to loopback, and validate all enabled local nodes with a named diagnostic rather than hard-coding lyra-intel in the guard.
The external questions are already covered by live evidence: the inspected Pangolin native targets are localhost:8096 and 127.0.0.1:2283. Lyra's live baseline has no 45876 listener, its Beszel module uses outbound hub connectivity, and monitoring remains active after Docker changes; removing an unused opening does not disable the agent. Nova's draft will require its own evaluated guard and live-route acceptance when it becomes a registered NixOS host; that deployment remains outside this MR. The native Lyra canary/no-op remains explicitly required before merge.
Automated code review
Reviewed commit:
c2d5f6b8bafc560de3cf4568664946f5e6d03541Verdict: Ready to merge
No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.
Overall assessment
Scope: README.md, flake.nix (new
service-exposurecheck), hosts/lyra/default.nix, modules/services/immich.nix, modules/services/jellyfin.nix, potential/nova/default.nix, scripts/check-service-exposure.nix. I traced the cross-host consumers of the removed openings. The only cross-host consumer of a Lyra port is hosts/vega/default.nix:221 (serverURL = "http://10.10.0.3:8266"), and Lyra's overlay address is 10.10.0.3 (modules/networking/nebula.nix:27, justfiles/nebula.just:56); the newnetworking.firewall.interfaces."nebula.mesh".allowedTCPPortsblock (hosts/lyra/default.nix:211-215) re-opens the Tdarr webUI/server ports andconfig.services.ollama.portthere, so the mesh path stays covered while the LAN hole is closed. Lyra's Tdarr nodes now derive their loopback URL fromconfig.services.tdarr.server.serverPort, which matches the new check's node assertion (scripts/check-service-exposure.nix:47-54). Lyra keepsserverIP = "0.0.0.0"andprofiles.ollama.nvidia.host = "0.0.0.0", so loopback clients still work. No other file in the tree references 2283, 8096, 3280, 8888, 9999, 45876 or 10.10.0.3 as a consumer (grep over the checkout);justfiles/maintenance.just:505already uses 127.0.0.1:11434; modules/services/beszel-agent.nix:18 already setsopenFirewall = false, so dropping 45876 matches the rest of the fleet. potential/nova/default.nix is not inflake.nix'snixosConfigurations(only electra/lena/vega/lyra), so its firewall/Ollama changes have no evaluation effect. No blocking or important defect is demonstrated by the supplied evidence; two coverage gaps in the new gate remain as suggestions.Blocking findings
None.
Important findings
None.
Suggestions
Exposure gate mixes derived service ports with hard-coded backend literals (scripts/check-service-exposure.nix:15; medium confidence)
The same file already derives the service ports it guards:
meshPortsreadscfg.services.tdarr.server.webUIPort/serverPortandcfg.services.ollama.port(lines 10-14), andloopbackPortsreadscfg.services.immich.port(line 34). ButrestrictedPorts(lines 15-25) lists 80, 443, 2283, 3280, 8096, 8888, 9999, 45876 as literals, andloopbackPortshard-codes 8096 (line 35) even though modules/services/jellyfin.nix configuresservices.jellyfin(line 23) and modules/services/immich.nix configuresservices.immich(line 110) with ahost/openFirewallpair.Impact: The guard is keyed to historical port numbers rather than to the services it is meant to protect: if a backend's port option is ever overridden (or an upstream default changes), the gate stops guarding that listener and a LAN/global reopening at the new port would pass
nix flake check, while the stale 2283/8096 assertions keep passing vacuously. The PR's stated purpose of the gate ('The evaluated-host check catches a global port/range reopening these services') would not hold for such a change.Suggested fix: Derive the backend part of
restrictedPortsandloopbackPortsfrom the evaluated options (cfg.services.immich.port,cfg.services.jellyfin.port) and keep the retired SWAG/wishlist/Signal/Stash/Beszel literals (80, 443, 3280, 8888, 9999, 45876) in a separately named legacy list so the two intents stay distinguishable.Gate verifies the mesh firewall openings but not the wildcard listeners those mesh consumers depend on (scripts/check-service-exposure.nix:46; medium confidence)
The gate asserts the mesh openings (
lib.all (port: allowsPort firewall.interfaces."nebula.mesh" port) meshPorts, line 46) and only the firewall flags!cfg.services.tdarr.server.openFirewall/!cfg.services.ollama.openFirewall(lines 58-59); it never asserts the listener addresses. The listener half is what the cross-host consumer needs: hosts/vega/default.nix:221 reaches Lyra athttp://10.10.0.3:8266, and hosts/lyra/default.nix keepsserverIP = "0.0.0.0"(line 144) andprofiles.ollama.nvidia.host = "0.0.0.0"(line 195) with the comment 'Lyra serves Ollama to the rest of the fleet'.Impact: A later narrowing of
services.tdarr.server.serverIPorservices.ollama.hostto loopback would keepnix flake checkgreen while silently breaking Vega's Tdarr node and mesh Ollama clients: the firewall half of the contract would be verified, the listener half would not.Suggested fix: Add companion assertions that the mesh-reachable listeners stay non-loopback (e.g.
cfg.services.tdarr.server.serverIPandcfg.services.ollama.hostare not "127.0.0.1"/"localhost"), so the mesh opening and its listener are checked as one contract.Tests and validation
Questions
nebula.meshrule), andjustfiles/maintenance.just:505already uses 127.0.0.1:11434, but I cannot prove absence: please confirm no operator tooling or desktop client on Lyra's physical network still connects to the Tdarr UI/API or Ollama over the LAN.openFirewall = falsewithLISTEN = "45876"andHUB_URL = "https://dashboard.nimmog.uk", and no host in the tree opens 45876, so removing it makes Lyra consistent with the rest of the fleet - please confirm the hub reaches agents over SSH rather than a mesh socket, since a mesh socket would now be blocked on every host.cfg.services.newt.enableis true. Theservices.newtoption is not declared in this checkout (modules/services/newt.nix only assigns it), and secrets/newt/lyra.yaml is SOPS-encrypted, so please confirm the native Newt/Pangolin ingress needs no host port on 80/443.Review limitations
nix flake check, build Lyra, or runjust test; the PR's validation claims (flake check, full build, mesh/LAN probes, injected rejection checks) are unverified.services.tdarr(serverPort/webUIPort/serverIP/nodes),services.immich(host/port),services.jellyfin(port/openFirewall),services.ollama,services.newtandservices.beszel.agentcome from nixpkgs or external flake inputs that are not present in the checked-out tree; I inferred their names and defaults only from usage in this repository.Diff coverage
README.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchhosts/lyra/default.nix: reviewed — included in a context-limited batchmodules/services/immich.nix: reviewed — included in a context-limited batchmodules/services/jellyfin.nix: reviewed — included in a context-limited batchpotential/nova/default.nix: reviewed — included in a context-limited batchscripts/check-service-exposure.nix: reviewed — included in a context-limited batchReview metadata
Assessment of review65 before fixes:
The native operator canary remains pending, so Ready to merge is not being treated as deployment acceptance.
Review65 follow-up published as
d79fb36466. The exposure check now derives backend protection from the evaluated Immich port, separates retired-port literals, and asserts the declared wildcard Tdarr/Ollama listeners. Jellyfin's verified8096 Newt contract remains explicit because pinned nixpkgs has no services.jellyfin.port option.Full flake checks pass. Injected overridden-Immich-port reopening and loopback-only Ollama/Tdarr declarations are rejected. This revision changes only the guard, not service runtime configuration; the last runtime configuration/full Lyra build is unchanged from
c2d5f6b. The isolated operator canary checkout is updated; native activation/no-op acceptance remains pending and the MR stays unmerged. A new35-minute review window is active.Automated code review
Reviewed commit:
d79fb36466d57f17a6ec156c7ab4f95f31a2d3a0Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The change set is internally consistent with the repository's established Lyra pattern: native backends already use loopback plus the native Newt client (modules/services/atticd.nix:78 sets listen = "127.0.0.1:8081" with the same 'Pangolin reaches each backend through the local Newt client' rationale), so binding Immich to 127.0.0.1 (modules/services/immich.nix:121) and dropping the 2283/8096 firewall openings (modules/services/immich.nix, modules/services/jellyfin.nix:89) matches the existing convention. Lyra's Tdarr nodes now derive their serverURL from config.services.tdarr.server.serverPort over loopback, and the mesh opening for webUIPort/serverPort/ollama.port keeps Vega's unchanged node URL (hosts/vega/default.nix:221, http://10.10.0.3:8266 against Lyra's overlay IP 10.10.0.3 from modules/networking/nebula.nix:27) resolvable. The new gate is wired into flake.nix with the same assert-then-runCommand pattern as the neighbouring checks, and I found no Lyra-enabled module that re-adds any of its restrictedPorts (80, 443, 3280, 8888, 9999, 45876, 2283, 8096, 8265, 8266, 11434) to the global list or to a non-mesh interface, so the gate does not contradict the host configuration. Two items remain actionable: the repository's own acceptance rule for a deployment-affecting change is not yet satisfied, and the gate only half-enforces the Jellyfin loopback invariant because Jellyfin's listener is UI-managed and the port is a literal in the check. The Beszel 45876 removal is not reported as a defect: modules/services/beszel-agent.nix:18 already sets openFirewall = false with LISTEN = "45876" for every host (imported by modules/common/base.nix:24), and no other host ever opened 45876, so the removal aligns Lyra with the existing fleet state rather than breaking it.
Blocking findings
None.
Important findings
The diff changes live service exposure on a deployed host (openFirewall = false for the Tdarr server, Immich host = "127.0.0.1", removal of 80/443/3280/8265/8266/8888/9999/11434/45876 from networking.firewall.allowedTCPPorts, and a new nebula.mesh opening). AGENTS.md:43 states 'Before merging a deployment-affecting change: Confirm local validation, required MR checks, and a canary appropriate to the risk', and AGENTS.md:45 requires 'just test' rather than raw nixos-rebuild test, with an auto-update hold when testing remotely. The PR text states the native NixOS changes have not yet been activated and the Lyra canary is still outstanding; README.md:256-266 points deployment and the live Docker audit to issue #38.
Impact: The new gate proves only the evaluated firewall lists and service bindings; nothing supplied demonstrates that mesh clients (Vega's Tdarr node at 10.10.0.3:8266, Ollama consumers) still connect, that Newt's routes to 127.0.0.1:2283 and 127.0.0.1:8096 serve after activation, or that direct LAN access is in fact rejected. A regression here would be caught only at runtime.
Suggested fix: Run the documented test-deployment path on Lyra (just test, with an auto-update hold first if testing remotely) and record the mesh reachability of Tdarr/Ollama, the Newt-served Jellyfin/Immich routes, and a rejected LAN-address probe as the acceptance evidence for issue #38 before the MR is closed.
Suggestions
loopbackPorts is built from cfg.services.immich.port plus the literal 8096, with the in-file comment 'Nixpkgs has no Jellyfin port option: its UI owns this setting.' modules/services/jellyfin.nix:89 carries the matching comment 'Preserve Jellyfin's UI-managed listener configuration'. The gate therefore asserts only that 8096 is not firewall-opened; nothing in the supplied configuration ties that literal to Jellyfin's actual UI-managed listener or to the Newt target.
Impact: If Jellyfin's UI-managed listener ever moves off 8096, the gate still passes while the Pangolin/Newt route to 127.0.0.1:8096 silently breaks, so the 'loopback-only Jellyfin' claim in README.md:257-259 is unenforced for that one service, unlike Immich, Tdarr, and Ollama, which are derived from option values.
Suggested fix: Keep the literal in one place rather than two: record the verified Jellyfin listener as a single host-level value consumed by both the Newt target and the gate, and have the gate assert that the Newt target list matches the configured listeners, so a listener change fails the check instead of the route.
Tests and validation
Questions
Review limitations
Diff coverage
README.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchhosts/lyra/default.nix: reviewed — included in a context-limited batchmodules/services/immich.nix: reviewed — included in a context-limited batchmodules/services/jellyfin.nix: reviewed — included in a context-limited batchpotential/nova/default.nix: reviewed — included in a context-limited batchscripts/check-service-exposure.nix: reviewed — included in a context-limited batchReview metadata
Assessment of review67:
The required native canary is valid and still outstanding. The MR remains unmerged and #38 remains open; the isolated Lyra checkout and operator hold/just test/no-op instructions have already been prepared. No additional source edit can supply activation evidence.
I am not implementing the advisory shared Jellyfin/Newt value. Pangolin targets are managed outside this repository, and Jellyfin's listener is UI-managed with no pinned nixpkgs port option. Adding an unused host value or a local copy of that target list would not validate either live authority and would create a misleading static guarantee. The guard deliberately checks the confirmed 8096 backend route; README states that Jellyfin's HTTP port has no general firewall opening, not that its mutable listener is declaratively loopback-bound. A future listener/ingress change requires the documented live review and reachability tests.
The topology questions have already been answered with inspected live state: native Pangolin targets were already localhost:8096 and 127.0.0.1:2283; Signal/Stash bindings were changed and tested in their Compose owners; wishlist/SWAG are absent; Lyra has no 45876 listener and its monitoring uses the existing outbound hub path. Those external facts cannot be proven from this Nix diff alone.
All actionable source-review improvements have been implemented and validated. CI passes for
d79fb36. No further meaningful code changes are warranted by this review, so the polling timer is stopped. Native deployment/no-op acceptance and subsequent owning wiki updates are still required before merge/issue closure.Main advanced to
f131213through MR #318 (Nebula IPv6 host mapping and local self-resolution). The feature branch rebased cleanly; git range-diff confirms all four issue #38 commits retain identical patches. Full flake checks pass on the combined configuration. The combined Lyra build is being completed before publishing the rebased head.Native acceptance is still outstanding: read-only live inspection shows Lyra's old system active, Immich still listening on 0.0.0.0:2283, and no activation of the exposure-policy canary. Therefore the source integration can be prepared safely, but this MR must not be merged yet under the repository's deployment gate. No deployed Docker binding or database configuration is changed by this integration.
d79fb364661bcc2d7aa2The rebased MR head is now
1bcc2d7aa2on mainf131213. Combined flake checks and full Lyra build pass. Publication used an exact force-with-lease against the previously reviewed remote head, preserving any unexpected intervening work.Lyra's isolated canary checkout is clean at the rebased head; its prior revision was retained on a backup branch, and the new closure is preloaded. No native activation was performed. CI and automated review were retriggered; two-minute review monitoring has restarted for 35 minutes. Merge remains gated on the already requested operator hold/just test/no-op and post-activation service/mesh/LAN checks, including the newly merged mesh name-resolution changes.
Automated code review
Reviewed commit:
1bcc2d7aa26f82c6d8abe68e9e83f849650fe623Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The change set is internally consistent and I found no evaluation-breaking defect in the supplied files. Lyra moves its Tdarr/Ollama firewall openings from the global list to
networking.firewall.interfaces."nebula.mesh"(hosts/lyra/default.nix:211-215) while keeping the wildcard listeners (serverIP = "0.0.0.0",profiles.ollama.nvidia.host = "0.0.0.0"), Immich is bound to 127.0.0.1 withopenFirewall = false(modules/services/immich.nix:120-122), Jellyfin and Immich lose their host firewall ports, the Wyoming speech ports 10200/10300 remain globally open, and the unregistered Nova draft drops its historical port list and setsamd.host = "127.0.0.1", which matches theprofiles.ollama.amd.hostdefault in modules/profiles/ollama.nix. Vega's cross-host Tdarr node (hosts/vega/default.nix:221,http://10.10.0.3:8266) still resolves because 8266 is now opened onnebula.mesh. The newscripts/check-service-exposure.nixgate is wired into flake.nix in the same style as the existing token-tv/redview checks and its assertions match the values written in hosts/lyra/default.nix. The real defects are narrower than the initial review claimed: one removed port (45876) belongs to a native agent that is enabled on Lyra and has no remaining access path, and the new gate's assertions are snapshot-based rather than derived from enablement or configured options.Blocking findings
None.
Important findings
The diff deletes
45876fromnetworking.firewall.allowedTCPPortsand adds it to no interface; the replacement comment at hosts/lyra/default.nix:222 states 'wishlist and Beszel openings are unnecessary'. Unlike Signal/Stash, Beszel on Lyra is not Docker-published:modules/common/base.nix:24imports../services/beszel-agent.nixfor every host, and that module unconditionally setsservices.beszel.agent.enable = true,openFirewall = false,LISTEN = "45876",HUB_URL = "https://dashboard.nimmog.uk"(modules/services/beszel-agent.nix:11-23);secrets/beszel/lyra.yamlexists, so the agent runs on Lyra.scripts/check-service-exposure.nix:21then lists 45876 inretiredPorts, and lines 41-45 assert it is absent from the global firewall and from every non-mesh interface, so the new flake check actively enforces the closure rather than flagging it.Impact: After this change nothing in Lyra's configuration opens 45876 on any interface, so the agent is reachable only through loopback. If the Beszel hub at the external HTTPS URL polls Lyra's agent over the LAN or the mesh, Lyra's monitoring silently stops while
nix flake checkstill reports success - the opposite of the intended 'local and Nebula paths' policy, because no mesh opening was added for this port.Suggested fix: Confirm the hub's transport to Lyra's agent. If it reaches the agent from outside the host, open 45876 on
nebula.mesh(hosts/lyra/default.nix:211-215) and drop 45876 fromretiredPortsin scripts/check-service-exposure.nix so the gate encodes the mesh path instead of a blanket retirement; otherwise record in the comment that the hub connects agent-to-hub only.Suggestions
The new exposure gate asserts mesh and loopback invariants unconditionally, so it fails on opt-in services (scripts/check-service-exposure.nix:46; medium confidence)
meshPorts(lines 10-14) is built fromcfg.services.tdarr.server.webUIPort,cfg.services.tdarr.server.serverPortandcfg.services.ollama.port, and line 46 asserts all three are present onnebula.meshwith no enablement condition; the same unconditional pattern applies toloopbackPorts(line 31) andcfg.services.immich.host(line 55). The guarded services are opt-in:modules/services/tdarr.nixwraps its units inlib.optionalAttrs config.services.tdarr.server.enable, and Lyra gates them behindnixosConfig.tdarr.enable(hosts/lyra/default.nix:140) andprofiles.ollama.enable.Impact: A later, otherwise-valid change that disables native Tdarr or Ollama on Lyra - or moves Ollama to another port - makes
nix flake checkfail on a bare assertion and blocks evaluation instead of reporting that the policy no longer applies. The file already anticipates drift elsewhere (line 6 throws a named message for a retired/renamedlyrahost), so the inconsistency is local to these assertions.Suggested fix: Derive the asserted port lists from enablement, e.g. build
meshPortsonly for entries wherecfg.services.tdarr.server.enableandcfg.services.ollama.enableare true (asmodules/services/tdarr.nixalready filters onnode.enable), or phrase the invariant as 'when enabled' so the gate tracks policy rather than the current host snapshot.The Jellyfin half of the new guard asserts a hard-coded 8096 that no option binds (scripts/check-service-exposure.nix:35; medium confidence)
loopbackPortshard-codes8096with the comment 'Nixpkgs has no Jellyfin port option: its UI owns this setting', andmodules/services/jellyfin.nixdeliberately keeps the listener under UI management (forceEncodingConfig = false, no port setting, comment at line 89 'Native Newt targets localhost:8096'). Nothing in the changed files binds 8096 to the actual listener, whereas Immich is covered correctly throughcfg.services.immich.port.Impact: Lines 42-47 can pass while Jellyfin's real UI-managed listener port differs, so a future reopening of the actual Jellyfin port on a physical interface would not be caught and the check would no longer describe the backend.
Suggested fix: Make the value authoritative: introduce a repository option (or reuse an existing ingress/listener option) for the Jellyfin backend port and assert both the Newt target and the firewall guard against it, so drift is visible at review time rather than remembered in a literal.
Tests and validation
Questions
http://10.10.0.3:8266) still exercised over the mesh after this change? The configuration permits it via the newnebula.meshopening, but no live probe result was supplied.Review limitations
nix flake check, the Lyra build, and the new gate's own pass/fail are inferred from the supplied sources, not executed.services.tdarr.server.serverPort/webUIPort,services.immich.port,services.ollama.*,services.jellyfin.openFirewall,services.newt.enable,networking.firewall.interfaces); the gate's assertions depend on those defaults existing as assumed.allowedTCPPortsandallowedTCPPortRangeson the global firewall and non-mesh interfaces; UDP ports,extraCommands/extra iptables chains, and Docker's own rule sets are outside its scope, so a green result does not prove Docker-published ports (Signal 8888, Stash 9999, SWAG 80/443) are LAN-restricted.Diff coverage
README.md: reviewed — included in a context-limited batchflake.nix: reviewed — included in a context-limited batchhosts/lyra/default.nix: reviewed — included in a context-limited batchmodules/services/immich.nix: reviewed — included in a context-limited batchmodules/services/jellyfin.nix: reviewed — included in a context-limited batchpotential/nova/default.nix: reviewed — included in a context-limited batchscripts/check-service-exposure.nix: reviewed — included in a context-limited batchReview metadata
Native canary evidence (2026-10-12): the operator completed the documented just test-remote lyra command. Its Gitless source snapshot does not carry a configurationRevision; the controller branch is clean at
1bcc2d7, and the active snapshot closure is /nix/store/5aybxhmgxdag3dphksdb4z7kgd6g487d-nixos-system-lyra-26.11.20261008.8edc0c7.Read-only post-activation checks confirm Newt, Immich, Jellyfin, Tdarr server, both local Tdarr nodes and Ollama are active. Immich now binds 127.0.0.1:2283. From Electra, native Tdarr UI/API and Ollama return HTTP200 over Nebula; direct LAN TCP probes to 2283/8096/8265/8266/11434 all fail. Jellyfin/Immich backends reject direct mesh probes and return200 locally and through their existing Pangolin health routes. From Vega, Tdarr responds302 and Ollama200; Vega's Tdarr node remains active. The newly merged Lyra hosts mapping resolves both overlay families, and the active interface has both addresses.
The user has been asked whether the identical command was run a second time for the no-op follow-up; no confirmation is assumed. The updater is inactive with its next scheduled run later this afternoon; a hold was not observed, so this record does not claim a hold was used. Required CI for the rebased head remains queued. The MR is still unmerged pending no-op confirmation and required checks.
Assessment of review68 and completed canary/no-op:
The operator confirms a second identical just test-remote lyra pass completed. Read-only checks show Immich and the local Intel Tdarr node retain their activation timestamps from the first pass; all tested native routes and direct-LAN restrictions remain correct. The native canary/no-op gate is now satisfied.
The Beszel finding is not a live defect. After activation, beszel-agent.service is active, no TCP45876 listener exists, and the hub reports Lyra UP with a fresh update at 2026-10-12T13:48:02Z, later than the canary. Service monitoring reports zero failed units. This confirms monitoring still works with inbound45876 closed. Beszel supports agent-initiated WebSocket transport to HUB_URL independently of its optional inbound SSH listener: https://beszel.dev/guide/security. No extra mesh/LAN port will be opened without an actual consumer requirement.
The opt-in suggestion is a possible future generalisation, not a current defect: this check intentionally validates Lyra's reviewed native-service composition, whose hosts/lyra/default.nix explicitly enables these services. An intentional service retirement or migration must update the corresponding exposure contract rather than silently preserve unused openings. Port moves are already derived from the service options and checked with injected overrides.
The shared Jellyfin/Newt option suggestion remains declined for the reason in comment3280: both authoritative settings are external and a local copy cannot assert their live state. The canary now verifies the actual local/Pangolin endpoints.
No further source changes are warranted by this feedback. The remaining merge gate is the required CI job for
1bcc2d7, currently waiting for the Nova runner. I am inspecting that queue; no checks will be bypassed.