Repository navigation
fix(ssh): a system-SSH host whose sshd refuses forwarding reaches its managed server over exec - #28408
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a4c4f54d-666f-4e8c-b49c-b466623ff536
📥 Commits
Reviewing files that changed from the base of the PR and between 6cfe678 and 2c95c6d549edfe5f0dd408e33324e4910a3dbbbe.
📒 Files selected for processing: 8
src/main/ssh/orcad-managed-tunnel-transport.test.tssrc/main/ssh/orcad-managed-tunnel-transport.tssrc/main/ssh/orcad-stdio-bridge-provider.test.tssrc/main/ssh/orcad-stdio-bridge-provider.tssrc/main/ssh/ssh-port-forward-provider.tssrc/main/ssh/ssh-tcp-forwarding-probe.test.tssrc/main/ssh/ssh-tcp-forwarding-probe.tssrc/main/ssh/system-ssh-port-forward-provider.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
2c95c6d to
f11e65c
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
fa168bfa-3a41-45c4-a8d4-02a484b09196
📥 Commits
Reviewing files that changed from the base of the PR and between 2c95c6d549edfe5f0dd408e33324e4910a3dbbbe and f11e65c.
📒 Files selected for processing: 6
src/main/ssh/orcad-managed-tunnel-transport.test.tssrc/main/ssh/orcad-managed-tunnel-transport.tssrc/main/ssh/ssh-port-forward.test.tssrc/main/ssh/ssh-system-fallback.test.tssrc/main/ssh/system-ssh-args.tssrc/main/ssh/system-ssh-port-forward-provider.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
b5fa9d8 to
e56f4ab
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
9129cb99-2962-46e7-9e30-7c92a0e98b13
📒 Files selected for processing: 2
src/main/ssh/orcad-managed-tunnel-transport.test.tssrc/main/ssh/orcad-managed-tunnel-transport.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
… managed server over exec A host Orca reaches through system OpenSSH (ProxyJump/ProxyCommand, security keys) and whose sshd runs AllowTcpForwarding no showed connected while no managed-server traffic could pass: the ssh -L listener comes up before sshd is ever asked for a channel, and the stdio bridge excluded system SSH. The managed tunnel now dials once through a fresh system-SSH forward and reads OpenSSH's own channel answer from its stderr. An administrative refusal closes the forward and carries the tunnel over the stdio bridge on a system-SSH exec, on the same persisted local port; a host where the bridge cannot run fails the connect with that reason instead of reporting a dead forward as up. Refs #24863
…at exits mid-check
…n that answered it
e56f4ab to
bf81ee5
Compare
… managed server over exec (stablyai#28408) * fix(ssh): a system-SSH host whose sshd refuses forwarding reaches its managed server over exec A host Orca reaches through system OpenSSH (ProxyJump/ProxyCommand, security keys) and whose sshd runs AllowTcpForwarding no showed connected while no managed-server traffic could pass: the ssh -L listener comes up before sshd is ever asked for a channel, and the stdio bridge excluded system SSH. The managed tunnel now dials once through a fresh system-SSH forward and reads OpenSSH's own channel answer from its stderr. An administrative refusal closes the forward and carries the tunnel over the stdio bridge on a system-SSH exec, on the same persisted local port; a host where the bridge cannot run fails the connect with that reason instead of reporting a dead forward as up. Refs stablyai#24863 * fix(ssh): keep refusal logs under a quiet LogLevel; fail a forward that exits mid-check * fix(ssh): an orphaned forward from before LogLevel=INFO still matches for recovery * fix(ssh): confirm the persisted port is free before the stdio bridge binds it * fix(ssh): record a forwarding refusal against the transport generation that answered it --------- Co-authored-by: m4air <[email protected]> (cherry picked from commit e4824ce)
ELI5
Some SSH servers allow running commands but refuse to forward network ports. When Orca reached such a server through the system
sshprogram (for example a jump host, a ProxyCommand, or a hardware security key), it reported the host as connected even though nothing could get through to the managed Orca server. With this change Orca notices the refusal and sends the traffic through a running command instead, which those servers do allow. If even that is impossible, the connect fails with the reason.What Changed
Before: a host on system OpenSSH with
AllowTcpForwarding nostarted anssh -N -Lforward. Its local listener came up, so the tunnel counted as started. But sshd had not yet been asked to open a channel, and it refused every one. The host showed connected, while workspace calls and terminals could never reach the server. The stdio bridge that handles this case for the built-in SSH client explicitly excluded system SSH, and the forwarding probe returns "unverifiable" without a built-in client.After:
open failed: administratively prohibited, or asopen failed: connect failedwhen the remote port has nothing listening. Reply bytes from the server also count: a few junk bytes make orcad's HTTP server answer400straight away.ssh <host> <bridge command>), on the same persisted local port.ssh -Lmay hold.-o LogLevel=INFO. OpenSSH logs a refused channel at INFO, so a user config withLogLevel ERRORorQUIETwould otherwise hide the refusal. The orphaned-forward matcher from fix(ssh): an SSH host comes back after restarting Orca instead of staying offline (STA-10476) #28398 ignores that one option, so a stuck forward left by an older version is still recognised and cleared after the update.Why
MaxSessions(10 by default) with all other exec work. With multiplexing off, each one is a fresh login, which means a security-key touch every time. That is a larger behaviour change than this release should carry.-Lstays the default wherever it works.Linked Issue
Fixes #24863
Visual Proof
N/A: no UI change. The difference is that the connection works (or fails with a reason) instead of showing connected.
Testing
Real host (Linux, OpenSSH 10.5): I ran a user-level sshd with
AllowTcpForwarding noon a high port and reached it from macOS through-J(ProxyJump, so system SSH):ssh -Lreadrefusedin 10 ms.allowedfrom reply bytes in 52 ms.OrcadManagedTunnelTransportProvider.startclosed the-Land served the persisted local port over the system-SSH exec bridge. HTTP went end to end, and the transport was recorded asstdio_bridge.Unit tests:
pnpm tc,pnpm lint, oxlint andcheck:code-quality:changedall pass.No new Docker e2e case. The Docker fixture has no system-SSH route: system OpenSSH reads host keys from the account's real
~/.ssh, which the e2e HOME isolation does not cover. The existing "sshd refuses TCP forwarding" Docker spec still covers the built-in client's bridge path.Review
Agent skill upstream boundary
Notes
ssh -Lprocess lifecycle (quit cleanup, stale-port recovery) is handled separately in fix(ssh): a host whose ssh_config forwards a port can still open its server tunnel (STA-10471) #28396 and fix(ssh): an SSH host comes back after restarting Orca instead of staying offline (STA-10476) #28398.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)