Routing Web Traffic over SSH using SOCKS Proxy

I recently only had SSH Access into an Environment which had a Web Based GUI I needed to access.  I used SOCKS as a Proxy (Built into OpenSSH) to access the UI by performing the following on my Mac:

As I had SSH Access i used the following command

  • ssh -D 443 username@domain.com

In my instance I had a few more parameters set which i cant share but i will show available options below.

I used Port 443 – this could be changed as necessary

  • I opened up Firefox and Selected Preferences

screen-shot-2016-11-03-at-12-29-56

  • Select Advanced
  • Select Network and Settings

screen-shot-2016-11-03-at-12-30-38

  • Click on Manual Proxy Configuration

screen-shot-2016-11-03-at-12-30-46

  • Under SOCKS Host enter localhost and enter the Port number you connected over
  • Now you should be able to access the UI via Firefox

Arguments for the SSH Connection:

  • -D    – Defines Port number for the SOCKS Tunnel (you can choose a number between 1025-65536)
  • -f    – Requests ssh to go to background just before command execution
  • -C   – Requests compression of all data
  • -l    – provide Login name
  • -q    – Uses quiet mode
  • -N    – Do not execute a remote command. This is useful for just forwarding ports.

 

Thanks to this article for this setup

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s