SSH through HTTP proxy

SSH through HTTP proxy

 

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 HTTPS proxy.

Requirement are :

  • Your firewall has to allow HTTPS conne ctions through a proxy
  • You need to have root a c cess 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 HTTPS proxy when he tries to connect to your ssh server.

  1. Install the connect software :
    • On debian system, just install the connect-proxy pa ckage :
      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.c
      gcc 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 proxy
    Host 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 conne ction :
    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"
posted on 2012-07-18 09:51  lexus 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/lexus/archive/2012/07/18/2596855.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值