Fix ProxyJump to support SSH ports and host aliases#705
Fix ProxyJump to support SSH ports and host aliases#705andrewleech wants to merge 4 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. |
|
@andrewleech I thought our Ci was flaky but I've run this several times and it is timing out. Can you run ctest on your side and see what is causing the issue? |
Test 4 was missing --port 9901 for the destination ET server. Without it, the default port 2022 was used, causing the jump daemon to try connecting to 127.0.0.1:2022 where nothing listens. The jump daemon enters an indefinite reconnect loop (UserJumphostHandler retries on failed connect), so the et client hangs waiting for a response that never arrives. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Found the hang. Test 4 in connect_with_jumphost.sh was missing --port 9901 for the destination ET server. Without it, I've pushed a fix - just adds |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #705 +/- ##
==========================================
- Coverage 87.05% 86.82% -0.24%
==========================================
Files 70 71 +1
Lines 5161 5366 +205
Branches 483 500 +17
==========================================
+ Hits 4493 4659 +166
- Misses 667 707 +40
+ Partials 1 0 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.