feat(ssh): add connection multiplexing runtime (#286) - #312
Merged
Merged
Conversation
Add a private Unix control socket protocol that reuses one authenticated SSH transport for passenger sessions and runtime forwarding control. Implement typed ControlMaster, ControlPath, and ControlPersist policy resolution, bounded same-user handshakes, stale-socket handling, exact forwarding registration, and check, forward, cancel, exit, and stop commands. Cover authentication reuse, persist timer reset, graceful and immediate shutdown, socket safety, parser boundaries, and forwarding teardown with unit and live SSH tests. Refs #286
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
ControlMaster,ControlPath, andControlPersistfrom CLI and ssh_config with OpenSSH-compatible precedence, integer duration parsing, required path token expansion, explicitControlPath none, and actionable path-length errors.-M,-O check|forward|cancel|exit|stop, long-form--control-path, runtime local/remote/dynamic forwarding changes, graceful stop, immediate exit, and finite persist timer reset.Implementation notes
The control protocol is a versioned bssh-to-bssh protocol rather than OpenSSH mux v4. Passenger attach is attempted before key selection, password prompting, or network authentication, and
LocalCommandremains in the invoking process after a compatible handshake.Independent audit findings were incorporated for repeated
-Msemantics,ControlPath none, strictControlPersistparsing, dead-master timeout fallback, passengerTERMpropagation, stalled-handler limits, child-task cancellation, and remote-forward cancellation error reporting.Validation
cargo fmt --all -- --checkcargo check --lib --bin bsshcargo clippy --lib --bin bssh --test control_multiplexing_live_test --no-deps -- -D warningscargo test --lib— 1,684 passed, 7 ignoredcargo test --test control_multiplexing_live_test— 3 passedcargo test --test forwarding_live_test— 9 passedDependency boundary
Refs #286. This PR intentionally does not auto-close the issue: the canonical
-S/-N/-finvocation, persistent-master background lifecycle, and pinned regression harness gates depend on the short-flag/background work in #287. The #287 delivery will close both issues after those combined acceptance criteria pass.