Search code examples
ubuntusshremote-accessputtynat

PC behind NAT - need to access web based apps (using web browser)


I've got a remote headless PC that sit's behind the ISP's NAT firewall, meaning there's no public IP address.

This remote/headless PC successfully connects to reverse-ssh-tunnel and I can access it from anywhere by

ssh -p port# remoteuseid@middleip#

However, what I need is, to be able to access apps like Nagios & Webmin (that are installed on the remote/headless PC) so I can offer remote support to it. (point to note, the remote/headless PC is based on Ubuntu Server 12.04 Minimal, with no GUI)

it's not actually a web server to host web sites for the world; just acts as a server in a medical clinic for a Patient Record system which is web based. In addition to the Patient Recod system, there's things like Nagios and Webmin which are also installed for remote support and management. Now, this PC sits behind the ISP's NAT firewall. However, I've successfully configured Reverse-SSH-Tunneling and can access this PC anytme & from anywhere with the SSH terminal like Putty. Now I need to be able to log into it's Nagios & Webmin from remote locations with my web browser.

Someone suggested as follows:

you can use a SOCKS Proxy to access web apps. Look up examples of using ssh to create a Proxy - the tunneled connection works the same as any other ssh connection.

So I needed some assistance on this, pls.


Solution

  • ssh will tunnel HTTP if you want.

    Change your ssh command to

    ssh -p port# -Lsomeport#:localhost:80 remoteuseid@middleip#
    

    Then when you go to http://localhost:someport#/xxx on your local machine, your connection will be sent to the web server on the machine you are ssh'd to.