Skip to content
minpeterPublic

About

Single telemetry-free EternalTerminal (Rust port)

Resources

Stars

21 stars

Watchers

0 watching

Forks

Repository files navigation

et.rs

GitHub release AUR version Homebrew tap

A Rust port of Eternal Terminal — a remote shell that automatically reconnects without interrupting the session.

Wire-compatible with upstream protocol version 6: an et.rs client can talk to a C++ etserver, and a C++ et client can talk to an et.rs server, in both terminal and port-forwarding modes. On the server host, etserver and etterminal can also come from different implementations. How we track upstream (Rust rewrite, not a C++ git fork): docs/upstream-factory.md.

Windows is a first-class target. Upstream has no native server there, so hosting a session on Windows meant running the POSIX server inside WSL and landing in a WSL shell. et.rs runs the server and the per-session terminal natively on Windows using ConPTY, so et gives you a real cmd.exe or PowerShell — no WSL involved.

Install

Upgrading an existing server: the default config path is now /etc/et.cfg, not /etc/et/config. Save your old settings before upgrading. After installing, copy/merge them into /etc/et.cfg before starting/restarting the new server (do not overwrite an existing customized file), or explicitly keep --cfgfile=/etc/et/config in your own unit. There is no automatic migration or legacy-path fallback. An existing /etc/systemd/system/et.service overrides the AUR package's unit: update it to use the intended config and --logtostdout, or deliberately remove it to use the packaged unit. After updating a unit, run sudo systemctl daemon-reload; use sudo systemctl restart et to apply changes to an already running server (enable --now alone does not restart it).

Homebrew (macOS, Linux)

brew install minpeter/tap/et-rs

Installs et plus the etserver, etterminal, htm, and htmd role symlinks. The formula conflicts with the upstream et formula — et.rs is a drop-in replacement, so uninstall one before installing the other. Upgrade later with brew upgrade et-rs.

AUR (Arch Linux)

yay -S et-rs-bin
# or
paru -S et-rs-bin

Installs the prebuilt release binary (x86_64, aarch64) with the role symlinks. Conflicts with the eternal-terminal package for the same drop-in-replacement reason. Also installs /etc/et.cfg (preserving local edits on upgrades) and et.service. Enable the server explicitly with sudo systemctl enable --now et.

Prebuilt binaries

Every release ships archives (with .sha256 checksums) for Linux (gnu/musl, x86_64/aarch64), macOS (x86_64/aarch64), and Windows (x86_64). The tarballs already contain the role symlinks. Linux tarballs also contain etc/et.cfg and systemctl/et.service; extract first rather than unpacking all files into bin:

curl -LO "https://github.com/minpeter/et.rs/releases/latest/download/et-VERSION-TARGET.tar.gz"
tar -xzf et-VERSION-TARGET.tar.gz
cd et-VERSION-TARGET
sudo install -m755 et /usr/local/bin/et
for role in etserver etterminal htm htmd; do
  sudo ln -sf et "/usr/local/bin/$role"
done

To run the server on boot (Linux), install the bundled templates. Keep an existing /etc/et.cfg; edit it as needed before enabling the service:

if ! sudo test -e /etc/et.cfg; then
  sudo install -m644 etc/et.cfg /etc/et.cfg
fi
# The package unit uses /usr/bin; manual installs use /usr/local/bin.
sed 's|/usr/bin/etserver|/usr/local/bin/etserver|' systemctl/et.service |
  sudo tee /etc/systemd/system/et.service >/dev/null
sudo systemctl daemon-reload
sudo systemctl enable --now et    # and open 2022/tcp in your firewall

The resulting unit runs ExecStart=/usr/local/bin/etserver --cfgfile=/etc/et.cfg --logtostdout in the foreground, with logs also available through journalctl -u et (normal file logging remains enabled).

