asyncssh
asyncssh copied to clipboard
ProxyJump is not treated as a list
Hi,
In https://github.com/ronf/asyncssh/blob/develop/asyncssh/connection.py#L6996, ProxyJump is treated as if it can only contain a single hostname, but per the spec it is actually a space separated list of hosts to tunnel through. See e.g. https://man.openbsd.org/ssh_config#ProxyJump.
A test case like the below should be sufficient to validate a solution, though setting up additional servers for the test may be prudent.
@asynctest
async def test_proxy_jump(self):
"""Test connecting a tunnneled SSH connection using ProxyJump"""
write_file('.ssh/config', 'Host target\n'
' Hostname localhost\n'
f' Port {self._server_port}\n'
f' ProxyJump localhost:{self._server_port} localhost:{self._server_port}\n'
'IdentityFile ckey\n', 'w')
try:
async with self.connect(host='target', username='ckey'):
pass
finally:
os.remove('.ssh/config')
I will try to submit a draft PR with a potential fix shortly.