I'm having a hard time understanding how to set this process up. I'm having a hard time understanding the -R and -L options with ssh clients.
My goal: Proxy an SSH connection from a dedicated little Linux box that's continuously connected via SSH to a publicly available server to an internal resource on a corporate LAN.
Setup:
[Private Server]:192.168.1.2:80 <-- "LAN Server" Web Server
[A linux box with SSH]:192.168.1.3 <-- "LAN Host" Linux Box
^- private IP's (192.168.1.x)
{router} & {Internet}
[Public Server:x.x.x.x:22 <-- Publicly available SSH server
[Laptop from an end user]: Could be anywhere...coffee shop for example
Desired effect:
Private Server <-- LAN Host --> ssh to Public Server <-- Laptop ssh into Public Server, accesses resource on:
http://localhost:xxxx
I want the Laptop online to be able to ssh into a publicly available server which port forwards to a port on the LAN host which is also connected to the server and then the LAN host forward whatever port works to port 80 on the internal LAN web server.
I understand VPN and port forwards...I can do all that but for this example I am working on a different project where I need this type of setup...this is only an example.
I thought what I was to do is:
LAN Host --> Public Server: ssh -R 12000:192.168.1.2:80 -p 22
user@pub.lic.ip.addy
* Connects to the public server and reverse forward port 12000 to 192.168.1.2:80 (www)
Laptop --> Public Server: ssh -L 12001:localhost:12000 -p 22
user@pub.lic.ip.addy
Result: The "Public Server" is now connected to both hosts and if you go to:
http://localhost:12001 it reverse redirects you to the LAN host's port 12000 which is redirecting you to the 192.168.1.2:80
...it doesn't seem to work though.
I'm still playing around with it but I'm hoping to get some help on this advanced type of config.
Thanks!