Skip to content

Commit 289b6ea

Browse files
committed
ssh jump
1 parent 7d6e43f commit 289b6ea

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pproxy/server.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,17 @@ async def prepare_ciphers_and_headers(self, reader_remote, writer_remote, host,
398398
self.streams.set_result((reader_remote, writer_remote))
399399
reader_remote, writer_remote = handler.connect(whost, wport)
400400
elif self.ssh:
401-
reader_remote, writer_remote = await reader_remote.open_connection(whost, wport)
401+
if self.relay.ssh:
402+
import asyncssh
403+
username, password = self.relay.auth.decode().split(':', 1)
404+
if password.startswith(':'):
405+
client_keys = [password[1:]]
406+
password = None
407+
else:
408+
client_keys = None
409+
reader_remote, writer_remote = await asyncssh.connect(tunnel=reader_remote, host=self.host_name, port=self.port, x509_trusted_certs=None, known_hosts=None, username=username, password=password, client_keys=client_keys, keepalive_interval=60), None
410+
else:
411+
reader_remote, writer_remote = await reader_remote.open_connection(whost, wport)
402412
else:
403413
await self.rproto.connect(reader_remote=reader_remote, writer_remote=writer_remote, rauth=self.auth, host_name=whost, port=wport, writer_cipher_r=writer_cipher_r, myhost=self.host_name, sock=writer_remote.get_extra_info('socket'))
404414
return await self.relay.prepare_ciphers_and_headers(reader_remote, writer_remote, host, port, handler)

0 commit comments

Comments
 (0)