Repository navigation
Commit 9996a59
authored
feat(cli)!: verify sandbox SSH host keys (#5703)
* feat(cli): verify sandbox SSH host keys
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>
* refactor(cli): trim SSH host key verification
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>
* fix(cli): keep existing SSH setups working with host key checks
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>
* feat(cli): let users refuse unverified SSH host keys
OPENSHELL_SSH_REQUIRE_HOST_KEY turns the two unverified cases, a sandbox
with no published fingerprint and a caller that predates host-key
verification, from a warning into a refusal. It is off by default.
Signed-off-by: Adrien Langou <alangou@nvidia.com>
* fix(cli): name the missing flags in the unverified SSH warning
The ssh-proxy warning blamed an older client, which is wrong when
someone starts the proxy by hand. It now names the missing flags.
Also say why a generated config entry turns connection sharing off: its
host alias does not name the gateway, so a shared connection would serve
the sandbox of the same name on another gateway without a host key
check. Note that the gateway issues only Ed25519 host keys, and document
that the fingerprint is read per connection and that unverified
connections are allowed by default.
Signed-off-by: Adrien Langou <alangou@nvidia.com>
* fix(cli): replace SSH config entries that accept any host key
Using --editor rewrote only the entry of the sandbox being connected, so
the entries an earlier release wrote for other sandboxes kept accepting
any host key. It now replaces each of them that is still, line for line,
what that release wrote. An entry the user edited is left alone and
keeps its warning.
The TUI also puts "SSH host key NOT verified" first in its status line
after an unverified session, because ssh takes the terminal right after
the printed warning.
Signed-off-by: Adrien Langou <alangou@nvidia.com>
* refactor(cli): return the SSH host key refusal from the relay
The relay exited the process from inside its task. It now returns the
refusal, and the CLI prints it like any other error. The exit code stays 1
and no byte of the refused key exchange reply reaches ssh.
Signed-off-by: Adrien Langou <alangou@nvidia.com>
* feat(cli)!: refuse unverified SSH host keys by default
An SSH connection whose host key cannot be verified is now refused: a
sandbox with no published fingerprint, an SSH config entry an earlier
release wrote, or an older client that starts ssh-proxy without
--host-key. Set OPENSHELL_SSH_REQUIRE_HOST_KEY=0 to connect with a
warning instead.
A stale config entry is refused before the gateway is called, and
uploads and downloads no longer retry a host key refusal.
Signed-off-by: Adrien Langou <alangou@nvidia.com>
---------
Signed-off-by: Adrien Langou <alangou@nvidia.com>1 parent 845614a commit 9996a59
17 files changed
Lines changed: 2739 additions & 107 deletions
File tree
- crates
- openshell-cli
- src
- tests
- openshell-core/src
- openshell-tui/src
- docs/how-it-works/sandboxes
- examples
- scripts
- skills
- debug-openshell-cluster
- openshell-cli
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
719 | 725 | | |
720 | 726 | | |
721 | 727 | | |
| |||
4409 | 4415 | | |
4410 | 4416 | | |
4411 | 4417 | | |
| 4418 | + | |
4412 | 4419 | | |
4413 | 4420 | | |
4414 | 4421 | | |
| |||
4428 | 4435 | | |
4429 | 4436 | | |
4430 | 4437 | | |
4431 | | - | |
| 4438 | + | |
| 4439 | + | |
| 4440 | + | |
| 4441 | + | |
| 4442 | + | |
| 4443 | + | |
| 4444 | + | |
| 4445 | + | |
| 4446 | + | |
4432 | 4447 | | |
4433 | 4448 | | |
4434 | 4449 | | |
| |||
5467 | 5482 | | |
5468 | 5483 | | |
5469 | 5484 | | |
| 5485 | + | |
| 5486 | + | |
5470 | 5487 | | |
5471 | 5488 | | |
5472 | 5489 | | |
5473 | 5490 | | |
5474 | | - | |
| 5491 | + | |
| 5492 | + | |
| 5493 | + | |
| 5494 | + | |
5475 | 5495 | | |
5476 | 5496 | | |
5477 | 5497 | | |
5478 | 5498 | | |
5479 | 5499 | | |
5480 | 5500 | | |
| 5501 | + | |
5481 | 5502 | | |
5482 | 5503 | | |
5483 | 5504 | | |
| |||
0 commit comments