阅读 67

SSH through HTTP proxy

SSH through HTTP proxy

Zeitoun.net

SSH through HTTP proxy

This article explains how to connect to a ssh server located on the internet from a local network protected by a firewall through a HTTPproxy.

Requirement are :

  • Your firewall has to allow HTTPconnections through a proxy

  • You need to have root access to the server where ssh is listening

Configure the ssh server

The ssh daemon need to listen on 443 port. To accomplish this, just edit this file (on debian system) /etc/ssh/sshd_config and add this line :

Port 443

Then restart the daemon :

sudo /etc/init.d/ssh restart

Configure the client

I suppose you are on a Linux system (debian for example). First you have to compile the connect binary which will help your ssh client to use proxies (HTTPS in our case). Then you have to configure your ssh client to tell him to use HTTPproxy when he tries to connect to your ssh server.

  1. Install the connect software :

    • On debian system, just install the connect-proxy package :

      sudo apt-get install connect-proxy
    • On other Linux systems, you have to compile it :

      cd /tmp/
      wget http://www.meadowy.org/~gotoh/ssh/connect.cgcc connect.c -o connect
      sudo cp connect /usr/local/bin/ ; chmod +x /usr/local/bin/connect
  2. Configure your ssh client. Open or create your ~/.ssh/config file and add these lines :

    ## Outside of the firewall, with HTTPS proxyHost my-ssh-server-host.net  ProxyCommand connect -H proxy.free.fr:3128 %h 443
    ## Inside the firewall (do not use proxy)
    Host *   ProxyCommand connect %h %p
  3. Then pray and test the connection :

    ssh my-ssh-server-host.net

SSH to another server through the tunnel

For example to connect to in ssh github.com :

Host github.com  ProxyCommand=ssh my-ssh-server-host.net "/bin/nc -w1 %h %p"


文章分类
代码人生
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