Skip to content
/ sshterm Public

SSH client written in GO, compiled to WASM, that runs entirely in web browser

License

Notifications You must be signed in to change notification settings

c2FmZQ/sshterm

Repository files navigation

SSH Term

SSH Term is an SSH client written in GO, compiled to WASM, that runs entirely in your web browser.

It uses xterm.js as terminal, and golang.org/x/crypto/ssh for the SSH client functionality.

The connection between the client and the server uses WebSocket and tlsproxy.

screenshot

Supported features:

  • Connect to any WebSocket endpoints configured in tlsproxy.
  • Connect to remote servers via jump hosts.
  • Generate SSH keys (rsa, ecdsa, ed25519).
  • Import and export SSH keys (rsa, dsa, ecdsa, ed25519).
  • Backup & restore.
  • Persist data to local storage (optional, on by default).
  • Keyboard interactive authentication.
  • Public key authentication, with or without certificates.
  • In-memory SSH agent and agent forwarding.
  • SFTP client with Streaming upload and download.
  • Accept host certificates signed by a trusted authority.

Not implemented:

  • Port forwarding.
  • Security keys.

How to install

Check out the repo and build everything yourself:

git clone https://github.com/c2FmZQ/sshterm.git
cd sshterm
./build.sh

If all goes well, all the needed files will be in the docroot directory.

$ ls docroot/
config.json.example  index.html  LICENSE.xterm.txt  ssh.js  ssh.png  ssh.wasm  ssh.webmanifest  stream-helper.js  tests.html  tests.wasm  wasm_exec.js  xterm.css  xterm.js

Download a release package

Check out the release page. The sshterm-docroot-${VERSION}.tar.gz files contain everything ready to go.

Configure tlsproxy

The simplest tlsproxy config looks like this:

backends:
  - serverNames:
      - ssh.EXAMPLE.COM
    mode: local
    documentRoot: /path/to/docroot/

webSockets:
  - endpoint: wss://ssh.EXAMPLE.COM/myserver
    address: 192.168.0.100:22

Open the app

Open https://ssh.EXAMPLE.COM/ in a browser. It should open a terminal.

The first time you connect, the server endpoint must be configured when the ep command:

ep add myserver wss://ssh.EXAMPLE.COM/myserver

(Alternatively, create a config.json file and set the endpoint there)

Then, you can SSH to your server with:

ssh username@myserver

⚠️ Replace ssh.EXAMPLE.COM, myserver, /path/to/docroot/, ... with something appropriate for your environment.

Run tests

To run the tests in a headless browser, use:

./tests/run-headless-tests.sh

To run the tests and watch the output, start the test server:

./tests/run-test-server.sh

and then open http://<hostname>:8880/tests.html in your favorite browser.