libssh-rs icon indicating copy to clipboard operation
libssh-rs copied to clipboard

ProxyCommand resolving incorrect HostName if aliasing is involved

Open reegnz opened this issue 4 months ago • 0 comments

I have jumphosts in AWS accounts, and I connect to the hosts via ec2 instance connect. I have some artificial host names following the structure {ec2_jumphost_name}.{aws_profile_name}

My config looks something like this:

Host jumphost.*
    ProxyCommand ~/.local/bin/ec2-instance-connect-proxy-command %h %r
    IdentitiesOnly yes

Host jumphost.account_a
Host jumphost.cluster_a
    HostName jumphost.account_a

# other jumphosts following the same aliasing structure follow below
# ...

Now this setup works perfectly fine as expected using openssh. But when I tried to use a wezterm ssh to connect to jumphost.cluster_a (using wezterm ssh jumphost.cluster_a), it does not work. I assume this is an issue in libssh-rs.

Expected: the ProxyCommand sets %h to jumphost.account_a Actual: the ProxyCommand sets %h to jumphost.cluster_a

It feels as if the ProxyCommand gets lazily evaluated by openssh, but gets eagerly evaluated by libssh-rs.

reegnz avatar Oct 03 '25 11:10 reegnz