web界面的ssh工具

之前搞得是guacamole,这个可以web界面管理RDP VNC SSH协议,非常好用,但是过程相对复杂,我用的是这个,但是我不推荐你们用。

技术可以的话可以试一下搭建。

下面就讲一下

Ubuntu安装配置网页版SSH神器:GateOne

这个相对非常的简单,但是只能用ssh协议,对于一个运维人员来讲来说,这个挺好用的。

虽然说有不少方便实用的SSH客户端,比如Windows下的Putty、Xshell,安卓上的JuiceSSH,但有时候我想在其他电脑上使用SSH又不想下载安装这些软件时就想要一个网页版的SSH工具。今天终于想到这件事,搜了一下发现还真有,就是这个GateOne,不过这个需要用到Python,下面就说说我安装配置的过程。

首先建议更源为阿里源。

root@ubuntu:~/GateOne# vim /etc/apt/source.list    打开这个文件,直接将以下的源复制进去,原来的删除掉。

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted

deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties

deb http://mirrors.aliyun.com/ubuntu/ xenial universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties

deb http://archive.canonical.com/ubuntu xenial partner

deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties

deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

保存后:

更新:

1
sudo apt- get  update


一、环境配置

我的系统是Ubuntu16.04,首先要安装Python,Python2或者3都可以。其次就要安装一些依赖文件:

apt-get install python python-pip python-imaging
pip install pyopenssl ordereddict tornado==2.4.1

等待安装完成即可。如果缺少一些依赖文件,GateOne在运行时会提示错误的,亲测

二、下载安装GateOne

GateOne项目的源码在GateOne,下载地址:gateone-1.1.tar.gz,具体的命令:

wget https://github.com/downloads/liftoff/GateOne/gateone-1.1.tar.gz
tar -xzvf gateone-1.1.tar.gz
cd gateone-1.1

也可以用git clone 命令来下载:

git clone https://github.com/liftoff/GateOne.git
cd GateOne

如果没有wget 或者 git 命令,先用 apt-get install git wget 来下载wget 和 git

然后就是安装了,进入到GateOne目录里,输入命令:

python setup.py install

等待完成即可。

三、配置GateOne

安装完成之后先运行一下GateOne:

gateone

或者

service gateone start

这时它会自动生成配置文件,按住 ctrl + C 或者 输入命令

service gateone stop    //如果你是用 service gateone start 启动的

停止gateone。它的配置文件一般在 /etc/gateone/conf.d/10server.conf,用一个编辑器打开它,是这样的:

如果以上的重启命令什么的出现错误,先不用理会。直接 vim  /etc/gateone/conf.d/10server.conf 打开编译这个文件,

// This is Gate One's main settings file.
{
    // "gateone" server-wide settings fall under "*"
    "*": {
        "gateone": { // These settings apply to all of Gate One
            "address": "",
            "ca_certs": null,
            "cache_dir": "/tmp/gateone_cache",
            "certificate": "certificate.pem",
            "combine_css": "",
            "combine_css_container": "#gateone",
            "combine_js": "",
            "cookie_secret": "Yjg3YmUzOGUxM2Q2NDg3YWI1MTI1YTU3MzVmZTI3YmUzZ",
            "debug": false,
            "disable_ssl": false,
            "embedded": false,
            "enable_unix_socket": false,
            "gid": "0",
            "https_redirect": false,
            "js_init": "",
            "keyfile": "keyfile.pem",
            "locale": "en_US",
            "log_file_max_size": 100000000,
            "log_file_num_backups": 10,
            "log_file_prefix": "/opt/gateone/logs/webserver.log",
            "log_to_stderr": null,
            "logging": "info",
            "origins": [
                "localhost", "127.0.0.1", "enterprise",
                "enterprise.example.com", "10.1.1.100"],
            "pid_file": "/tmp/gateone.pid",
            "port": 443,
            "session_dir": "/tmp/gateone",
            "session_timeout": "5d",
            "syslog_facility": "daemon",
            "syslog_host": null,
            "uid": "0",
            "unix_socket_path": "/tmp/gateone.sock",
            "url_prefix": "/",
            "user_dir": "/opt/gateone/users",
            "user_logs_max_age": "30d"
        }
    }
}


这里可以看看GateOne的文档,如果你不用https,就要把

"disable_ssl": false,
这一行中的false 改为 true


如果想要把它嵌入到网站之中,就把

"embedded": false,    //改为true


至于如何嵌入到网站,随后有时间了再搞,我会再更新的。

还有最重要的端口设置

"port": 443,     // 默认是443,如果不用https 就改成其他的端口


至于这个:

"origins": [
                "localhost", "127.0.0.1", "enterprise",
                "enterprise.example.com", "10.1.1.100"],


在这里面添加域名或者IP,例如上面的端口填的是111,域名添加了sunriseydy.top,就可以在浏览器中访问:sunriseydy.top:111 来使用GateOne。

相关连接:http://www.laozuo.org/10703.html

https://www.jianshu.com/p/2f66f7242788


猜你喜欢

转载自blog.51cto.com/xiaogongju/2285024