forked from SWISDATA/processintel
nix.module: TCP mode cannot work because of the network sandboxing #60
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ffrauenberger/ProcessIntel#60
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Severity: medium (the module's TCP option cannot work)
Where
module.nix:94-101,:191-199,:209-216,:267-277Problem
useSocketdefaults tocfg.production, so a non-production deployment binds TCP (--host localhost --port 8501) by default. The systemd unit, however, always sets:RestrictAddressFamilies = "AF_UNIX"makessocket(AF_INET, …)fail, so uvicorn cannot bind and the service crash-loops.PrivateNetworkputs the listener in a private namespace that the nginx upstreamlocalhost:8501cannot reach.Steps to reproduce
production = false(anduseSocketleft at its default)systemctl status/ the journal of the serviceExpected behavior
The service listens on
localhost:8501and is reachable through nginx.Actual behavior
The service cannot bind its TCP socket and crash-loops.
Fix
Apply
PrivateNetwork/RestrictAddressFamilies = "AF_UNIX"only whenuseSocketis true (lib.mkIf cfg.useSocket). In TCP mode allowAF_INET AF_INET6 AF_UNIXand dropPrivateNetwork.from
issues/DEP-001-nixos-module-tcp-mode-cannot-work.md(code analysis of commit6bcc646, 2026-10-03)