SOCKS proxy server with SSH

SSH protocol and openssh are full of features. It is not just remote terminal program.

You probably know about static port forwarding, local and remote. It allows to map local port to any host via SSH gateway or map incoming port on SSH gateway to local one. It is very useful in some situations. But what is dynamic port forwarding ?

Dynamic port forwarding allows you to initiate connections on Behalf-Of SSH gateway, using any port.

This is done through emulating SOCKS proxy server on local side. See the picture:

ssh_socks

SSH client(putty) opens local port and starts SOCKS proxy server on it.

Putty configuarion

ssh_socks3

After every application that supports socks proxy can use it. Just configure your browser to use local SOCKS proxy and voila.

ssh_socks2

Possible usages:

  • Access to intranet sites from internet via ssh gateway
  • Temporary changing of your IP to visit sites
  • Access to server localhost services like apache status

1 comment

  1. another relevant souitlon here is tsocks.this small library designed to handle SOCKS5 communication transparently for softwares can’t do so.after you estabish the socks tunnel by ssh, start tsocks:tsocks wget tsocks will translate wget’s connect() syscalls making it socks-compatible (not sure if wget be already socks-able )

Leave a Reply

Your email address will not be published.