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.


~ /home 🏠 ~ talks 💬 ~ bash ~ craftsmanship ~ db ~ dongxi ~ emacs ~ escenic ~ iam ~ java ~ js ~ language ~ latex ~ ldap ~ life ~ linux ~ llm ~ mac-os-x ~ mt-foo ~ network ~ norsk ~ python ~ quotes ~ running ~ security ~ travel ~ unix ~ various ~ vcs ~ webdesign ~ windows ~ discoveries ~ cv 🧙 ~

Licensed under CC BY Creative Commons License ~ 📡 RSS feed ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert