Repository navigation
feat(remote-ssh): carry SSH transports over ProxyCommand processes - #3591
Open
Raing5Days wants to merge 1 commit into
Open
Raing5Days wants to merge 1 commit into
Raing5Days wants to merge 1 commit into
Conversation
Add OpenSSH-style ProxyCommand support to the remote SSH service, first batch (backend only): - Thread an optional proxyCommand through SSHConnectionConfig, SSHConfigEntry, SavedConnection, and SavedConnectionRecord with serde defaults so older payloads and connections.json stay loadable, and include it in connection drift detection. - Spawn the ProxyCommand through the shared process manager (cmd.exe /C with raw args on Windows, sh -c elsewhere), expand %h/%p/%r/%% tokens, drain stderr into the log plus a bounded tail, and carry the SSH handshake over the joined stdout/stdin via the existing establish_stream_session path. - Own the child process for the whole session lifetime: unpublished handshakes, published connections, and disconnect/reconnect paths all kill it, and a reconnect keeps a stale proxy alive only while its old transport still serves in-flight work. Failures report the proxy exit code and stderr tail instead of a bare handshake error. - Merge ~/.ssh/config with its Include tree (recursive, glob, cycle and depth guarded) before parsing, making Coder/AtomGit style hosts visible; ProxyCommand stays exclusive with ProxyJump and container targets, rejected with explicit errors for now. The connection dialog field for editing proxyCommand lands in a follow-up batch; ~/.ssh/config hosts already carry it end to end.
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
Adds OpenSSH-style
ProxyCommandsupport to the remote SSH service (first batch, backend only), so SSH remote workspaces can follow Coder-style platform configs (coder config-ssh) where the SSH transport is a local process's stdin/stdout and the workspace itself runs no sshd.proxyCommandthreaded throughSSHConnectionConfig,SSHConfigEntry,SavedConnection, andSavedConnectionRecordwith#[serde(default)]; older payloads andconnections.jsonfiles stay loadable, andconnection_params_equaltreats a changed command as config drift.process_manager::create_tokio_command(cmd.exe /Cwith raw args on Windows,sh -celsewhere) after%h/%p/%r/%%expansion; the SSH handshake reuses the existingestablish_stream_session, so handshake timeouts, known-hosts verification, and authentication are unchanged.ActiveConnection, disconnect/reconnect/test paths all kill it). Failures report the proxy exit code plus the last stderr lines instead of a bare handshake error. A reconnect keeps a stale proxy alive only while its old transport still serves in-flight work.~/.ssh/config:Includeis now expanded before parsing (recursive, glob,~, cycle- and depth-guarded), so hosts that only exist in included files (Coder, AtomGit, devenv) are listed and resolved. In this releaseProxyCommandis exclusive withProxyJumpand Docker container targets; combinations are rejected with explicit errors.No UI yet by design: the connection-dialog field lands in a follow-up batch. The field already flows end to end from
~/.ssh/configresolution, saved configs, and wire payloads.Type and Areas
Type: Feature
Areas: Rust services (
services-integrationsremote_ssh / remote_persistence), legacy migration adaptersMotivation / Impact
OpenBitFun could only connect over direct TCP (plus ProxyJump chains), and
ssh_config0.1 neither understandsProxyCommandnor expandsInclude, so Coder-style hosts were silently treated as normal direct hosts and included Host blocks were invisible. With this change a saved config (or~/.ssh/confighost) carryingProxyCommandconnects through the proxy process, and included Host blocks show up in the host list. Pod rebuilds on such platforms no longer require re-provisioning an sshd.Verification
cargo test -p openbitfun-services-integrations --no-default-features --features remote-ssh-concrete --lib remote_ssh::— 159 passed / 0 failed (includes new ProxyCommand token/lifecycle/exclusivity tests and Include loader tests)cargo test -p openbitfun-services-integrations --no-default-features --features remote-ssh --test remote_ssh_contracts— 18 passed / 0 failed; same target under--features remote-ssh-concrete— 17 passed / 0 failedcargo test -p openbitfun-services-integrations --no-default-features --features remote-persistence --lib remote_persistence::tests::— 4 passed / 0 failedcargo clippy -p openbitfun-services-integrations --no-default-features --features remote-ssh-concrete --lib --tests— no warnings in the new codecargo check -p openbitfun-legacy-migration-adapters --lib --tests— passednode scripts/check-core-boundaries.mjs— passednode scripts/format-changed-rust.mjs— cleanReviewer Notes
ProxyCommand+ProxyJump,ProxyCommand+ container targets, WSL +ProxyCommand.~/.ssh/configalias in OpenBitFun's known-hosts store; Coder workspaces that regenerate host keys will surface the app's own host-key verification on reconnect.StrictHostKeyCheckingremains unparsed.Generated with OpenBitFun