Description
Hi there.
I'm trying to implement an SSH tunnel that uses AWS SSM ("AWS Systems Manager") commands to communicate with a host. The way this apparently works with an openssh
client is to configure a 'ProxyCommand' directive which I believe forks a process and then sends the SSH handshake and data to/from that process instead of a socket. ( AWS docs here: https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-enable-ssh-connections.html ).
I was looking around the sshj source files looking for a way of doing this, but I can't see if this has been implemented anywhere.
I can see I might be able to connect my own InputStream/OutputStreams by calling SSHClient.connectVia()
instead of calling SSHClient.connect()
, but the only example I can find is Jump.java here: https://github.com/hierynomus/sshj/blob/master/examples/src/main/java/net/schmizz/sshj/examples/Jump.java
which passes in a DirectConnection, but that class still seems network-oriented rather than stream-oriented.
Is what I'm looking for possible out of the box using sshj or do I have to create a new kind of Channel / Transport / Connection class ?
There is mention of proxy connections in this PR: #756 but this looks like it's referring to SOCKS/HTTP proxies rather than ProxyCommand
s
I wasn't sure how 'ProxyCommand' was implemented in openssh
either... if it helps their implementation is here: https://github.com/openssh/openssh-portable/blob/master/sshconnect.c#L196
which is called from https://github.com/openssh/openssh-portable/blob/master/ssh.c#L1641
The command I need to use in the java equivalent to the openssh ProxyCommand
is some AWS-supplied abomination written in go, but for the purposes of the java code is just a process that communicates via stdin/stdout.
Hoping you can give me some tips on what I need to do to get this use-case to work :)
Thanks in advance,
Greg