Repository navigation
fix(pm-stack): align ready-for-agent bind scope to loopback + tailnet (#1181) #4657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,7 @@ in | |
| tailnetAddress = lib.mkOption { | ||
| type = lib.types.str; | ||
| default = "100.99.113.103"; | ||
| description = "The host's tailnet address; Grist and Pad bind it alongside loopback, as the compose files did."; | ||
| description = "The host's tailnet address; Grist and Pad bind it alongside loopback, as the compose files did, and the ready-for-agent tailnet socket forwards it to the loopback-only app (#1181)."; | ||
| }; | ||
| }; | ||
|
|
||
|
|
@@ -127,15 +127,45 @@ in | |
| ]; | ||
| # The binary is installed by pm-stack/ready-for-agent/install.sh; | ||
| # state (SQLite) lives in ~/.local/share/ready-for-agent/ by | ||
| # upstream default. Bare --host binds all interfaces — Drew's | ||
| # 2026-10-25 call (LAN/tailnet fine; no public route exists). | ||
| ExecStart = "${home}/.local/bin/ready-for-agent start --no-open --host"; | ||
| # upstream default. No --host flag: upstream's default bind is | ||
| # loopback only. The all-interfaces bind (bare --host) was | ||
| # retired by #1181 — it also claimed any future WAN-facing | ||
| # interface, broader than the stack's access model (loopback + | ||
| # tailnet; public only behind a password). Tailnet access is | ||
| # restored by the ready-for-agent-tailnet socket below, which | ||
| # forwards the tailnet address to the loopback listener. | ||
| ExecStart = "${home}/.local/bin/ready-for-agent start --no-open"; | ||
| Restart = "on-failure"; | ||
| RestartSec = 10; | ||
| }; | ||
|
|
||
| Install.WantedBy = [ "default.target" ]; | ||
| }; | ||
|
|
||
| # Tailnet entry point for ready-for-agent (#1181): the app itself | ||
| # binds loopback only (single-address --host upstream), so the | ||
| # tailnet address is served by a socket-activated systemd proxy | ||
| # forwarding to 127.0.0.1:6056 — the same loopback + tailnet scope | ||
| # Grist and Pad get from their dual port publishes. | ||
| systemd.user.sockets.ready-for-agent-tailnet = { | ||
| Socket = { | ||
| ListenStream = "${cfg.tailnetAddress}:6056"; | ||
| }; | ||
|
|
||
| Install.WantedBy = [ "sockets.target" ]; | ||
| }; | ||
|
|
||
| systemd.user.services.ready-for-agent-tailnet = { | ||
| Unit = { | ||
| Description = "ready-for-agent tailnet forward (socket-activated proxy to loopback)"; | ||
| Requires = [ "ready-for-agent.service" ]; | ||
| After = [ "ready-for-agent.service" ]; | ||
| }; | ||
|
|
||
| Service = { | ||
| ExecStart = "/run/current-system/sw/bin/systemd-socket-proxyd 127.0.0.1:6056"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
On the NixOS deployment, this points into the system profile's Useful? React with 👍 / 👎. |
||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the lingering user manager starts before Tailscale assigns
cfg.tailnetAddressat boot, this socket fails withEADDRNOTAVAIL. It is enabled through the user'ssockets.target, with neither address-readiness ordering nor a retry mechanism, so the later appearance of the tailnet address does not restore remote access without restarting the socket. SetFreeBind = trueso the listener can be established before the address exists; the systemd socket documentation states that this option defaults to false and recommends it when binding a specific IP address.Useful? React with 👍 / 👎.