feat(ssh-controlmaster): use ~/.ssh-local/config so pi --ssh can reach LAN peers
dssh reaches host-LAN peers from inside the devbox container because it runs `ssh -F ~/.ssh-local/config` (which Includes the host-owned, bind-mounted ssh-lan.conf carrying `ProxyJump host` entries). pi --ssh shelled out to plain `ssh`/`ssh -G` against the default ~/.ssh/config, which has no jump, so it could not reach peers the host can. Thread `-F <config>` through every ssh call (ssh -G, pwd probe, master start for both key and password paths, sshExec, bash exec, ssh -O exit), resolved once at load by resolveSshConfigOpts(): PI_SSH_CONFIG (leading ~ expanded, honored even if missing) else ~/.ssh-local/config if present else [] (no -F) No hostnames are baked into the image — the LAN list lives only in the host-owned, read-only-mounted ~/.config/devbox-shell/ssh-lan.conf. On the host (native pi) ~/.ssh-local/config doesn't exist, so -F is omitted and behavior is unchanged. Command-line -o options still win over -F, so own-master /tmp socket and ControlMaster decisions are unaffected. Status/notify shows [config: <path>] when a non-default config is used. Verified from the container: the patched probe reaches an enrolled peer (pve -> /root) where plain ssh times out. Reaching a new peer (e.g. alpserv-2) is now a one-line host-side edit to ssh-lan.conf. Docs: README + AGENTS.md updated.
This commit is contained in:
@@ -102,7 +102,9 @@ pi -e ~/src/src_local/pi-extensions/extensions/ssh-controlmaster.ts --ssh user@h
|
||||
6. The system prompt is patched to tell the LLM it's operating on `<remoteCwd> (via SSH ControlMaster: <remote>)`
|
||||
7. User `!` shell commands are also routed over SSH
|
||||
|
||||
**Hang-proofing:** every SSH invocation carries `ConnectTimeout=8` + `ServerAlive*` keepalives, and the startup probe / master start are additionally bounded by a 15 s wall-clock timeout. Key-auth calls also set `BatchMode=yes` so ssh can never wait silently on a `/dev/tty` password/passphrase or host-key prompt behind pi's TUI (`--ssh-ask-pass` omits `BatchMode` so the `SSH_ASKPASS` path still works). If the host can't be reached — e.g. a LAN target with **no route from inside a container** (`pi --ssh` needs a `ProxyJump` to reach LAN hosts from a devbox) — the probe fails fast with an `✗ unreachable` status and an error toast instead of hanging startup and silently swallowing your prompts.
|
||||
**Hang-proofing:** every SSH invocation carries `ConnectTimeout=8` + `ServerAlive*` keepalives, and the startup probe / master start are additionally bounded by a 15 s wall-clock timeout. Key-auth calls also set `BatchMode=yes` so ssh can never wait silently on a `/dev/tty` password/passphrase or host-key prompt behind pi's TUI (`--ssh-ask-pass` omits `BatchMode` so the `SSH_ASKPASS` path still works). If the host can't be reached — e.g. a LAN target with **no route from inside a container** — the probe fails fast with an `✗ unreachable` status and an error toast instead of hanging startup and silently swallowing your prompts.
|
||||
|
||||
**LAN reachability from inside a container (`-F` config detection):** the extension threads an `-F <config>` into every ssh call when one is available, so `pi --ssh <peer>` can reach hosts that require a `ProxyJump` exactly like the `dssh` alias does. Resolution order: `PI_SSH_CONFIG=/path/to/config` if set (leading `~` expanded), else `~/.ssh-local/config` if it exists (the pi-devbox's `setup-lan-access.sh` regenerates it on every container start), else none. **No hostnames are baked into the image** — the LAN-jump list lives only in the host-owned, read-only-mounted `~/.config/devbox-shell/ssh-lan.conf`; on the host (native pi) `~/.ssh-local/config` doesn't exist so this is a no-op. The status/notify shows `[config: <path>]` when a non-default config is in use. To reach a new LAN peer from the container, add it to the host's `ssh-lan.conf` `ProxyJump host` line (it must already be a `Host` block in the host's `~/.ssh/config`).
|
||||
|
||||
The status bar shows `⚡ own master` or `⚡ system master` so you can see which path was taken.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user