Monday, April 7, 2008

Using SSH and SOCKS to access the web [via Firefox] from remote computer

Source(s)
Information provided in this post was originally located here:
Description
Occasionally, it is necessary to "web surf from afar". Less about security than about originating IPs, I found a need to create a secure connection so I may web surf as if I were on a different computer.
Use Case 1: Some corporations do not want access to popular or potentially harmful web sites.

Use Case 2: Some websites do not service users from some IP ranges, i.e. from out of the country of hosting.

Setup
SSH Tunnel
In this solution, will will use an encrypted connection between the local computer and a remote computer that you have access and is running and ssh daemon. This solution will create a local computer port that will allow anything sent to this port to be transported to the remote computer and on to it's destination as if it had originated from the remote computer.

On the local computer:
ssh -N -C -D 9999 USER_NAME@IP_ADDRESS

  • -N : do not open an interactive console on the remote computer [optional]
  • -C : use compression [optional]
  • -D : use SOCKS 5 [required]
  • 9999 : local computer port to uses to access the SOCKS proxy [a port # is required, not necessarily 9999]
  • USER_NAME@IP_ADDRESS : the user name and remote computer information [require most likely]
Note: This connection will persist until the computer is rebooted or you find and kill the associated ssh task in the process list. That being said, be careful not to start more than one ssh tunnel to the same computer.

FireFox Proxy
  1. Use menus Tools | Options
  2. Click on Advanced icon
  3. Select Network tab
  4. Press Settings button
  5. Select Manual Proxy Configuration radio button
  6. Enter localhost and port 9999 on the SOCKS Host and Port.
  7. Press Apply/OK until all extra dialog boxes are closed.
  8. You are now ready to web surf though the remote computer.
Note: I recommend using a proxy switcher extension so you can enable and disable the use of the proxy without needing to go though the menus and dialogs, as shown above. Here is one for example.

No comments: