*this
home about contact feed
projects
vagra vaBlo
categories
C++(7) Solaris(4) tntnet(3) vi(3) Linux(2) DeleGate(2) Postgres(2) proxy(2) cxxtools(1) regex(1) readline(1) dtrace(1) gcc(1) MeeGo(1) ssh(1) firefox(1)

Using DeleGate as HTTP proxy via SSH on remote hosts

http proxy with ssh

If you work on a remote host which is behind a firwall that doesn't allow outgoing HTTP, installing software can become cumbersome, especially for tools like Rubys gem or Perls CPAN. Fortunately, the most tools support using a proxy configuration from environment variables and you can tunnel almost everything thru SSH.

If you can reach a remote host via ssh, you can use ssh -D, however, that does work only one way. Of course, you'll come up with a solution to reverse the order by einther forwarding port 22 or make your socks proxy using ssh -D port localhost. This however solves the problem only partially, since there is no widely available support for taking a socks proxy from the environment and you don't want to mess with teaching all the package managers what command line arguments they need to pass.

A much easier solution is to use delegate as proxy. You just run a local http proxy and forward it's port via SSH:

local$ delegated -P127.0.0.1:8080 SERVER=http
local$ ssh -R8080:127.0.0.1:8080 user@remote
remote$ http_proxy=http://127.0.0.1:8080
remote$ export http_proxy

And you're done, you can test with curl or wget, but CPAN and gem install will also work.

remote$ curl http://www.example.com/
Write comment