A missing default /etc/et.cfg is allowed for direct CLI use; an explicitly selected file (including the service's /etc/et.cfg) must be readable. CLI options override values in the selected INI file. Homebrew still installs only the binary and role symlinks; these systemd instructions are for Linux tarballs/AUR.

Build from source

cargo build --release                                  # host
cargo build --release --target x86_64-pc-windows-gnu -p et   # et.exe

Requires protoc (Protocol Buffers compiler) and a C toolchain (cc, make) on the build host: the wire crypto links the bundled libsodium, which is compiled from source.

Roles

One binary provides every role, selected by argv[0] (busybox-style symlinks) or by a leading subcommand:

Upstream binary et.rs invocation Windows
et et <host> / et client <host> yes
etserver etserver / et server yes
etterminal etterminal / et terminal yes
htm htm / et htm yes
htmd htmd / et htmd yes
ln -s et etserver && ln -s et etterminal && ln -s et htm && ln -s et htmd

Usage

et user@host
et --command 'uptime' user@host:2022
et --tunnel 8080:80 --reversetunnel 9000:9000 user@host
et --forward-ssh-agent user@host
et --jumphost jump.example --jport 2022 \
   --jserverfifo /tmp/etserver.fifo1 dst:2022  # ET-native jumphost relay
etserver --daemon --pidfile /var/run/etserver.pid
htm                                            # headless terminal multiplexer

Client CLI migration

The client follows upstream's SSH-style argument parsing. Put all client options before the host; everything after the host is the remote command, including words beginning with -. For example, et -T host printf hello runs printf hello remotely without a PTY.

Several short options have changed meaning since et.rs 0.0.25. Use these long options to preserve an existing script's ET-specific behavior:

Old client invocation Replacement New short-option meaning
-p 2022 --port 2022 SSH bootstrap port
-c 'command' --command 'command' SSH cipher selection
-t 8080:80 --tunnel 8080:80 Request a PTY
-l /path/to/logs --logdir /path/to/logs SSH username
-e --noexit Accept an SSH escape character argument (no local escape handling)
-f --forward-ssh-agent Background the client
-x --kill-other-sessions Accepted as the SSH no-X11 option
-v 2 --verbose 2 Repeated SSH verbosity (-vv)
-N --no-terminal No remote shell, for forwarding-only sessions
-V --version OpenSSH-compatible version query

These are client changes; server-role options are unchanged. A wire-compatible connection does not make old and new client command lines interchangeable.

SSH configuration

ET reads effective configuration through bounded, deadline-limited ssh -G -T, including OpenSSH's Host/Match/Include and command-line -o precedence. When SetEnv is present, ET performs a second query with a SetEnv override and requires every byte outside the environment block to match. This prevents an embedded newline from becoming a routing/forwarding directive. Both queries share the original deadline. Match exec may consequently run again; changing config or nondeterministic Match results fail closed rather than using inconsistent data. SendEnv imports only local variables matching configured patterns; disabling SSH config does not implicitly send LANG or LC_*. Effective SetEnv still wins. Configured RemoteCommand gets its own sentinel query to reject multiline configuration injection; ET applies the command to the session, not bootstrap.

  • ProxyJump supplies the ET-native jumphost unless --jumphost is given. Only one [user@]host[:sshport] hop is supported, including bracketed IPv6; multi-hop and malformed/injection-shaped targets are rejected before bootstrap. The SSH port does not replace the ET --jport.
  • --forward-ssh-agent or ForwardAgent yes enables agent forwarding and, on Unix, records the OpenSSH session-bind@openssh.com request the bootstrap ssh makes (OpenSSH 8.9+). That binding is replayed on each forwarded agent connection, so ssh-add -h destination constraints work as they do with ssh -A. A jumphost binding is replayed first. If ssh makes no binding (older OpenSSH, or an existing ControlMaster), ET logs a warning and forwarded connections stay unbound. Socket selection is --ssh-socket → IdentityAgent → SSH_AUTH_SOCK. IdentityAgent none disables forwarding unless a CLI socket overrides it; IdentityAgent SSH_AUTH_SOCK selects the environment socket. A socket option alone does not enable forwarding. Literal paths (including spaces and OpenSSH-expanded ~) are supported; unresolved $/% substitutions and path-valued ForwardAgent are rejected. An explicit --ssh-socket or IdentityAgent is pinned for the life of that client process. Saved-session attach uses the current SSH_AUTH_SOCK; when it is absent ET clears a stale proxy link. Use a consistent TMPDIR across attach; secure proxy directories are retained across detach for later retargeting.
  • LocalForward, RemoteForward, and DynamicForward are imported from SSH configuration. An ordinary imported remote bind failure is fatal because the ET wire protocol has no per-row optional flag. Configured local/dynamic failures follow ExitOnForwardFailure. Reverse SOCKS and remote allocated port 0 cannot be represented by ET and are rejected or skipped with a diagnostic.
  • Effective SetEnv assignments enter the initial payload for every session shell. Values retain spaces, quotes, backslashes, empty strings, and additional = signs. OpenSSH's effective first value wins for duplicate names. SetEnv takes precedence over variables selected by SendEnv and over the bootstrap TERM; forwarding-generated environment names take precedence over SetEnv and SendEnv. Names must be POSIX identifiers; supported values are single-line, NUL-free, and at most 4096 bytes. OpenSSH's unescaped dump cannot distinguish a newline followed by another setenv NAME=value row from a separate assignment, so multiline values are not a supported lossless representation. Entries share the 128-name and 64-KiB terminal/jumphost packet budgets: explicit entries are considered before SendEnv, and entries that do not fit are omitted. Non-POSIX sessions also receive SetEnv and SendEnv, with first-wins case-insensitive name deduplication and reserved-name checks. These limits apply to what the et client sends, so et.rs 0.0.43 and older servers keep working. An et.rs etserver and etterminal accept what an ET C++ client sends, like upstream: messages up to 128 MiB, any number of variables of any length, and any name setenv accepts.

Local multiplexing and control (Unix)

Use a private directory for the literal ControlPath (OpenSSH % tokens are not expanded). Start a master, run a passenger command, then stop the local owner:

mkdir -m 700 -p ~/.et/mux
et -M -f -S ~/.et/mux/work -o ControlPersist=yes user@host
et -S ~/.et/mux/work user@host uptime
et -S ~/.et/mux/work -O exit

Mux v4 supports command/interactive passengers, check, stop, exit, and local TCP/Unix forwarding forward/cancel. Cancel closes the listener, not accepted streams. The shared shell accepts one passenger at a time; remote, dynamic, stdio, X11, subsystem, and per-passenger agent requests are rejected. Background startup keeps the controlling terminal through SSH authentication so password, passphrase and host-key prompts work, then detaches stdio before the session pump starts. -N starts a forwarding-only session without a remote shell; --no-terminal retains its older meaning of disabling the client terminal while starting a shell. -N, -W, and --no-terminal with port forwards are closed 5 minutes after the client disconnects unless --disconnect-timeout sets another limit (0 keeps the session). A bare --no-terminal session stays available to reconnect.

et --ctl --name work user@host starts a background control session and prints its private local socket path. The byte protocol exposes input, resize, output cursors, status, a transcript with secret-input redaction, and local shutdown. Repeating --ctl --name work adopts that saved session without replaying its startup command, provided the resolved host, ET port and remote user match. Older records without a remote user require explicit --attach work rather than automatic adoption. A definite invalid-key response replaces only the matching stale record with a fresh session; transport errors preserve it. --no-persist disables saving and automatic adoption. Control shutdown and mux exit leave a saved remote shell attachable; --kill work explicitly ends the remote session. A definite remote end removes matching saved control-session credentials, allowing the same name to start a fresh session. Raw -T masters/control sessions (except forwarding-only -NT), stdio -W control sessions, and Windows local mux/control/background modes are unsupported. Raw -T passengers are rejected too; independent OpenSSH mux clients must request a PTY (-tt). ControlPersist retains a live shared shell, not one that has already exited remotely. Local socket paths require private owner-only directories; user-controlled symlink ancestors are rejected.

Connecting to a Windows host

# on the Windows machine (needs Windows 10 1809+ for ConPTY)
et.exe server --daemon --port 2022 --pidfile "%LOCALAPPDATA%\etserver\etserver.pid"
netsh advfirewall firewall add rule name="et" dir=in action=allow protocol=TCP localport=2022
# from anywhere
et user@windows-host:2022                               # auto-detects cmd.exe login shell
et --winserver user@windows-host:2022                   # explicitly force cmd.exe bootstrap
et --remote-shell powershell user@windows-host:2022     # PowerShell session

Bare clients run a credential-free %ComSpec% SSH probe before bootstrap. An expanded cmd.exe path selects the Windows bootstrap (no printf, CRLF lines, & separator) and defaults --terminal-path to et.exe; a literal %ComSpec% preserves POSIX behavior. --winserver remains the explicit override. The session shell follows %COMSPEC%, or ET_SHELL if set on the server. OpenSSH on Windows must be reachable.

Feature set

  • Protocol v6 handshake, crypto_secretbox (XSalsa20-Poly1305) framing, sequence numbers, and catch-up buffers, pinned to upstream bytes by golden fixtures in fixtures/wire.json.
  • Reconnecting client and server sessions with backed reader/writer replay.
  • Non-TTY sessions survive local input EOF (including redirected Windows handles) while reporting recognizable SSH bootstrap diagnostics. Like ssh -T, a raw -T command sees EOF when the client's stdin ends (et -T host 'wc -c' < file finishes). This needs an et.rs client and an et.rs etterminal; ET C++ has no such signal, so its client or terminal leaves the command reading. On a terminal, Ctrl-D in -T ends the command's input instead of closing et. -W has separate half-close semantics.
  • SSH bootstrap (IDPASSKEY handshake), remote PTY, window resize, keepalives, --command execution, and --no-terminal mode.
  • Forward, reverse, Unix-socket, port-range, environment-variable named-pipe, and ssh-style (bind_address:port:host:hostport, bracketed IPv6) tunnels.
  • SSH-agent forwarding via a server-created socket exported as SSH_AUTH_SOCK.
  • Remote PTYs export their actual path as SSH_TTY; server disconnect defaults are configurable in minutes with --disconnect-timeout or INI [Networking] disconnect_timeout (0 disables the global default). Forward-only sessions fill that same per-session field with 5 minutes when the client flag is omitted, so etserver reaps them after the client is gone. Interactive sessions still leave the field unset. Upstream EternalTerminal uses one server default for every session and does not special-case forward-only clients.
  • ET-native jumphost relay (client, etserver JUMPHOST_INIT dispatch, and etterminal --jump).
  • etserver INI configuration, daemon mode with pid file, log files honouring --logdir, --logtostdout, --silent, --verbose, and log rollover.
  • Headless terminal multiplexer (htm/htmd) with upstream's base64 IPC framing, JSON state, tabs/splits/panes, and pane buffer replay.
  • Native Windows server and terminal: ConPTY shells, a loopback router authenticated with a per-server token, job-object breakaway so sessions survive the bootstrap ssh, and a console client that maps keys (including navigation keys upstream drops) to ANSI sequences.
  • No telemetry: --telemetry is accepted for compatibility and ignored.
  • #![forbid(unsafe_code)] across every crate.

Windows notes

  • The router is a loopback TCP listener; its address and a CSPRNG token live in the --serverfifo endpoint file under %LOCALAPPDATA%\etserver, which takes the place of Unix socket permissions.
  • HTM runs native ConPTY panes on Windows 10 1809+; use et.exe htm from an HTM-capable terminal emulator. It is a protocol relay, not a standalone pane UI. The pane shell is SHELL, then COMSPEC, then cmd.exe; its home is USERPROFILE.
  • HTM IPC uses an authenticated loopback endpoint at %LOCALAPPDATA%\et-htm\htm.ipc. The endpoint inherits the user-private application directory ACL, like the router. --socket on both HTM roles selects an isolated endpoint; on Windows it must remain below that user's LOCALAPPDATA tree, without junctions or parent traversal. Do not grant other users access to this directory or its token files. htm -x shuts down only the selected authenticated daemon, not named fleet processes.
  • HTM first requests Windows job breakaway. If the host denies it, HTM reports the restriction and starts a detached, handle-isolated daemon within the host job. It survives the launching htm client, but not termination of that host job. The stricter etserver/etterminal SSH-bootstrap breakaway policy is unchanged.
  • Unix-socket tunnels remain POSIX-only.
  • Inbound connections need a firewall rule; the server does not modify firewall state itself.

Tests

Unix integration tests require system OpenSSH (ssh) for independent mux interoperability coverage. PTY/process tests should run serially on shared runners.

cargo test --workspace -- --test-threads=1

License

Apache-2.0

About

Single telemetry-free EternalTerminal (Rust port)

Resources

Stars

21 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages