#ssh #share #terminal #collaborative

bin+lib sshx-server

A secure web-based, collaborative terminal

4 releases

0.2.2 Dec 28, 2023
0.2.1 Nov 23, 2023
0.2.0 Nov 4, 2023
0.1.0 Jun 6, 2022

#10 in #websocket-connection

Download history 28/week @ 2023-11-03 4/week @ 2023-11-10 29/week @ 2023-11-17 12/week @ 2023-11-24 8/week @ 2023-12-01 2/week @ 2023-12-08 4/week @ 2023-12-15 27/week @ 2023-12-22 6/week @ 2023-12-29 6/week @ 2024-01-05 4/week @ 2024-01-12 2/week @ 2024-01-19 5/week @ 2024-01-26 4/week @ 2024-02-02 6/week @ 2024-02-09 57/week @ 2024-02-16

72 downloads per month

MIT license

74KB
1.5K SLoC

sshx

A secure web-based, collaborative terminal.

Features:

  • Run a single command to share your terminal with anyone.
  • Resize, move windows, and freely zoom and pan on an infinite canvas.
  • See other people's cursors moving in real time.
  • Connect to the nearest server in a globally distributed mesh.
  • End-to-end encryption with Argon2 and AES.
  • Automatic reconnection and real-time latency estimates.
  • Predictive echo for faster local editing (à la Mosh).

Visit sshx.io to learn more.

Installation

Just run this command to get the sshx binary for your platform.

curl -sSf https://sshx.io/get | sh

Supports Linux and MacOS, on both x86_64 and arm64 architectures. The precompiled Linux binaries are statically linked.

If you just want to try it out without installing, use:

curl -sSf https://sshx.io/get | sh -s run

Inspect the script for additional options.

CI/CD

You can run sshx in continuous integration workflows to help debug tricky issues, like in GitHub Actions.

name: CI
on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      # ... other steps ...

      - run: curl -sSf https://sshx.io/get | sh -s run
      #      ^
      #      └ This will open a remote terminal session and print the URL. It
      #        should take under a second.

We don't have a prepackaged action because it's just a single command. It works anywhere: GitLab CI, CircleCI, Buildkite, CI on your Raspberry Pi, etc.

Be careful adding this to a public GitHub repository, as any user can view the logs of a CI job while it is running.

Development

Here's how to work on the project, if you want to contribute.

Building from source

To build the latest version of the client from source, clone this repository and run, with Rust installed:

cargo install --path crates/sshx

This will compile the sshx binary and place it in your ~/.cargo/bin folder.

Workflow

First, start service containers for development.

docker compose up -d

Install Rust 1.70+, Node v18, NPM v9, and mprocs. Then, run

npm install
mprocs

This will compile and start the server, an instance of the client, and the web frontend in parallel on your machine.

Deployment

I host the application servers on Fly.io and with Redis Cloud.

Self-hosted deployments are not supported at the moment. If you want to deploy sshx, you'll need to properly implement HTTP/TCP reverse proxies, gRPC forwarding, TLS termination, private mesh networking, and graceful shutdown.

Please do not run the development commands in a public setting, as this is insecure.


lib.rs:

The sshx server, which coordinates terminal sharing.

Requests are communicated to the server via gRPC (for command-line sharing clients) and WebSocket connections (for web listeners). The server is built using a hybrid Hyper service, split between a Tonic gRPC handler and an Axum web listener.

Most web requests are routed directly to static files located in the dist/ folder relative to where this binary is running, allowing the frontend to be separately developed from the server.

Dependencies

~30–45MB
~796K SLoC