Ssh – Is stunnel capable of working like ssh -R

port-forwardingsshstunnel

I have a machine running MySQL (Windows), on a private network (let's say 192.168.1.10), behind a masquerading gateway. No port forwarding to 192.168.1.10 is possible.

I also have a server with a public ip (a.b.c.d) which I need to connect to 192.168.1.10:3306.

I can easily achieve this by using ssh's remote port forward feature; however, I was wondering if it's possible to achieve the same thing using stunnel. I need 192.168.1.10 to connect to a.b.c.d and tell a.b.c.d to open a port which will be forwarded back through stunnel to 192.168.1.10:3306.

Is this scenario possible?

image.

Best Answer

Install stunnel on the server that is supposed to do the forvarding and include this in your config when you get it running:

[mysql] accept=gateway's.public.ip.here:3306 connect=192.168.1.10:3306

Didn't test it, but that's what it should look like.

Stunnel.org has lots of examples. I like this site the most.

EDIT:

Looking at your image - what I wrote here is supposed to work on the machine you called Gateway. Calling a.b.c.d from 192.168.1.10 should be possible without anything done.

You can also configure Gateway to be a proxy.

Regardless what You use - everything will require you to work with the Gateway.