morsh 0.4.0

Next-generation remote terminal client over QUIC and TLS 1.3
morsh-0.4.0 is not a library.

morsh

Crates.io License: Apache-2.0

morsh is a next-generation remote terminal and shell over QUIC and TLS 1.3, combining the responsiveness and roaming resilience of Mosh with the versatility, tunneling, and authentication flexibility of OpenSSH.


Features

  • QUIC & TLS 1.3 Transport: Multiplexed bidirectional streams over UDP with TLS 1.3 encryption, eliminating head-of-line blocking and providing single-RTT connection establishment.
  • Connection Migration & IP Roaming: Seamlessly roam between Wi-Fi, Ethernet, and cellular networks without dropping active sessions.
  • Predictive Local Echo: Speculative keystroke rendering with ANSI styling (dim/underline) and 1-RTT server divergence rollback, eliminating perceived latency on high-RTT links.
  • Session Persistence & Screen Recovery: Server-side virtual terminal emulator (vt100) tracks screen state and cursor coordinates. Detach voluntarily (Ctrl-^ d) or recover from connection drops instantly via 128-bit cryptographic session tokens.
  • TCP Fallback & Happy Eyeballs: RFC 8305 connection racing automatically selects QUIC/UDP or seamlessly falls back to multiplexed TLS 1.3 over TCP in UDP-restricted network environments.
  • Port Forwarding & Tunnels:
    • Local TCP forwarding (-L [bind:]port:host:hostport)
    • Remote TCP forwarding (-R [bind:]port:host:hostport)
    • Dynamic SOCKS5 proxy (-D [bind:]port)
    • Native UDP datagram forwarding (-U [bind:]port:host:hostport)
    • Tunnel-only mode (-N / --no-shell)
  • Stealth Security & Handshake Authentication:
    • Stealth Knock protection (SSH3-style URL path validation to reject unauthorized port scanners)
    • OpenSSH authorized_keys parsing with Ed25519, ECDSA, and RSA signature verification
    • UNIX domain socket ssh-agent integration
    • Linux PAM password verification
  • OpenSSH CLI & Configuration Parity:
    • OpenSSH flag compatibility (-p, -i, -F, -o, -C, -4, -6, -v)
    • Client configuration in ~/.morsh/config.toml with DP wildcard pattern matching, negations (!pattern), and host aliases
    • Server configuration in /etc/morsh/morshd.toml with dynamic SIGHUP configuration reload

Installation

From crates.io

Install the client CLI:

cargo install morsh

Install the server daemon:

cargo install morshd

Quick Start

1. Start Server Daemon (morshd)

Run with ephemeral self-signed certificates:

morshd --listen 0.0.0.0:2222

Or run with stealth knock path protection and explicit certificates:

morshd --listen 0.0.0.0:2222 \
       --cert /etc/ssl/certs/morshd.crt \
       --key /etc/ssl/private/morshd.key \
       --stealth-knock "/api/v1/telemetry-stream"

2. Connect with Client (morsh)

Connect to a remote server:

morsh user@example.com:2222

Using OpenSSH key and stealth knock path:

morsh -i ~/.ssh/id_ed25519 \
      --stealth-knock "/api/v1/telemetry-stream" \
      user@example.com:2222

Detaching and resuming sessions:

  • Press Ctrl-^ d inside the shell to detach without killing remote processes.
  • Re-run morsh user@example.com:2222 to resume the persistent session with instant screen state recovery.

Port forwarding and SOCKS5 proxy:

# Dynamic SOCKS5 proxy on local port 1080
morsh -D 1080 -N user@example.com:2222

# Forward local port 8080 to remote Postgres 5432
morsh -L 8080:localhost:5432 user@example.com:2222

Workspace Architecture

Crate Purpose
morsh Interactive client CLI binary with terminal raw mode and config resolution
morshd Server daemon binary multiplexing PTY, auth, tunnels, and sessions
morsh-core Binary wire protocol framing, Postcard serialization codecs, and constants
morsh-transport Multiplexed QUIC (Quinn) and TCP transport with Happy Eyeballs auto-detection
morsh-auth SSH key parsing (Ed25519/ECDSA/RSA), ssh-agent, PAM, and stealth knock verification
morsh-term PTY supervisor (portable-pty), TIOCSWINSZ resizing, and vt100 state buffer
morsh-predict Speculative local echo engine, visual ANSI styling, and 1-RTT divergence rollback
morsh-tunnel Local/remote TCP forwarding, SOCKS5 proxy engine, and UDP datagram bridging

License

Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).