Fix ProxyJump to support SSH ports and host aliases#705
Fix ProxyJump to support SSH ports and host aliases#705andrewleech wants to merge 3 commits intoMisterTea:masterfrom
Conversation
|
@andrewleech now that master has the ci setup fixed, could you rebase so we can make sure the tests all pass. Potentially consider adding a new test case to the connect_with_jumphost but using the ssh path you have fixed. |
44bc863 to
64b2688
Compare
|
Thanks for the suggestions @jshort |
|
@andrewleech looks like this is breaking CI? |
64b2688 to
6d3be72
Compare
Oh I see. So in a PR of mine just recently (tunnel/reversetunnel support for bind address and ssh -L/-R notation) I implemented ipv6 bracket parsing of -L/-R arguments. Do you think this logic for the tunnel args and your host parsing for ipv6 addrs in brackets can be shared? Also maybe an OBOE (note trailing colon):
|
- Preserve SSH port from ProxyJump value for ssh -J flag - Parse [user@]host[:sshport] format correctly (including IPv6) - Resolve ProxyJump host aliases via SSH config lookup - Extract jumphost username from SSH config - Use resolved hostname (not alias) in SSH command - Add freeOptionsFields helper to ParseConfigFile.hpp - Add system test for ProxyJump with SSH config alias
- Move parseHostString to HostParsing.hpp for reuse and testing - Add unit tests covering IPv4, IPv6, user@host, and port combinations - Add edge case tests for empty string and malformed IPv6
GitHub Actions linux_ci runs sshd on port 2222, not 22. The test was hardcoding port 22, causing SSH to hang on CI where nothing listens on that port. Use `ssh -G localhost` to detect the effective port from the environment's SSH config.
3d089e1 to
50e7121
Compare
|
Rebased cleanly onto upstream/master — the merge commit and its fix-up are gone, now 3 linear commits. Re: Re: sharing IPv6 bracket parsing with tunnel args — unless I misinterpreted what you had in mind, the formats seem different enough that sharing would hurt clarity:
The bracket-tracking logic itself is only a few lines in each case. An adapter to bridge the format differences would be more code than the duplication it eliminates. Happy to reconsider if you see a cleaner way to factor it though. |
ET currently fails to connect through jump hosts when the jump host uses a non-standard SSH port or when ProxyJump references an SSH config Host alias.
For example, with this SSH config:
Running
et destinationfails withCould not reach the ET server: jumphost:2022The issue is that the ProxyJump parsing code was stripping SSH ports from the jump host value:
Additionally, Host aliases like "jumphost" weren't being resolved to actual hostnames, so ET tried to connect to the alias name instead of the configured hostname.
This PR fixes both issues by:
[user@]host[:port]when passing to SSH via-JflagTested with the config above. Before the fix
et destinationfails, after it successfully connects via jump.example.com:2222 (SSH) -> destination (ET).No breaking changes expected - existing ProxyJump configurations should continue to work, though I don't currently have a working jumphost setup to verify backwards compatibility directly.