背景

ssh终端其实是有很多的,用起来也很方便,但是,一些场合下,企业防火墙会阻拦ssh数据流,从而造成ssh终端不可用。解决的办法就是通过html协议来运行ssh,只要不禁止网页访问,就可以ssh连接主机,适应性更广。

现有方案

  • WebSSH2:功能适中,js实现的,界面比较漂亮,但运行的速度有点慢,且不支持https,目前github更新速度正常,未来潜力股。
  • Gate One:16年以前最好的解决方案,python实现的,运行速度挺快的,但界面不够美观,复制/粘贴存在小bug,17年后不更新了(有可能是因为装的1.1版本,2012年发布的,有些老,guthub最新的版本安装报错,按理复制/粘贴不会有问题的才对),运行时间一长会有大量的僵尸进程。
  • shellinabox
  • wssh

GateOne安装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# python环境
apt-get install python python-pip python-imaging
pip install pyopenssl ordereddict tornado==2.4.1
# 下载
wget https://github.com/downloads/liftoff/GateOne/gateone-1.1.tar.gz
tar -xzvf gateone-1.1.tar.gz
cd gateone-1.1
# 安装
python setup.py install 
# 启动服务
service gateone start

修改/opt/gateone下面的server.conf里面的origins字段,添加自己的IP地址及域名,然后访问该域名就可以了。

WebSSH2

1
2
3
4
5
6
7
8
9
# nodejs环境
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
apt-get install -y nodejs
# 下载
git clone https://github.com/billchurch/WebSSH2
cd WebSSH2
npm install --production
#启动
npm start

访问http://服务器IP:2222/ssh/host/待连接ssh服务器ip即可