Repository navigation
Conversation
The CLI, the TUI, and generated SSH config entries accepted any SSH host key. They now run ssh with StrictHostKeyChecking=yes against a per-sandbox known-hosts file. The ssh-proxy relay reads the host key from the server's key exchange reply, pins it only when its SHA-256 fingerprint equals the one the gateway published, and withholds the reply otherwise. A sandbox with no published fingerprint is refused unless OPENSHELL_SSH_ALLOW_UNVERIFIED_HOST_KEY=1 is set. SSH config entries generated by earlier releases are refused with the command that regenerates them. Signed-off-by: Adrien Langou <alangou@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
🌿 Preview your docs: https://nvidia-preview-pr-5703.docs.buildwithfern.com/openshell |
Restore the base shape of the SSH option and proxy-command helpers where the feature does not need a new one, fold duplicate tests into tables, and drop tests that repeat a proof at a more expensive level. No change to what is verified or refused. Signed-off-by: Adrien Langou <alangou@nvidia.com>
|
Label |
|
/ok to test 3cdb3a9 |
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. cli — No explicit risk acceptance found
2. cli — No explicit risk acceptance found
3. configuration — No explicit risk acceptance foundAn existing setting such as
Review details
Advisory review; publication gates are unchanged. |
Address the compatibility review of the host key verification change. A sandbox with no published fingerprint connects with a warning instead of being refused, so gateways that predate sandbox SSH identities keep working. The OPENSHELL_SSH_ALLOW_UNVERIFIED_HOST_KEY opt-out is no longer needed. SSH config entries and running clients from an earlier release keep working: ssh-proxy relays without a check and warns, since their ssh accepts any host key anyway. A '%' in the config directory is escaped for ssh instead of rejected. Harden the relay gate: an identification line is at most 255 bytes, so the gate and every ssh release hand over to packets at the same byte, and a group exchange reply is accepted only after its group. Signed-off-by: Adrien Langou <alangou@nvidia.com>
|
/ok to test ee95035 |
Compatibility review (advisory)New or updated breaking changes; see the full report for all findings. 1. configuration — No explicit risk acceptance foundSSH operations previously accepted XDG_CONFIG_HOME/HOME paths containing double quotes, Unix backslashes, or literal '${', but now reject them as unusable known-hosts paths.
Review details
Advisory review; publication gates are unchanged. |
Summary
The CLI, the TUI, and generated SSH config entries accepted any SSH host key from a sandbox. They now check it against the fingerprint the gateway publishes, so a connection that reaches the wrong SSH server fails before authentication.
Related Issue
Follow-on to #3835 (item 4 of its design, "CLI and TUI verify against the fingerprint"). #3835 is closed, so this PR needs its own tracking issue before it leaves draft.
Changes
sshruns withStrictHostKeyChecking=yesagainst one known-hosts file per sandbox, under<config>/openshell/known_hosts/<gateway>/. Other trust sources are disabled.ssh-proxyreads the host key from the server's key exchange reply. It pins the key only when its SHA-256 fingerprint equals the published one, and withholds the reply otherwise. It accepts only the exact cleartext sequence a server sends beforeNEWKEYS.openshell_core::ssh_host_keyowns the fingerprint format, the pin file, thesshoptions, and the relay check.sandbox_ssh_argscannot be called without it.Out of scope: the gateway's own SSH client for
ExecSandbox(#557), and a readable multi-line refusal in the TUI, which stays a one-line status.Release Notes
OpenShell clients now verify the sandbox SSH host key on every SSH connection they open.
Testing
Ran on Linux with OpenSSH 10.0p2:
cargo testforopenshell-core,openshell-cli, andopenshell-tui,cargo clippy --all-targets -D warningson the same crates,cargo fmt --check, and the lockfile check.ssh_proxy_host_key_integrationruns the realsshbinary through the builtopenshell ssh-proxyagainst a russh server: the published key connects, another key is refused before any command runs, a stale pin is replaced, andsshrefuses a key missing from its own known-hosts file. Two of these run with a%in the config directory. The same file checks that a caller without the new flags, and a gateway that publishes nothing, are relayed with a warning.Not run locally: the E2E suites, macOS, and OpenSSH 8.x. The existing conformance test
ssh_host_identity_stable_across_stop_start_and_new_on_recreateexercises the relay check against a real supervisor in CI.Checklist