GateOne简介
Gate One is a web-based Terminal Emulator and SSH client that brings the power of the command line to the web. It requires no browser plugins and is built on top of a powerful plugin system that allows every aspect of its appearance and functionality to be customized.
本文使用Docker安装配置GateOne,搭建一个Web Shell环境。
前置条件是安装配置好了docker环境,安装方法参考《Docker入门》。已知docker宿主机IP为192.168.56.130。
安装GateOne
1、登录dockerhub查看需要的liftoff/gateone版本,实际上只有一个版本。
2、下载gateone镜像docker pull liftoff/gateone
3、启动gateone服务
1 | docker run --name=vk-gateone -d \ |
以上命令:命名容器为vk-gateone,后台运行;映射宿主机8000端口到容器8000端口。
更多命令参考Using this Image。
4、验证安装docker ps
gateone启动正常的话就可以看到vk-gateone容器。
如果启动失败,可以使用docker logs vk-gateone
查看失败原因并进行解决。
使用nc命令验证:
1 | yum install nc |
浏览器访问: https://192.168.56.130:8000
5、使用
点击 Terminal:SSH ,输入主机IP、端口号、用户名和密码,即可登录主机。
如果想要添加鉴权验证,参考archlinux-Gateone和API Authentication。
开放端口
如果浏览器无法访问8000端口,那么需要对防火墙进行设置。
1 | firewall-cmd --add-port=8000/tcp --permanent |
安装openssh-server
1、进入vk-gateonedocker exec -it vk-gateone /bin/bash
2、安装openssh-server
1 | apt update |
3、vim /etc/ssh/sshd_config
,如下修改:
1 | PasswordAuthentication yes |
4、重启sshservice ssh restart
5、添加用户
1 | useradd -m voidking -s /bin/bash |
6、登录vk-gateone容器
点击 Terminal:SSH ,主机名和端口使用默认,输入用户名voidking和密码,即可登录vk-gateone。
小技巧
在gateone shell里,可以使用 ctrl+insert 进行复制,使用 shift+insert 进行粘贴。
如果在界面无法使用鼠标光标选中一些区域,那么可以在任意位置进行双击,即可激活光标选择。