You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Lewis Wolf <le...@du.co> on 2020/11/04 20:59:45 UTC

SSHD Transparent Reverse Proxy? Man-in-the-middle?

Hi SSHD Users!

This question comes from a position of not knowing ssh/sftp very deeply...
so education might be needed here.

I have a requirement that possibly looks like a transparent reverse proxy,
or a legitimate man-in-middle. The client needs to connect to their sftp
server (which we've already got), but now we need to put some routing
between them and the many servers we'll have. The key thing here is that we
can't get the clients to change their sftp command (e.g. we can't ask them
to add -L, -R, or -D, etc. for ssh, or -oLocalForward, -oRemoteForward, or
-oProxyCommand, etc. for sftp).

So, because tcp/ip routing can't look at more useful data (source ip is not
enough), we need to route based on something like user name.

Enter https://github.com/tg123/sshpiper - this has some nice ascii art that
shows how it solves this problem... but does so in Go.

The question is, can we do something like sshpiper with sshd?

I can see how I might capture all sftp events (with an SftpEventListener)
and pass on the commands to a client mapped by session id - a client
previously built during the authorisation phase, maybe? This isn't a good
option as files would briefly sit on the middle server...

Is there a way to pipe a downstream connection (from the original client)
to an upstream connection (one of many sftp servers) mapped by user name?

Thanks for any help,
Lewis