I have a situation where we are trying to get data from one network to another - specifically access to a private maven repo on a different network.

Network 1 contains a maven repo. And network is protected by a couple SSH hops where port forwarding is disabled on sshd.

  • [Laptop], running a Docker Container with VPN into other network laptop

    • Docker Container vpn
  • [Jumpbox] jumpbox.vpn.network.org

  • [Server] server.vpn.network.org

We have successfully run vscode-server on server and connect via:

socat tcp-listen:8080,fork EXEC:"ssh server.vpn.network.org nc localhost 8081"

This lets laptop hit localhost:8080 and it tunnels traffic into our server.vpn which then goes into netcat and sends the traffic into vscode server

I figure it should be possible to do the opposite I'm just getting stuck.

The goal would be to run a Socks5 proxy on laptop via something like

ssh -f -N -D 54321 localhost

And then make a socat call into server.vpn.network.org and then using the socks env vars I could run maven and have it proxy back through the connection etc.

The approach I took was trying this:

socat -v TCP:localhost:54321 EXEC:"ssh server.vpn.network.org nc -lkv localhost 54321"

It was "sort" of working but kept dropping connection.

I then tried a combo of fork and reuseaddr and they didn't seem to solve the issue.

My next approach was to consider unix sockets or something funky - but I'm wondering if somebody knows how to make this work.


1 Answer 1


I am not sure if I understand your setup and what you want achieve. If I do, you might replace the first example just with:

ssh -L 8080:localhost:8081 server.vpn.network.org

and the solution for reverse is:

ssh -R 54321:localhost:54321 server.vpn.network.org

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .