安装
准备环境:
centos7
[root@test ~]# python -V
Python 2.7.5
[root@test ~]# python -c "import tornado; print(tornado.version)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named tornado
先安装pip
[root@localhost ~]# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1604k 100 1604k 0 0 403k 0 0:00:03 0:00:03 --:--:-- 403k
[root@localhost ~]# ls
0817_2.pcap anaconda-ks.cfg index.html index.html.11 index.html.14 index.html.3 index.html.6 index.html.9
0911_4.pcap get-pip.py index.html.1 index.html.12 index.html.15 index.html.4 index.html.7 login_mysql.py
1.pcap go index.html.10 index.html.13 index.html.2 index.html.5 index.html.8
[root@localhost ~]#
[root@localhost ~]# python get-pip.py
Collecting pip
Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 328kB/s
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl (569kB)
100% |████████████████████████████████| 573kB 655kB/s
Collecting wheel
Downloading https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl (41kB)
100% |████████████████████████████████| 51kB 15.4MB/s
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-18.0 setuptools-40.4.3 wheel-0.31.1
安装tornado
[root@test ~]# pip install tornado==2.4
Collecting tornado==2.4
Downloading https://files.pythonhosted.org/packages/2d/9a/38e855094bd11cba89cd2a50a54c31019ef4a45785fe12be6aa9a7c633de/tornado-2.4.tar.gz (347kB)
100% |████████████████████████████████| 348kB 199kB/s
Building wheels for collected packages: tornado
Running setup.py bdist_wheel for tornado ... done
Stored in directory: /root/.cache/pip/wheels/7d/4b/4f/f8379855fe34e5654e5c82b9f8ce88a5ffe02644a39222fc9f
Successfully built tornado
Installing collected packages: tornado
Successfully installed tornado-2.4
[root@test ~]#
安装pillow,支持图片显示
pip install Pillow
开始安装gateone
https://github.com/liftoff/GateOne/downloads
可以支持多种安装方式,源码和包
RPM-based Linux Distributions
user@redhat:~ $ sudo rpm -Uvh gateone*.rpm
Debian-based Linux Distributions
user@ubuntu:~ $ sudo dpkg -i gateone*.deb
From Source
user@whatever:~ $ tar zxvf gateone*.tar.gz; cd gateone*; sudo python setup.py install
上传gateone的源码文件到部署环境:
[root@localhost ~]# rz
rz waiting to receive.
[root@localhost ~]# ls
0817_2.pcap gateone-1.1.tar.gz index.html.1 index.html.13 index.html.3 index.html.7
0911_4.pcap get-pip.py index.html.10 index.html.14 index.html.4 index.html.8
1.pcap go index.html.11 index.html.15 index.html.5 index.html.9
anaconda-ks.cfg index.html index.html.12 index.html.2 index.html.6 login_mysql.py
[root@localhost ~]#
[root@localhost ~]# tar xvf gateone-1.1.tar.gz
................
[root@localhost ~]# cd GateOne/
[root@localhost GateOne]#
[root@localhost GateOne]#
[root@localhost GateOne]#
[root@localhost GateOne]# python setup.py install
Gate One will be installed in /opt
running install
running build
running install_data
creating /opt/gateonegateone安装在/opt/gateone
[root@localhost GateOne]# cd /opt/gateone/
[root@localhost gateone]# ls
authpam.py docs LICENSE.txt README.rst static termio.py
auth.py gateone.py logviewer.py remote_syslog.py templates tests
babel_gateone.cfg i18n plugins sso.py terminal.py utils.py
必须运行./gateone.py,才能生成配置文件
ctrl+z退出gateone,配置文件server.conf 生成
[root@localhost gateone]# ls
authpam.py babel_gateone.cfg gateone.pyc logs README.rst sso.pyc terminal.pyc users
authpam.pyc certificate.pem i18n logviewer.py remote_syslog.py static termio.py utils.py
auth.py docs keyfile.pem logviewer.pyc server.conf templates termio.pyc utils.pyc
auth.pyc gateone.py LICENSE.txt plugins sso.py terminal.py tests
vim server.conf
加入web访问的地址(包括部署gateone的机器地址)
还需要在上面配置文件中加入:
session_timeout = "20m"
如果不加入会一直在刷新刷新的,无法操作。
开启防火墙
[root@localhost ~]# iptables -I INPUT -p tcp --dport 443 -j ACCEPT
再次启动gateone,web访问的ip已经存在可以访问了
[root@localhost gateone]# ./gateone.py
[W 180924 00:58:12 gateone:2893] dtach command not found. dtach support has been disabled.
[I 180924 00:58:12 gateone:2917] Connections to this server will be allowed from the following origins: 'http://localhost https://localhost http://127.0.0.1 https://127.0.0.1 https://localhost https://localhost.localdomain https://localhost4 https://localhost4.localdomain4 https://localhost.localdomain https://localhost6 https://localhost6.localdomain6 https://127.0.0.1 https://127.0.0.1 https://23.252.165.195 '
[I 180924 00:58:12 gateone:2307] No authentication method configured. All users will be ANONYMOUS
[I 180924 00:58:12 gateone:2404] Loaded plugins: bookmarks, convenience, example, help, logging, logging_plugin, mobile, notice, playback, ssh
[I 180924 00:58:12 gateone:3054] Listening on https://*:443/
[I 180924 00:58:12 gateone:3060] Process running with pid 18967
设置开机启动服务
如果必须要设置开机启动默认后台运行,我们可以在需要运行的时候执行。
cd /opt/gateone
./gateone.py
这样在地址栏中输入https://服务器IP地址:自定义端口就可以去访问。那如果我们需要设定自动后台运行。
/sbin/chkconfig gateone on
systemctl start gateone
GateOne webshell演示看看,通过web连接gateone,再通过gateone登陆目的主机103.197.70.16
嵌入到外部应用中:
参考:
http://liftoff.github.io/GateOne/About/prerequisites.html