It’s pretty easy to forget to add a firewall rule that allows people to access a resource such as an internal staging server from outside your network. To make sure the server is available I needed my requests to come from outside the internal work network but I wanted to be able to do this right now, using the computer that’s inside the network.

Turns out that’s pretty easy using a tool that pretty much every developer should have installed - SSH.

There are just three steps to getting this setup and working.

  1. Run a server somewhere that you can access using SSH. EC2 is ideal for this sort of thing.

  2. Open an SSH connection to it, telling it to act as a proxy (the -D flag does this, the other flags are for compression and similar goodies):

    ssh -C2qTnN -D 8080 your-server-name-here.com

  3. Configure your browser to use a SOCKS proxy. It’s running on localhost on port 8080.

Once you’ve done that, hit up whatismyip.com and you should see the public IP address of the server you’re connecting shown on the site.

written by
Craig
published
2011-08-17
Disagree? Found a typo? Got a question?
If you'd like to have a conversation about this post, email craig@barkingiguana.com. I don't bite.
You can verify that I've written this post by following the verification instructions:
curl -LO http://barkingiguana.com/2011/08/17/a-simple-socks-proxy-using-ssh.md.orig
curl -LO http://barkingiguana.com/2011/08/17/a-simple-socks-proxy-using-ssh.md.orig.asc
gpg --verify a-simple-socks-proxy-using-ssh.md.orig{.asc,}