Web-based SSH

Web-based SSH makes it possible to access Secure Shell (SSH) servers through standard web browsers. Respective clients are typically based on JavaScript/Ajax or JavaScript/WebSockets, and, if they work together with an Ajax/WebSocket-to-SSH proxy, can be used to access SSH servers from behind a firewall or proxy that allows HTTP traffic but does not allow SSH traffic.

Technology

Web-based SSH clients basically consist of the following parts:

Client-side terminal emulation

Web-based SSH servers that utilize client-side terminal emulation typically transmit the raw terminal output from the SSH server directly to the client. This has the advantage of offloading the process of translating terminal output into HTML on to the client. The disadvantage of this method is that it is limited by the capabilities of JavaScript and it will use up a non-trivial amount of the client's CPU and memory to process the incoming character stream. It also relies on the client to keep track of the terminal state and respond to escape sequences.

Client-side terminal emulator example: vt100.js (from Shell in a Box)

Server-side terminal emulation

Web-based SSH servers that utilize server-side terminal emulation typically keep track of the terminal screen and state in memory and convert it to HTML either when a screen update occurs or when the client expressly requests an update. The advantage of this method is that the state of the terminal remains persistent even if the user connects to their existing session(s) from a different web browser. It also enables the server to act upon terminal output even if the user is disconnected.[1] The disadvantage of this method is that it uses up more CPU and memory on the server.

Server-side terminal emulator example: terminal.py (From Gate One).

Advantages

The main advantages of web-based SSH can be summarized as follows:

Important issues

The following issues have to be considered and are important when using a web-based SSH client:

Open source examples

Google's Secure Shell extension for Chrome and Chromium pairs the JavaScript hterm terminal emulator with OpenSSH client code running on Native Client.[3] The Secure Shell extension does not itself work with non-Google HTTP-to-SSH proxies, but provides proxy hooks, and the third-party application nassh-relay[4] can use those hooks to enable the Secure Shell extension to establish an SSH connection over XMLHttpRequest or WebSocket transport.

shellinabox operates as a stand-alone service or in conjunction with nginx to provide HTTPS access to a login shell, and is packaged for Debian and RedHat -derived Linux distributions.

Alternative

The above however might lead to frustrating sessions because of intermittent network connections thereby effecting a connection timeout.[5] The tool Mosh by MIT could be better[6] in most other situations, however, it instead utilizes SSH at first then UDP from thereon.[7]

References

  1. The expect function from Gate One's termio.py module can act upon terminal output even if the user is disconnected.
  2. jcterm claims to be able to handle port forwarding, such as X11 forwarding
  3. Chromium Secure Shell FAQ
  4. nassh-relay GitHub repository
  5. Is there a software package that safely allows SSH via web on simple web host?
  6. mosh is an SSH replacement that works around connectivity and lag issues
  7. Mosh: An Interactive Remote Shell for Mobile Clients
This article is issued from Wikipedia - version of the Saturday, May 07, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.