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 |
Contributor
Author
|
/ok to test 3cdb3a9 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
OPENSHELL_SSH_ALLOW_UNVERIFIED_HOST_KEY=1allows the connection with a warning.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.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