Publish an SSH remote terminal webconsole based on the Go language

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Based on Golang, WebSocket, termjs SSH remote terminal, hope to help everyone.

The main application to the isolated network, SSH remote terminal access issues.

Git@osc:http://git.oschina.net/shibingli/webconsole
Github:https://github.com/shibingli/webconsole

( this is actually a go language practiced hand project )

Update log



2016.03.04 released v1.1


New:
1, increase the command line start, stop, State view function. such as:./apibox start/stop/status


2016.03.03


Repair Certificate:
1. When modifying the standalone mode, login JS verification problem.


New:
1, increase the background operation mode (Conf/conf.json. Daemon:true/false);
2. Increase the PID file (log/apibox.pid) when the program is running;


The approximate data flow:


Browser--"websocket--" ssh--"Linux OS


Git@osc:http://git.oschina.net/shibingli/webconsole
Github:https://github.com/shibingli/webconsole




Package Structure:
├──bin
│└──apibox
├──conf
│├──SSL_CERT.CRT (default does not exist)
│├──ssl_cert.key (default does not exist)
│├──conf.json
│└──mime.types
├──log
├──pkg
├──static
│├──images
│└──scripts
└──template


Operating Environment Requirements:


1. Intel Architecture
2. Linux Kernel 3.x/x86_64 and later
3. Recommended Linux distribution CentOS 7.x
4. When enabling SSL/TLS mode access, you need to generate the corresponding SSL certificate file and place it under the "Conf" folder and configure the "Conf.json" file
5. Clients require browser access using IE9, Chrome 40, Firefox 38, Safari 9 or later
6, the server side needs to open the corresponding external access port to the firewall. For specific ports, please refer to the configuration of the port section in the "Conf.json" file under the "Conf" folder
7, this program can only operate on Linux class operating system and the OS supporting SSH protocol remote operation
8, based on Go1.6, native support HTTP2




First, the deployment
1, unzip the program to any directory, run the "Bin" folder under the "Apibox" file can be. such as: "./apibox start/stop"
2, the configuration file under the "Conf" folder, the core configuration file is "Conf.json"
3. Background run You can configure the "Conf.json" file under the "Conf" folder to configure the "daemon" key to "true"
4, the runtime log files are stored in the "Log" folder, the date of the day named
5, you can also configure the program to the Nginx fcgi mode operation, Nginx as access to the portal




Second, use
1, the program deployment is complete, directly through the browser access. Example: http (s)://ip:port.


2. External System Reference steps:

1), by Get or POST, submit "vm_addr" parameter to "HTTP (s)://ip:port/console/chksshdaddr", after successful can obtain the encrypted "en_addr" information. Note: The VM_ADDR format is: "Ip:port", if the port is not carried, the default port is "22".


The results obtained are in JSON format (note: The following data are test data):


Success:
{
"OK": true,
"MSG": "",
"Data": {"en_addr": "0b-ndgcazqktmuw4oblfxott", "sshd_addr": "192.168.220.173:22"}
}


Failed:
{"OK": false, "MSG": "Unable to resolve host address.", "Data": null}


2), after successfully obtaining the encrypted EN_ADDR information, the "HTTP (s)://ip:port/console/login/' en_addr '" can be accessed by a GET or POST method. Note: "En_addr" is the data obtained through the 1th step operation.


JQuery Demo:


$.post ("/console/chksshdaddr?rnd=" + math.random (), {
"Vm_addr": "192.168.220.177:22"
}, function (data) {
var json = data;
if (typeof (data)! = "Object") {
JSON = $.parsejson (data);
}
if (Json.ok) {
alert (JSON.DATA.EN_ADDR);
}
});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.