如何使用 GateOne 从浏览器 SSH 登录 VPS

About GateOne

When you're using cloud hosting, you need to be able to get to your VPS (cloud server) from anywhere, but not every computer comes equipped with an SSH terminal. The information in this tutorial will help you install GateOne, an HTML5 terminal emulator that will allow you to log into any of your DigitalOcean cloud servers from any device that has a web browser, including tablets and smartphones.

GateOne is not hard to install; if you follow these steps, you'll be up and running in no time. These instructions assume your VPS is running Ubuntu or a Debian based Linux distro, if you're running CentOS or another distro, you'll have to modify the instructions to match your package manager accordingly.

Install GateOne

To start, log into your VPS using whichever SSH client you're using. Then download the python source files for GateOne from its Github repo:

curl -L http://github.com/liftoff/GateOne/archive/master.tar.gz > ~/gateone.tar.gz

Once the download is finished, you'll need to extract your new files somewhere:

tar xvzf ~/gateone.tar.gz -C ~

GateOne's backend is written in Python. So to get it working, you'll need to install a few Python libraries that GateOne relies on. Make sure you have Python's pip utility and other Python dependencies installed first:

sudo apt-get install python-pip debhelper python-support

Now, use pip to install the required extra packages:

sudo pip install tornado stdeb

Use GateOne's setup script to create a .deb package for GateOne:

cd ~/GateOne-master
sudo python setup.py --command-packages=stdeb.command bdist_deb

Now, install the .deb package:

cd deb_dist
sudo dpkg -i gateone*.deb

Run it once so that it initiate it's config files:

cd /opt/gateone

And start the server for the first time:

sudo python gateone.py

You will see some messages flash by, wait untill you see something like:

Listening on https://*:443/

Then hit Ctrl-C to exit the server.

GateOne will by default run on port 443 (https), and will allow access only from the hostnames that it autodetects, so make sure that whatever URL you normally access, this server through is listed in GateOne's origin list:

cd /opt/gateone/settings     #GateOne's default install dir
nano 10server.conf

Find the line that starts with "origins", it should look like this (yours may have a few extra entries):

"origins": ["localhost", "127.0.0.1"],

After ths, add the URL you want to use to access the site. For example, if you want to be able to login to your VPS by going to https://www.yourdomain.com, then change the origins list to include www.yourdomain.com:

"origins": ["localhost", "127.0.0.1","www.yourdomain.com"],

Now run:

cd /opt/gateone
sudo python gateone.py

The server should start and you should be able to access it by going to https://www.YOURDOMAIN.com in your browser. (Make sure to type 'https', not 'http').

Your browser may prompt you with a scary looking red screen saying something along the lines of, "The identity of this website has not been verified." Don't worry about it, that's perfectly normal. It's because the SSL certificate that GateOne generated for you isn't signed by any signing authority. If you have a signed SSL certificate, you can edit GateOne's config to use that, but that's outside the scope of this tutorial. In the meantime, just rest assured that your connection is still fully encrypted despite your browser's warning.

If you're able to get in and log into your VPS, then let's set GateOne to start whenever the server starts:

 sudo update-rc.d gateone defaults

then, do:

service gateone restart

To close any copies of GateOne you may have started, manually restart it using your server's init scripts.

Make sure the service is up and running and you're done. Enjoy the fully secured SSH access to your cloud server from anywhere with a web browser!

Submitted by: Nik van der Ploeg
Published At
Categories with 技术
comments powered by Disqus