SSH with PuTTY through a proxySSH with PuTTY through a proxy

December 18, 2009
Tags: , ,

For security reasons, I had to set all my server’s firewalls to accept connections on the SSH port (22) only from my office IP. I would have added my home IP addres in the access list, if it would have been static. But at home I have a dynamic IP so I can’t use IP-based access control in this case. So the only thing I could do to admin my servers from home was to connect first to the office and then to connect, from there, on the server that had to be administered.

Today I set up a new way to connect to my servers from anywhere. I installed a proxy on the office server, and configured PuTTY to use it for the connections to the secured servers. The following are the steps to configure a Linux server (Ubuntu in my case) and PuTTY to make a SSH connection through a proxy:

1. Install mod_proxy and mod_proxy_connect for Apache, and enable them. In Ubuntu (mine is 8.04), these modules are already installed and all you need to do is to enable them:

# a2enmod proxy
# a2enmod proxy_connect

2. Configure the proxy by editing the “proxy.conf” file:

<IfModule mod_proxy.c>

    ProxyRequests On
    AllowCONNECT 22

    <Proxy *>
        AddDefaultCharset off
        Order deny,allow
        Allow from all
        AuthType Basic
        AuthName "SSH Proxy"
        AuthUserFile /path/to/password/file
        Require user myusername
    </Proxy>
    ProxyVia Block
</IfModule>

3. Restart Apache
4. Configure PuTTY to use the proxy for the corresponding connections. For this, in the left tree, the “Proxy” submenu in the “Connection” menu must be used. There, select “HTTP” as Proxy type, then enter the hostname of your newly configured proxy, the username and password.

putty_proxyNow you should have a functioning proxied SSH connection! Cool!

Be Sociable, Share!

One Response to “SSH with PuTTY through a proxy”

  1. I configured my ssh-proxy (apache under fedora 22) and my putty-session (putty under win10) exactly the same, can connect and login but after about 15sec putty drops the established connection (network-error, software caused connection abort). Any hints, thanxInAdvance murlo

Leave a Reply




*