Skip to content

Instantly share code, notes, and snippets.

@leviwilson
Last active March 3, 2021 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leviwilson/f477f752faa15849710b20f974fd0615 to your computer and use it in GitHub Desktop.
Save leviwilson/f477f752faa15849710b20f974fd0615 to your computer and use it in GitHub Desktop.

Poor Man's VPN

Create an AWS EC2 Linux Instance

  1. Sign into your AWS account console
  2. Choose an availability zone not in your area (like Oregon or something)
  3. Launch a new instance (just choose an Ubuntu instance). A t2.micro should be fine for this.
  4. You may have to create a new key pair if you haven't already. Name it and the download the file. Do not lose this as this <whatever>.pem file is what you'll use to access the instance.

SSH Tunnel Into It

Now that you have an EC2 instance running in some other area of the country, you will want to SSH tunnel into it so you can redirect your web traffic through it.

Find the public DNS entry for the instance you just launched (in the EC2 console) and then run this command:

$ ssh -i leviwilson.pem ubuntu@ec2-34-214-100-78.us-west-2.compute.amazonaws.com -D 7777

If you do not have the correct permissions on your pem file that you created earlier, you'll need to:

chmod 0400 <path your file>.pem

Proxy Through the Tunnel

Now that you have an SSH tunnel setup on port 7777 of your local machine, you'll want to send traffic through it.

  1. Open up a browser like Firefox and open the settings.
  2. Choose "Advanced" and go to the network tab
  3. Click "Settings" under the "Connection" section to configure the proxy
  4. Choose "Manual proxy configuration" and under the "SOCKS Host" put localhost and then the port 7777 and choose "OK"

And voila! Now all of your Firefox traffic will be going through your SSH tunnel and look like it's coming from Oregon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment