When You Wish You Had VPN


On a machine on the internal network

$ ssh -A server.internal

On server.internal

$ ssh -A -R 6662:localhost:22 public.server

On external.machine

$ ssh -A -L 7780:localhost:7780 public.server

On public.server

$ ssh -p 6662 -L 7780:localhost:7780 user-on-server-internal@localhost

On server.internal

Install a simple HTTP proxy:

$ mkdir http-proxy
$ cd http-proxy
$ wget https://raw.githubusercontent.com/abhinavsingh/proxy.py/develop/proxy.py
$ python proxy.py --port 7780

On external.machine

To test that the two tunnels and HTTP proxy are working, do:

$ export http_proxy=localhost:7780
$ wget -O - http://internal.web.site

You can now set your browser up to access the internet through an HTTP proxy located at localhost:7780 and it'll be just like you were on the internal network.


Licensed under CC BY Creative Commons License ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@emacs.ch ~ 🐦 @torsteinkrause