Welcome

Welcome to my external memory and information on what I'm currently working on. Here you will find snippets of code, tricks and solutions I, or maybe you, may need to reference.

Feel free to comment your suggestions and any constructive criticisms that you may have.

Wednesday, 19 February 2014

Running an SSH tunnel using PUTTY

Why would you want to do this?

For many reasons. Mostly I do this when I need to appear to be a server in order to test a web service, network connection, or some other resource where access is restricted to a set of IP Addresses. This will let me use tools such as SoapUI and Firefox to debug/test things.

What is Putty

It's a cross platform SSH client that saves sessions and makes using SSH just a little easier and more convent. SSH can easily be done from a shell but the convince of having pre-defined sessions with things like tunnelling all ready configured makes Putty win out in my books. 

The basic usage of putty itself is outside the scope of this article but below are links as to where it can be obtained and a documentation:

What To Do

  1. Start up Putty
  2. Fill out your session details
  3. Go to Connection -> SSH -> Tunnels
  4. Set up your tunnel configuration (See image below)
    1. Enter your source port number (This is the port local clients will connect to)
    2. Select Dynamic
    3. Click Add
  5. Go back to Session and save your session
  6. Click Open
Putty Tunnel Configuration
Putty Tunnel Configuration

Connecting To Your Proxy

Each program is different but here are my two most common methods/use cases:

Firefox

  1. Edit -> Preferences -> Advanced -> Settings
  2. Select Manual proxy configuration
    1. Set HTTP Proxy to 127.0.0.1 and Port to 1080 (or what ever port your defined)
    2. Ensure SOCKS v5 is selected
    3. Click OK

Java Applicaitons

Run the Java application with the following java options set:
Dhttp.proxyHost=127.0.0.1 Dhttp.proxyPort=8010
For example executing the application via command line may look like:
java -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8010 -jar myApplication.jar

No comments :

Post a Comment