Repository navigation
[v0.2] Support multi-hop ProxyJump chains - #24
Merged
Merged
Conversation
Parse comma-separated -J lists into ordered jump chains, nest one ProxyCommand per hop, and name the hop OpenSSH blames when a chain fails. The integration fixture now runs both a single-hop and a two-hop chain against containerized sshd instances. Refs #11 Signed-off-by: Xingqiu Xu <hilbertanjou83@gmail.com>
4 tasks
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.
Parent: #1
Closes #11
What changed
parse_jump_chainsplits a pastedssh -J hop1,hop2 targetinto ordered hops and rejects malformed chains (a,,b,a,,,a) with "Jump chain contains an empty hop" instead of bleeding into a hop parser error.The runner builds one nested
ProxyCommandper hop. The first hop is connected directly; each later hop carries the previous command as its ownProxyCommand, and the outermost command forwards to the target:OpenSSH expands
%h:%pagainst the destination of the process whose configuration carries the ProxyCommand, so each level forwards to the correct address and Line never has to resolve intermediate addresses itself.When a chain fails,
SessionResult::failing_jump_hopreads the OpenSSH diagnostics for whole host tokens and names the hop asjump i/n <authority> unreachable. Matching is token-bounded, so10.0.0.5does not match a diagnostic about10.0.0.55.The obsolete
SshError::UnsupportedJumpChainvariant is gone.ADR-0002 records the nesting rule and the failure-reporting rule.
Verification
docker-backed integration test now runs a real two-hop chain: the first jump is published on the host, the second jump and the target are reachable only through the hop before them, and all three are separatesshdcontainers on one Docker network.ProxyCommand=, two-W, first hop nested inside the second), hop identification with a prefix-overlap case, and editing a profile that already has multiple hops.cargo test --all-targets --locked,cargo clippy --all-targets --all-features --locked -- -D warnings,cargo +1.88.0 check --all-targets --locked,cargo fmt --checkall pass.Note on quoting
Nested commands are embedded with a dedicated
shell_quote_nestedso the inner command is quoted exactly once for the shell that runs the outer ProxyCommand. Re-quoting it through the generalshell_quoteproduced correct but heavily escaped commands (''''…'''') that madepsoutput and diagnostics unreadable.