Try several SSH addresses for a node #27

Open
opened 2026-11-29 19:46:20 +00:00 by slop-cannon · 0 comments

Let a deploy node list several SSH addresses, tried in order, so the broker can reach boxes that move between networks.

Why

A node has one hostname in deploy-rs. A laptop that's sometimes at home and sometimes away is reachable at different addresses: nixfiles' tower lists tower.dyn.<home domain> (on the home network), then tower.ts.<public domain> (Tailscale), in my.deploy.sshHostnames. Only nixfiles' ssh-machine reads that list; deploy-rs and slop-broker use hostname alone, so slop status tower and slop deploy tower fail whenever that address doesn't work from the broker's box.

Proposal

slop-broker

  • The builder reads an optional sshHostnames list from each node in deploy.nodes (n.sshHostnames or [ ]), next to hostname, sshUser, sshOpts and sudo. Without it, hostname is the only address.
  • Before connecting to a node (status, logs, failed, ssh, and a deploy's copy, comparison and activation), the broker picks an address once per request:
    • each address but the last gets a TCP connection to its SSH port (from ssh -G with the node's options, as ssh-machine does), with a short timeout;
    • the first that answers wins, otherwise the last.
  • What was picked is visible: a slop: line for the requester, and the address in the audit log. Approvers should see where a command will run; the address can change between requests.
  • Documented as a generic extension to deploy-rs's node attributes, not as a nixfiles feature.

nixfiles

  • deploy-rs.nix copies my.deploy.sshHostnames onto each rendered node as sshHostnames. deploy-rs's schema only restricts node and profile names, and its Rust side ignores unknown fields; nix flake check (with deployChecks) should confirm that.
  • ssh-machine can then read it from the node instead of sshConnections.

Open questions

  • Pick once per request, or once per connection? A deploy opens several connections; using one address for all of them is simpler and easier to follow.
  • Containers (<node>.container-<name>) go through their host, so they'd follow the host's choice.
  • Should --host accept several addresses too? Probably not needed.

Not part of #22.

Let a deploy node list several SSH addresses, tried in order, so the broker can reach boxes that move between networks. ## Why A node has one `hostname` in deploy-rs. A laptop that's sometimes at home and sometimes away is reachable at different addresses: nixfiles' `tower` lists `tower.dyn.<home domain>` (on the home network), then `tower.ts.<public domain>` (Tailscale), in `my.deploy.sshHostnames`. Only nixfiles' `ssh-machine` reads that list; deploy-rs and slop-broker use `hostname` alone, so `slop status tower` and `slop deploy tower` fail whenever that address doesn't work from the broker's box. ## Proposal ### slop-broker - The builder reads an optional `sshHostnames` list from each node in `deploy.nodes` (`n.sshHostnames or [ ]`), next to `hostname`, `sshUser`, `sshOpts` and `sudo`. Without it, `hostname` is the only address. - Before connecting to a node (`status`, `logs`, `failed`, `ssh`, and a deploy's copy, comparison and activation), the broker picks an address once per request: - each address but the last gets a TCP connection to its SSH port (from `ssh -G` with the node's options, as `ssh-machine` does), with a short timeout; - the first that answers wins, otherwise the last. - What was picked is visible: a `slop:` line for the requester, and the address in the audit log. Approvers should see where a command will run; the address can change between requests. - Documented as a generic extension to deploy-rs's node attributes, not as a nixfiles feature. ### nixfiles - `deploy-rs.nix` copies `my.deploy.sshHostnames` onto each rendered node as `sshHostnames`. deploy-rs's schema only restricts node and profile names, and its Rust side ignores unknown fields; `nix flake check` (with `deployChecks`) should confirm that. - `ssh-machine` can then read it from the node instead of `sshConnections`. ## Open questions - Pick once per request, or once per connection? A deploy opens several connections; using one address for all of them is simpler and easier to follow. - Containers (`<node>.container-<name>`) go through their host, so they'd follow the host's choice. - Should `--host` accept several addresses too? Probably not needed. Not part of #22.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dev/slop-broker#27