Squid Logo

I recently found myself in a situation where I needed to access the public Internet from a instance that was not directly connected to the public Internet. The solution was to setup a SSH reverse tunnel to a local Squid proxy server and configure the instance to use the local proxy.

This is a guide to setting up a SSH reverse tunnel to a local Squid proxy server.

Prerequisites

  • A local Squid proxy server, can be installed on macOS using Homebrew (brew install squid)
  • A SSH client
  • The instance where Internet access is needed

Setup

  1. Start the Squid proxy server on the local machine
squid
  1. Setup the SSH reverse tunnel from the local machine to the instance
ssh -R 3128:localhost:3128 user@host
  1. Configure the instance to use the local proxy
export http_proxy=http://localhost:3128
export https_proxy=http://localhost:3128
  1. Verify the connection
curl addr.se

Notes

Both APT and Wget will respect the http(s)_proxy environment variables.

Leave a Reply

Your email address will not be published. Required fields are marked *