Tether 0.6.3 · architecture
How Tether works
Tether is a self-hosted remote desktop for Windows and macOS with Linux relays. It is built on a lightly patched RustDesk core (1.5.3) inside Tauri 2 apps. All a client needs is TLS WebSockets on port 443 to its relays; without a proxy in the way, direct LAN, P2P and UDP-relay paths are raced beside them. Every session is end-to-end encrypted. Policies, release indexes, server key lists and branded customer apps are signed on the administrator's PC, so a compromised relay can push neither settings nor code, and cannot read sessions by watching the traffic. A relay node also holds the server key that vouches for device keys: with it, whoever controls the ID server could impersonate a host (docs/encryption.md).
Components
| Component | Where | Role |
|---|---|---|
| Technician app “Tether” | apps/desktop | Tauri 2 + React. One binary is both viewer and host (main window, session windows, file transfer, connection manager, optional background service: Windows service, or on macOS a LaunchDaemon and LaunchAgent since 0.6.3). NSIS installer per machine; macOS universal .dmg. |
| TetherQS | apps/quick | Portable customer module, one TetherQS.exe (macOS: portable .app). Same core, minimal UI, incoming sessions only (conn-type=incoming, disable-installation=Y). Host server and connection manager run in one normal-user process; config in %APPDATA%\Tether-QS. |
| Tether Manage | apps/manage | Admin app (Windows). Holds the admin and updater keys and server keys made for a rotation (sealed with a passphrase); signs policies, release indexes and files, server key lists, team rosters and custom-app profiles; runs staged rollouts, release clean-up, the optional download CDN, devices, diagnostics tickets and the session audit log; talks to every relay with signed requests. |
| tether-trust | crates/tether-trust | Shared Rust crate: signed envelopes, policy bundle and resolution, admin request signatures, version ordering, release index, server key list, team roster, custom-app profiles and trailer. |
| hbbs | relay node | RustDesk rendezvous server (1.1.16), patched so hosts register over WebSocket, with least-loaded relay choice and backup relays, health endpoints, drain, WebRTC signalling, STUN and TURN on UDP 21116, and release hints to hosts. |
| hbbr | relay node | Relay: pairs the two halves of a session by uuid and forwards ciphertext. Drains on stop. |
| Caddy | relay node | TLS front end on 443 (Let's Encrypt, TLS-ALPN-01). Port 80 answers with a redirect to HTTPS, or carries TLS as the fallback route where it is forwarded to 443 (production). Routes WebSockets, API, release indexes and static downloads. nginx is an alternative (PROXY=nginx). |
| tether-api | server/api | tiny_http service (MemoryMax=64M, up to 32 requests at once). Serves signed policy and server key list, heartbeats, the session audit log, team endpoints, diagnostics uploads, release files and indexes, the download page and custom-app links from flat files; Prometheus metrics. No database. |
| DuckDNS | tether-ddns.timer | Free permanent names that follow the nodes' IPs (refresh every 5 min and at boot). Clients are built against names, never IPs. |
| Relay hosts | Hetzner, OCI | Primary: Hetzner Cloud CX23 (AlmaLinux 9). Backup: an Oracle Always Free VM.Standard.E2.1.Micro (1/8 OCPU, 1 GB, Oracle Linux 9). Same server key pair on both. |
tether-trust crate. Clients connect out to Caddy over wss:// on 443; Caddy fans out to hbbs, hbbr, tether-api and the static download folder. A session runs through hbbr unless a direct path (LAN, WebRTC/ICE, or TURN on hbbs) wins the race; the relay only ever sees ciphertext of the session.Repository layout and build
apps/desktop/ technician app (src/ = React UI, src-tauri/ = Rust shell, e2e/ = benches and tests)
apps/quick/ TetherQS (portable, Tauri bundling off on Windows)
apps/manage/ Tether Manage
crates/tether-trust/ envelope, policy, reqauth, version, release, serverkeys, team, custom (shared types and crypto)
crates/webrtc-sctp/ the WebRTC stack's SCTP with faster loss detection (patched into apps and core)
patches/ rustdesk.patch, hbb_common.patch, rustdesk-server.patch, rustdesk-server-hbb_common.patch
scripts/ bootstrap.sh, build-macos.sh, build-relay.sh, test-relay.sh, make-patches.sh,
sign-windows.ps1, deploy-relay-update.sh, release-checks.sh
server/ Dockerfile(.static), docker-compose.yml, systemd units, caddy/, nginx/, install.sh,
rotate-key.sh, api/, patched/turn, cloudflare/ (download CDN worker)
deploy/ helm/tether-relay (Helm chart), kind/ (test cluster and harness), monitoring/
tools/ bench/ (meters, corporate proxy, network audit), macbuild/ (Mac build runner),
turn-bench/, load/, vm/
docs/ specs and runbooks (this site: docs/site/)
Patched RustDesk core
scripts/bootstrap.sh fetches RustDesk 1.5.3, hbb_common and rustdesk-server 1.1.16 into vendor/ at pinned tags, checks the pinned commits and applies patches/*.patch (pin, taken upstream changes and the review of upstream pull requests: docs/upstream.md). Tether's changes sit behind the tauri cargo feature: the Tauri bridge src/tauri_ui (video passthrough, connection manager events), no insecure fallback, recording consent, 443-only networking and route racing in hbb_common::websocket, LAN-only WebRTC behind a proxy, codec choice on low-memory hosts, exact still pictures, macOS input and launchd fixes, and the fluxrt log lines. The relay patch adds WebSocket host registration, health endpoints, drain, least-loaded and backup relay choice, WebRTC signalling, STUN and TURN. scripts/make-patches.sh regenerates the patches.
Build
| Target | How |
|---|---|
| Windows prerequisites | Rust (MSVC), Node 22+, LLVM (LIBCLANG_PATH), VS Build Tools, vcpkg (VCPKG_ROOT, triplet x64-windows-static) |
| Technician app | npx tauri build --bundles nsis → Tether_<v>_x64-setup.exe |
| TetherQS | cargo build --release --features custom-protocol (or npx tauri build) → TetherQS.exe, the only artifact |
| macOS | bash scripts/build-macos.sh: installs Rust targets, NASM 2.16.03, pinned vcpkg under .tools/; builds universal Tether_<v>_universal.dmg, .app.tar.gz and TetherQS-<v>-universal.zip into dist/macos/ (ad-hoc signed unless APPLE_SIGNING_IDENTITY is set). macOS 11+. Releases are built on a build Mac through signed jobs from the PC (tools/macbuild, docs/mac-build-runner.md). |
| Code signing | Self-signed Tether Code Signing certificates, not notarized: Windows files signed with scripts/sign-windows.ps1, every Mac release by the build job; trust installers in certs/ (docs/code-signing.md) |
| Relay | scripts/build-relay.sh in WSL: static musl hbbs, hbbr, tether-api (needs server/patched/turn); image from server/Dockerfile.static (distroless, about 8 MB) |
Since 0.6.0 Tether, TetherQS and Tether Manage carry one version number and are bumped and built together. Release builds refuse to compile without TETHER_SERVER (comma-separated list allowed), TETHER_PUB_KEY, TETHER_ADMIN_PUB_KEY and TETHER_UPDATER_PUB_KEY. For development, npm run dev serves the UI against an in-browser mock backend, and TETHER_PROFILE=b starts a second instance with its own config, so host and viewer can run on one PC.
Deployment
| Item | Relay 1 (primary) | Relay 2 (backup) |
|---|---|---|
| Name | relay.example.com | relay2.example.com |
| Host | Hetzner Cloud CX23, AlmaLinux 9, SELinux enforcing, nightly updates and reboot (the backup takes the sessions meanwhile) | Oracle Always Free VM.Standard.E2.1.Micro, Oracle Linux 9; kdump off and crashkernel removed (it reserved 448 MB of the 1 GB), 2 GB swap file |
| Services | tether-hbbs, tether-hbbr, tether-https (Caddy), tether-api, tether-ddns.timer; unprivileged users, systemd sandboxing (ProtectSystem=strict, ProtectHome, NoNewPrivileges, PrivateTmp) | |
| Data | /var/lib/tether (key pair id_ed25519 and peer DB; back it up), /var/lib/tether-api (policy, server key list, devices, audit log, team, releases, tickets, custom apps) | |
Relay list (RELAY_SERVERS, same order on both hbbs) | relay.example.com|https://relay.example.com/readyz/relay,relay2.example.com|https://relay2.example.com/readyz/relay|backup; a node may check its own hbbr at http://127.0.0.1:21121/readyz | |
A complete node is set up by server/install.sh <name> (hbbs, hbbr, Caddy or nginx, tether-api, firewall ports 443, 80, 21115–21117/tcp and 21116/udp, DuckDNS), or with Docker (server/docker-compose.yml, host networking, uid 65532). install.sh only opens port 80; the TLS fallback route on 80 is a firewalld forward to 443 added by hand on the production relays. Updates roll out relay by relay with scripts/deploy-relay-update.sh, backup first. Prometheus, alert rules and Grafana dashboards: docs/monitoring.md.
Network
443-only
The one connection type a client needs is WebSocket over TLS on TCP 443 to the relay names; registration, signalling, the API and the relay all use it. The apps force the core options allow-websocket=Y, disable-udp=Y and api-server=https://<relay>; upstream's UDP and IPv6 hole punching and LAN discovery stay off (netpolicy.rs, FLOOR). Behind a proxy (detected or configured) nothing else goes to the internet. Hosts keep one WebSocket open permanently, with an empty-frame heartbeat every 20 s so proxies do not close it.
Upstream hbbs accepts host registration only over UDP. The patched hbbs accepts RegisterPeer/RegisterPk over TCP/WebSocket with the same uuid, key, IP-change and rate-limit checks, keeps that connection as the host's signalling path, and gives every proxied client a unique address (forwarded IP plus connection port).
Direct paths beside the relay
With policy network.direct = auto (default) the viewer races direct paths against the relay; off means relay only. The session window shows which path won.
| Path | Badge | How | Needs |
|---|---|---|---|
| Same LAN | Direct (LAN) | UDP broadcast lookup for the host's ID (port 21119), then TCP to the host's listener (21118); also WebRTC between two private addresses | host listener allowed by its firewall (Windows installer rule, local subnet only) |
| IPv6, both global | Direct (IPv6) | WebRTC/ICE host candidates | no proxy on either side |
| NAT hole punching | P2P | WebRTC/ICE server-reflexive candidates; STUN only on hbbs UDP 21116 of Tether's own relays, never public STUN servers | no proxy, outbound UDP |
| UDP relay | Relay (UDP) | TURN embedded in hbbs on the same UDP 21116, 5-minute REST credential per offer, no relaying to private ranges, per-IP and bandwidth caps | no proxy, outbound UDP to the relay |
| Relay | Relay | hbbr over WSS on 443 (below) | always available |
The WebRTC offer, answer and ICE candidates travel inside the TLS WebSocket to hbbs. A ready relay waits at most 0.4 s for a direct attempt (0.8 s more when the host offered a TURN candidate), so a network that drops UDP costs at most that. Behind a proxy, WebRTC runs LAN-only: no STUN or TURN server, only private addresses, public candidates dropped, so nothing bypasses the proxy towards the internet. Every path runs the same end-to-end handshake, password, Accept and permission checks; WebRTC is protected by DTLS bound to the host's signed identity (Encryption). Under packet loss the UDP paths keep latency near the path delay where TCP stalls (docs/stun-turn.md).
Route racing
To its own relays, Tether tries up to four routes, Happy-Eyeballs style: wss://relay on 443 and on 80, each through the detected proxy and directly. They start 300 ms apart; the first completed TLS + WebSocket handshake wins and the rest are dropped. The winner is cached per relay host and tried first next time, for /ws/id and /ws/relay. Because direct routes run alongside proxy routes, a dead proxy setting cannot keep Tether offline. Port 80 is TLS too where firewalld forwards it to Caddy's 443 listener (same certificate, same endpoints; set up by hand on the production relays, not by install.sh). The API, heartbeats, policy and update checks use the same racer.
| Scenario (2026-11-03) | AnyDesk | Tether |
|---|---|---|
| Zscaler-style TLS inspection, 443 only | fails (needs an inspection exemption) | works, 62.8 ms glass-to-glass, 27.9 fps |
| Port 80 only, inspection on | fails without an exemption | works, 56–59 ms, 28 fps |
| Proxy configured but dead | not tested | works (direct route wins) |
| Recovery after a 90 s total block | > 100 s | 2.7 s after reopening (worst case ≤ 18 s) |
Proxy detection and TLS inspection
Proxy order: HTTPS_PROXY / ALL_PROXY, then the system proxy (Windows: WinINet settings, PAC files, WPAD via WinHTTP, and for the background service the machine WinHTTP proxy; macOS: scutil --proxy). Detection repeats every 60 s, so VPN and network changes are picked up. HTTP CONNECT, HTTPS and SOCKS5 proxies are supported.
The relay certificate is verified by rustls. If a proxy re-signs TLS with a company CA, Tether falls back to the OS TLS stack, which trusts the CA deployed to the machine. There is never an “accept any certificate” fallback. An inspecting proxy can see the relay name, timing and sizes, and the rendezvous signalling (device ID, public key, connect requests). It cannot see the session: in the Zscaler-style test the proxy saw 1,454 relay frames whose byte statistics look like random data (printable-byte ratio 0.37).
Relay ports and routes
| Path / port | Target | Notes |
|---|---|---|
/ws/id | hbbs WebSocket 127.0.0.1:21118 | registration and signalling |
/ws/relay | hbbr WebSocket 127.0.0.1:21119 | relayed session bytes |
/api/* | tether-api 127.0.0.1:21120 | policy, server key list, heartbeat, audit, team, diagnostics, admin API |
/q/* | tether-api | custom-app downloads (see Custom apps); the prepared file is sent by Caddy (X-Accel-Redirect) |
/download/<channel>/releases(-v2).json | tether-api | signed release indexes, ETag / 304 |
/download/* | Caddy file_server | release files; latest.json served with Cache-Control: no-cache |
/ | download/index.html | download page, else 200 Tether relay |
/readyz/relay | hbbr :21121/readyz | health of this node's relay for other nodes |
/rendezvous/pubkey | hbbs :21122/pubkey | the server key hbbs signs with (key rotation check) |
| TCP 80 | forwarded to 443 (production) or redirect | fallback route |
| UDP 21116 | hbbs | STUN and TURN for the direct paths; also rendezvous for stock RustDesk clients |
| 21118 / 21119 | hbbs / hbbr WebSocket | bound to 127.0.0.1 (WS_BIND), reached only through Caddy |
| 21121 / 21122 | hbbr / hbbs health | bound to all interfaces; install.sh does not open them in the firewall |
| 21123 / 21124 / 21125 | hbbs / hbbr / Caddy metrics | Prometheus, 127.0.0.1 only |
Stock RustDesk clients would also need TCP 21115–21117 and UDP 21116; Tether clients need only 443 and use UDP 21116 when it is reachable.
Session flow
The relay path below always works and is the only one behind a proxy. The viewer asks every hbbs in parallel, the hbbs that knows the host picks a relay, and both sides meet on that hbbr. Only then do the two devices run the end-to-end handshake, through the relay. Without a proxy the same request also carries a WebRTC offer, and the direct paths race this flow; the first path that completes the handshake carries the session.
PunchHoleRequest; hbbs answers with a relay because the request carries force_relay. A host whose relay leg fails retries its dial 4× at 0.3 s; the viewer gives up on a pairing after 5 s (RELAY_PAIR_TIMEOUT) and asks again.File transfer from a session. Each login of the technician app carries a random 128-bit companion_secret (inside the encrypted connection only). The file-transfer window opened from a session reuses that session's session key (peer ID, name, 64-bit session ID) and secret. The host admits such a connection without a new accept or password only while an authorized remote connection with the same key and secret is open and its Transfer files permission is on (constant-time compare). The session key alone is not secret (audit posts carry it); without the secret the customer is asked as for any connection.
Reconnect
| Step | Behaviour |
|---|---|
| Detect a dead relay | TCP close, or 3 s without the host's once-a-second delay test (RELAY_SILENCE_LIMIT) |
| Retries | at once, then 0.25, 0.5, 1, 2, 4, 8, 10 s (lib/reconnect.ts) for connect.reconnect-minutes (10) |
| “Failed to connect via relay” while it restarts | treated as transient; the series goes on |
| Host answer to a relay request | WebSocket to hbbs and relay dial at the same time |
| Picture | decoder and canvas kept; the first key frame of the new stream resumes it |
| Password | kept in the session, no prompt; the resume ticket (session key + companion_secret) skips password and Accept, never 2FA, while the old connection runs and for 120 s after it dropped |
| Host loses its hbbs registration | at once, then 0.2 … 16 s backoff; WebSocket ping every second, 3 s silence = dead |
| Never retried | wrong password, rejected or closed by the other side, policy and version errors |
Measured with apps/desktop/e2e/reconnect-bench.mjs (0.4.0, 2026-11-03): production systemctl restart tether-hbbr → 0.93, 0.90, 0.90 s from overlay to the first new frame (0.3.0: 2.27 s and 17.8 s, one run gave up). Session's server stopped for good (local): 0.34 s, re-paired through the other server. Both hbbs killed: the running session was never interrupted.
Video pipeline (FluxRT)
FluxRT is a clean-room low-latency profile on the RustDesk core: written from public descriptions and black-box measurements only, not wire-compatible with any other product.
| Property | Mechanism |
|---|---|
| Hardware encode | H.264 → HEVC → AV1 hardware encoders (NVENC, AMF, QSV, VideoToolbox), zero-copy D3D11 texture → NVENC (vram). Low-latency presets: no B-frames, no lookahead, 1-frame VBV. |
| GPU-less hosts | AV1 (aom) stays the automatic choice on hosts with ≤ 4 GB RAM (upstream fell back to VP8, about 3 fps on screen content); software encoders use up to 4 cores. |
| Viewer decode | Encoded frames go untouched to the webview (tauri_ui::video_passthrough), are decoded by WebCodecs in hardware (optimizeForLatency) and drawn on a desynchronised canvas at the full coded size. One window cannot read another session's frames. |
| Key-frame recovery | KeyRecovery in src/lib/video.ts: request a key frame at once and again every second until one arrives; resync only when the decoder is more than 24 frames behind (MAX_DECODE_QUEUE). This replaced a “queue > 3” rule that caused refresh storms. |
| Exact still pictures (0.6.2) | Full-width strips of 8 rows that stood still for 1.5 s are sent as the host's own pixels (RGB, left-delta, zstd, hashed) between video frames, at the video bitrate; the viewer keeps them over later frames while the host lists them as unchanged. Text and photos settle bit-exact. Both ends 0.6.2+; not on hosts with a GPU texture encoder, not in recordings (exact_still.rs, docs/performance.md). |
| Viewer watchdog | Frames fed but none drawn for 10 frames over 3 s: switch that codec to native decoding; still nothing after 5 s: ask the host for VP9 (video.ts watchdog). |
| Rate control | 60 fps ceiling sent explicitly; QoS LAN fast path; upstream video_qos lowers fps first, then bitrate. |
| Local cursor, input | Remote cursor shape becomes the local CSS cursor; pointer moves coalesced per animation frame, clicks and keys sent at once. |
| Idle | Unchanged frames are not encoded. |
| Recording | Passthrough frames go to TauriHandler::record_passthrough; the viewer requests a key frame when recording starts. WebM/MP4, no re-encoding. |
Security model
The relay operator is not trusted with content: the relay forwards ciphertext. Trust is anchored in public keys compiled into the clients; private keys live on the relay (server key) or only on the admin's PC (admin and updater keys). Threat model with actors and residual risks: SECURITY.md; known weaknesses W1–W18: docs/encryption.md.
Keys
| Key | Private half | Public half | Protects |
|---|---|---|---|
| Server key (Ed25519) | /var/lib/tether/id_ed25519 on every relay node (same pair) | compiled in: TETHER_PUB_KEY, replaced by the admin-signed server key list (GET /api/server-keys) once a device has one | Signs device public keys, which is how a viewer knows a host's key (whoever holds it and controls hbbs can impersonate hosts). hbbs -k _ / hbbr -k _ also reject clients that do not present the matching public key, or one in KEYS_ACCEPT during a rotation (a configuration check, not authentication). Rotated without reinstalling clients: docs/key-rotation.md. |
| Admin key (Ed25519) | Tether Manage, keys.json | compiled in: TETHER_ADMIN_PUB_KEY; relay: ADMIN_PUB_KEY | Policies, signed release indexes, server key lists, team rosters, custom-app profiles, every admin API request. Several keys may be trusted for rotation. |
| Updater key (minisign) | Tether Manage, keys.json | compiled in: TETHER_UPDATER_PUB_KEY | Installers, update archives, TetherQS.exe and the macOS zip; the signed trusted comment names file and version |
| Team member key (Ed25519) | each technician app | team roster, published by Tether Manage | Team requests (/api/team/*: shared tags, devices, audit) without the admin key |
| Device identity (Ed25519) | each device's config | registered with hbbs, signed by the server key | Peer authentication in the E2E handshake |
Admin and updater keys are sealed with argon2id (64 MiB, 3 passes) + XChaCha20-Poly1305 under the admin's passphrase (≥ 8 characters, no recovery). Losing them means rebuilding every client, since new admin and updater keys only work in newly built clients; the server key, by contrast, can be rotated through the signed list.
Encryption
| Layer | Mechanism |
|---|---|
| Transport | TLS 1.2/1.3 WebSocket on 443 (rustls with bundled and OS roots, then the OS TLS stack, so inspection CAs work; never unverified). The rendezvous channel relies on this TLS alone. |
| Peer ↔ peer | Ed25519 host identities signed by the server key; host-signed ephemeral X25519 key; random session key sealed with crypto_box, split into one key per direction; XSalsa20-Poly1305 (libsodium secretbox) on relay and LAN, DTLS bound to the host's signed fingerprint on WebRTC. Forward secrecy. Full description and limits: docs/encryption.md. |
| No plaintext fallback | Viewer: refuses instead of asking “continue insecurely” (client.rs::confirm_insecure_connection). Host: aborts when the peer offers no key, sends no key exchange, the transport is not flagged secure or its own key pair is missing (server.rs::identity_handshake). |
| Secrets at rest | Permanent password (stored as a salted SHA-256, password-equivalent), 2FA secret and remembered peer passwords wrapped with a key made from the machine uid: obfuscation, not protection against someone who can read the config. The device's Ed25519 key is stored unencrypted (0600 on macOS). |
| Authentication | Accept click and/or password; 10-character one-time password; permanent password ≥ 12 characters, ≥ 3 classes; optional TOTP 2FA; failures counted per IP and per IPv6 /64, /56, /48, throttled, then blocked, and the one-time password rotates |
Signed policies and requests
- Envelope:
{"payload": b64, "sig": b64(ed25519), "key": b64(pubkey)}. Clients accept it only ifkeyis one of the compiled-in admin keys and the signature verifies. - Rollback protection: clients store the last accepted serial and reject lower ones; the relay requires a serial higher than its current one (
409). A compromised relay can withhold a policy, but cannot alter, forge or roll one back. - Admin requests: header
Tether-Sig: v2 host=<relay host> ts=… nonce=… sig=…over"tether-admin-v2\n" + host + "\n" + METHOD + "\n" + path(with query) + "\n" + ts + "\n" + nonce + "\n" + hex(sha256(body)). The relay accepts v2 only for its own names (RELAY_HOST), allows ±300 s clock skew and rejects a nonce seen in the last 601 s (persisted across restarts). The olderv1form (no host, so not bound to one relay) is accepted from older apps untilTETHER_SIG_V1=offis set on the relay. Tether Manage and the technician app sign v2 and follow no HTTP redirects. - Updates: the release index (version, file, size, sha256, rollout, halt, minimum version) is admin-signed with a serial floor per channel; each file's minisign signature, signed file name and version are checked against the compiled-in updater key before anything runs. Installing code needs both keys.
- Server key list and team roster: admin-signed documents with serials; devices keep the highest accepted serial, so a relay can neither widen nor roll back the set of trusted server keys.
- Custom apps: the profile is an admin-signed envelope; the relay checks it before storing, and TetherQS checks it again against its own compiled-in keys.
Security floor and hardening
tether_trust::policy::FLOOR lists core options no policy can set; the apps force them on top of any policy: allow-insecure-tls-fallback, allow-remote-config-modification, enable-check-update, allow-auto-update, direct-server, enable-remote-printer, allow-auto-record-incoming/outgoing, stop-service, enable-camera, enable-terminal, allow-websocket, disable-udp, enable-lan-discovery, api-server, enable-webrtc, enable-udp-punch, enable-ipv6-punch, custom-rendezvous-server, relay-server, key.
- A connected peer can never change this machine's settings; no third-party update checks; no virtual printer; no camera view or remote terminal; nothing written to disk without an explicit action. File transfer refuses Tether's own configuration and installation folders, and Tether's own windows ignore remote input (
own_ui_guard; Mouse Keys and the On-Screen Keyboard still get through, W18). - Tauri shell: strict CSP (
default-src 'self'), no shell, filesystem or HTTP plugins; the updater, dialog, deep-link and single-instance plugins are used from Rust only and no plugin command is exposed to the webview (capabilities/default.json); DevTools not compiled into release builds. Commands that change this machine's security posture (permanent password, 2FA, options, installing the service, saving the hosts store and team tags) answer the main window only. Validated IPC input: peer IDs[A-Za-z0-9_.@:-]{1,64}, session keys 32 hex characters, options from an allow-list, bounded lengths, connection types as an enum. - Locked settings are refused in the backend (
locked:<feature>errors), not only greyed out in the UI.
Recording consent
- Every incoming connection on a Tether host starts with its
recordingpermission off, regardless of settings; the viewer's recorder is gated off before the first frame (record_state && record_permission). - Record sends
Misc.client_record_status = trueas a request; no frame is recorded yet. - The host's connection manager emits
record_consent_request{conn_id, peer_name, text}; the user answers viacm_record_consent {connId, allow}. - Allow turns the permission on and the viewer starts recording (REC pill); Deny sends it off again. The host can revoke at any time; a reconnect is a new connection and asks again.
recording.mode=always only automates the request. An unattended host never answers, so it is never recorded. A modified viewer could still capture frames it receives; consent is enforced by Tether's own viewer.
Policy model
A policy is one signed tether_trust::policy::Bundle: a serial, one layer per profile (technician, customer), named groups with overrides and device assignments by install uuid. 47 features in areas permissions, security, connections, video, recording, updates, policy, interface, diagnostics and customer (full table: docs/policy.md, generated from FEATURES).
policy::resolve_with(bundle, profile, device, custom, machine). The custom app sits between profile and group: it is the admin's choice for everyone using that download, while groups and GPO/MDM still target individual devices. Its setting is ignored for a feature the profile locks: its signed settings have no serial or expiry and cannot be revoked on a downloaded app, so they never switch on what the published policy locks.Distribution. Clients poll GET /api/policy every policy.refresh-minutes (15; 1 with policy.fast-apply) with If-None-Match: "<serial>", verify, reject lower serials, cache the verified document and apply it at the next start before the core runs. Then they send POST /api/heartbeat (uuid, ID, profile, version, OS, policy and server key list serials, update state; ≤ 2048 bytes, rate-limited). The server key list (GET /api/server-keys) is fetched before every policy check. The policy API and heartbeats use the first server that answers; update checks ask every relay for the release index.
Publishing from Tether Manage. Publishing validates the draft (unknown features or values make it unpublishable), shows a review of the change, signs it, and publishes the same signed document to every configured relay with serial = highest serial on any relay or published from this PC + 1. It then reads back each relay's state and reports per relay; a relay that missed it can be published to again, since any node with a lower serial accepts the same document. History keeps the last 50 versions per relay (policy-history/<serial>.json); restore republishes old content under a new serial, and only documents that verify with this PC's admin key are used.
Updates
releases.json and releases-v2.json, then each relay's latest.json (read only by clients up to 0.5.23). One signed index is valid on every relay (https://{relay} stands for the relay it came from), so an update never depends on another node.- Layout:
download/<channel>/releases.jsonandreleases-v2.json, plus<technician|customer>/<windows-x86_64|darwin-universal>/with versioned artifacts (Tether_<v>_x64-setup.exe,TetherQS-<v>.exewith.gz/.xzcopies,Tether_<v>_universal.app.tar.gz+.dmg,TetherQS-<v>-universal.zip), their.sigfiles and the legacylatest.json. - Signed release index (
tether-releases/1): per<app>/<platform>version, file, size, sha256, signature, URLs, packed copies,mandatory,minimumVersion,forced,security, rollout andhalted; signed with the admin key for 30 days (an expired index is still used and reported as stale). Clients ask every relay, take the highest valid serial and keep it as a floor per channel; builds from 0.5.25 never read the unsignedlatest.json.releases-v2.jsonis the same index with xz copies, read by Tether 0.5.33 / TetherQS 0.5.31 and later. Channel fromupdate.channel(defaultstable); versions orderMAJOR.MINOR.PATCH[-pre]; channel switches never downgrade. - How devices learn of a release: tether-api bumps a release generation on every index change; hbbs pushes an unsigned
ReleaseHintto registered hosts within 5 s (then a random wait up to 60 s), the heartbeat answer carries it too, and clients poll at start, everyupdate.check-hours(6) and after a policy change. - Staged rollout: presets Standard (1 → 10 → 50 → 100 % over 24 h), Fast, Immediately; each device has a stable bucket from
SHA-256(uuid, app, version); policyupdate.rolloutearly / default / late. A security release skips the ramp; a halt re-signs the index and stops devices that have not installed it. A device below a minimum version gets the release at once. - Downloads: the optional CDN (Cloudflare Workers Static Assets, 25 MiB per file) first, then the relay; the CDN and relays are untrusted, every byte is checked against the index.
- Technician app: the installer is downloaded in the background once the device is eligible, verified and staged; Install and restart re-checks the index and hands the verified bytes to the NSIS installer in passive mode, which stops the
Tetherservice if installed, overwritesC:\Program Files\Tether, restarts the service, and the app restarts (/R). macOS replacesTether.appin place; with the macOS service installed, the agent and daemon restart from the new app once no session runs. - TetherQS: downloads (HTTPS, ≤ 200 MiB), verifies, writes
TetherQS.exe.new, renames the running exe to.oldand the new one into place (rollback if the second rename fails), restarts with the same ID and one-time password (hand-over file valid 60 s); never while a session runs. Unwritable folder:%LOCALAPPDATA%\Tether-QS\TetherQS.exe. A custom app re-attaches its own signed profile after verifying the plain exe. macOS: the zip is unpacked withdittoand the.appswapped the same way. Verified 0.3.0 → 0.3.1 as a standard user through a TLS-inspecting proxy in 47 s.
High availability
Any number of independent nodes, each the full stack. No cluster protocol, no shared database; they share only the server key pair.
- Hosts register with every node (
TETHER_SERVERlist plus policyservers.list, up to 8 entries: host names orwss://host/path, verified with the same server key). One independent registration loop per server. - Viewers race their request: the last server that worked first, the next one on failure or after 1 s without an answer. The first hbbs that knows the host wins.
- Relay choice (server side): every hbbs has a relay list of
<address>[|<health URL>][|backup]entries and fetches each health URL every 3 s (2.5 s timeout). hbbr's/readyzanswers200 ready sessions=Nor503 draining sessions=N. hbbs hands out the least-loaded healthy primary; ties rotate. Backups are used only while no primary is healthy (failover in about 3–6 s, back on the first passed check; running sessions stay). Locality does not matter. - The host sends its
RelayResponseto the same hbbs, which forwards it to the viewer; both meet on the chosen hbbr.
Drain
On SIGTERM hbbr reports not-ready at once and keeps relaying open sessions. For the first 5 s it still pairs new uuids (an hbbs may hand it out until its next check), then refuses new pairings. It exits when the last session ends or after DRAIN_TIMEOUT (systemd 300 s, Kubernetes 3600 s); a second signal exits at once. hbbs is not-ready for its own DRAIN_TIMEOUT (default 0). Health: hbbr :21121, hbbs :21122, /healthz and /readyz.
Failures and measured failover
| Event | Effect | Measured |
|---|---|---|
| Session's hbbr crashes (production, viewer behind the proxy) | Session re-pairs on another relay | 0.6–0.8 s |
| Whole relay node down (production) | Session continues through the other relay | 0.6–1.6 s |
| Primary hbbr killed and kept down (production, Hetzner + Oracle backup) | Backup used for new sessions; running session came back over the backup | failover logged after 4 s; session back after 22 s; new session first frame 1.0 s |
| hbbs or node dies | Hosts stay registered elsewhere; relayed sessions do not use hbbs and continue | no interruption |
| Dead relay leaves every hbbs's healthy set | A pick that lands on it before fails fast and the client asks again | within 3 s + 2.5 s |
| Caddy restart | WebSockets through it are cut; clients reconnect | kind: 20–40 ms |
| DuckDNS / IP change | Name follows within 5 min; clients use the other node meanwhile | – |
Tether Manage with N nodes: it writes to every node (policy, server key list, team roster, release files and indexes, download page, custom apps) and the nodes stay independent. A node that missed a write is stale, not wrong. Diagnostics tickets are created on the first node and opened with the same ID on the others; device lists are merged by uuid, newest last_seen wins. Capacity estimate (not measured): an E2.1.Micro has up to 480 Mbit/s and a 10 TB/month allowance; at 1–5 Mbit/s per session one node is bandwidth-bound at a few dozen concurrent sessions. Sizing for 10 000 devices and 3 000 sessions, with measurements: docs/scaling.md.
Kubernetes
Helm chart deploy/helm/tether-relay: the same design with every pod acting as a node. hbbr only pairs two halves that reach the same process, and a host's RelayResponse must reach the hbbs that holds the viewer, so load balancing either would break sessions. Every pod therefore gets a stable URL.
publishNotReadyAddresses: true, so a draining pod stays reachable for its open sessions and half-made pairs.- Values:
publicUrl(its host is the api'sRELAY_HOST),key.existingSecret(the production key pair),key.accept(during a key rotation),proxy.trustedProxies,proxy.service.externalTrafficPolicy,hbbs.replicas2,hbbr.replicas2,hbbr.drainSeconds3600 (grace = drain + 30),hbbs.drainSeconds2,hbbs.extraRelays(e.g. the VMs),proxy.enabled(or your own ingress with 3600 s timeouts),api.enabled,podDisruptionBudget.maxUnavailable1, requests 50m/32Mi, limits 1 CPU/256Mi. - Pods: UID 65532, read-only root, all capabilities dropped (Caddy keeps
NET_BIND_SERVICE), RuntimeDefault seccomp, soft anti-affinity; readiness/readyzevery 2 s, liveness/healthz. The WebSocket ports listen on the cluster network (WS_BIND=0.0.0.0, never on a LoadBalancer); API requests go through the api pod's Caddy so tether-api sees client IPs. Image: static musl binaries on distroless (≈ 8 MB). - Rollouts: hbbr one pod at a time, highest ordinal first; the terminating pod is not-ready at once and every hbbs stops handing it out within 3 s; a full rollout takes at most
replicas × drainSeconds. hbbs restarts take seconds and do not affect relayed sessions. A proxy rollout cuts WebSockets through the old pods (re-pair ≤ 40 ms), so do it rarely.
Measured on kind
2026-11-03 (0.4.0): kind v0.33.0 (Kubernetes 1.37), 1 control plane + 2 workers; hbbs ×2, hbbr ×3 (drain 90 s), proxy ×2, api ×1. The harness does what clients do (register with both hbbs, race, re-pair after a drop or 1 s of silence; 1 KiB frames every 20 ms).
| Test | Sessions | Reconnects | Max gap |
|---|---|---|---|
hbbr rollout restart (57 s) during churn | 30 | 0 | 0 |
hbbs rollout restart (7 s) during churn | 30 | 0 | 0 |
| proxy rollout, live sessions | 6 | 3 | 40 ms |
force-delete hbbr-1 | 6 | 2 | 39 ms |
delete hbbr-2, grace 15 s | 6 | 2 | 20 ms |
| worker frozen, proxies elsewhere | 6 | 5 | 1.02 s |
| worker frozen with a proxy pod on it | 6 | 4 | 43.7 s |
Relay latency in the cluster: p50 0.3 ms. The last row is the known weak spot: kube-proxy keeps routing to a proxy pod on a silently dead node until it is NotReady (~40 s). Behind a cloud LoadBalancer use externalTrafficPolicy: Local with health checks of a few seconds and keep proxies on different nodes.
Custom apps
A custom app is a branded TetherQS: a signed tether_trust::custom::CustomProfile plus a private, expiring download link.
| Field | Rule |
|---|---|
id | [a-z0-9-]{1,40}, random, the same on every relay |
name | 1–64 printable characters; window title (overrides customer.title) and file name <Name>-Support.exe (reduced to [A-Za-z0-9 _.-]) |
accent, welcome | #rrggbb; ≤ 400 characters (override customer.accent-color, customer.welcome) |
logo_png | base64 PNG, ≤ 96 KiB decoded |
layer | policy layer, customer-profile features only, same value rules as the bundle |
issued_at | Unix seconds |
- Tether Manage signs the profile with the admin key and calls
PUT /api/admin/custom/<id>on every relay with{profile, token, expires, channel}(≤ 300 KiB). Token: 32 random bytes, base64url, 43 characters; expiry in the future and ≤ 366 days. - The relay verifies the signature against its admin keys, validates the profile, requires
profile.id == <id>, and storescustom/<id>.json(0600). A new token for the same id kills the old link. GET /q/<token>(public) returns the channel's currentTetherQS-<v>.exewith the profile attached (custom::attach: appended, or for an Authenticode-signed exe placed at the end of its certificate table so the signature stays valid). A Mac browser gets the macOS zip;/q/<token>/windowsand/macforce a platform. Unknown, revoked and expired tokens all get the same404(no oracle); 30 requests/min per IP; downloads are counted.- TetherQS reads its own file, verifies the profile against the compiled-in admin keys and applies it as the custom-app policy layer. Self-updates verify the new plain exe, then attach the profile again.
macOS (0.5.25+): the signed .app cannot carry a trailer, so the relay only renames the bundle folder inside the zip to <Name>-Support [<mac id>].app (the folder name is not sealed, the code signature stays valid). At first start TetherQS reads the mac id from its folder name, fetches the signed profile from GET /q/m/<mac id>, verifies it like the trailer and caches it. DELETE /api/admin/custom/<id> revokes a link at once. The relay never modifies the profile.
Diagnostics
- Diagnostics page (
diag.rs): version, ID, OS, policy serial/group/sources, server, proxy (without credentials), DNS with timing, one row per route (443/80 × proxy/direct, handshake time), last 40 ERROR/WARN lines. “Test connection” runs every route with an 8 s timeout. - Bundle:
diagnostics.json, logs changed in the last 24 h (newest 1 MiB each, 12 MiB total), config files with every key containingpasswordor a part equal tokey,salt,token,secret,pin,otp,2fa,tfa,trusted,pk,skredacted. Logs are not redacted. - Upload:
POST /api/diag/<ticket>, ticket[A-HJ-NP-Z2-9]{8}opened by an admin on every relay, 24 h, one upload, ≤ 2 MiB (else onlydiagnostics.json), kept 7 days; an admin can close a ticket (archived 90 days) or delete it. The apps try every relay until one takes it. Verified round trip through a TLS-inspecting proxy: about 7 s. - Session audit log: every host posts connection, file-transfer and alarm records to the first relay of its build (
/api/audit/*); Tether Manage › Sessions merges them. Unauthenticated device telemetry, kept 90 days or 50 MB. - Monitoring: Prometheus metrics from hbbs, hbbr, tether-api, Caddy and the hosts, alert rules and Grafana dashboards (
docs/monitoring.md). - Logs:
%APPDATA%\Tether\log\<role>\(server, cm, connect, service, portable-service), TetherQS%APPDATA%\Tether-QS\log\, macOS~/Library/Logs/Tether/; daily or 16 MiB rotation; verbose logging for one hour from the next process start. The host encoder logs afluxrt encode:line every 5 s.
Relay API
| Endpoint | Auth | Purpose |
|---|---|---|
GET /api/policy | public | Signed policy, ETag: "<serial>", 304 when unchanged |
GET /api/server-keys | public | Admin-signed server key list, ETag / 304 |
POST /api/heartbeat | public | Device report; 1 per uuid per 60 s; 30 per IP per minute for uuids the relay does not know yet; ≤ 50 000 devices, 180 days. Answers {"releases": G} (release generation) |
POST /api/audit/conn|file|alarm | public | Session audit records from hosts (≤ 8 KiB, rate-limited, unauthenticated) |
POST /api/diag/<ticket> | ticket | Diagnostics zip ≤ 2 MiB |
GET /download/<channel>/releases(-v2).json | public | Signed release index, ETag: "<serial>" |
GET /q/<token>[/windows|/mac], GET /q/m/<mac id> | token | Custom TetherQS download; signed profile for a macOS custom app |
/api/team/me|devices|tags|audit | member-signed | Team access with a technician's own key from the roster: shared tags (If-Match revision), devices, audit (members with audit) |
PUT /api/admin/policy | signed | Publish (≤ 256 KiB, validated strictly, serial must increase); history of 50 |
GET /api/admin/policy-history[/<serial>] | signed | List / fetch published documents |
PUT /api/admin/server-keys | signed | Server key list (≤ 16 KiB, serial must increase) |
GET /api/admin/devices | signed | Device list |
GET /api/admin/audit | signed | Session audit records, newest first, ≤ about 8 MiB per answer |
POST /api/admin/diag-ticket, GET /api/admin/diag[/<t>], POST …/diag/<t>/close, DELETE …/diag/<t> | signed | Tickets (optional fixed ID for multi-relay), archive, delete |
PUT|DELETE /api/admin/release/<channel>/<path>, GET /api/admin/releases | signed | Release files ≤ 200 MiB and indexes, atomic writes; published files refused without ?force=1; 507 below 2 GiB free |
POST /api/admin/releases/prune | signed | Release clean-up: plan or delete old versions |
PUT /api/admin/download-page | signed | Download page HTML ≤ 512 KiB |
PUT|DELETE /api/admin/custom/<id>, GET /api/admin/custom | signed | Custom apps |
PUT|GET /api/admin/team | signed | Team roster (≤ 500 members) |
GET /api/admin/status | signed | Version, free disk, devices, policy and key list serials, release generation and indexes, uptime, last clean-up |
Without ADMIN_PUB_KEY the admin endpoints answer 503; without RELAY_HOST every v2-signed request answers 401. Every JSON write is temp file + rename; upload bodies are streamed to disk. Full wire contract: docs/api.md.
Performance
Current numbers (0.6.x, GPU-less 1080p VM host)
Delay to the first appearance of each new picture while scrolling, split with the host's capture timestamps (docs/performance.md, 2026-11-11/12):
| Part (median) | Relay (WebSocket) | Direct (LAN) |
|---|---|---|
| page drew it → host has it captured | 56 ms | 54 ms |
| → handed to the viewer's decoder | 17 ms | 3 ms |
| delay to first appearance | 73 ms | 57 ms |
AnyDesk 9.8.3 through its relay: 67–68 ms on the same meter. Tether's own part before the network is about 6 ms; the rest is the VM drawing and composing in software. Still page against AnyDesk (0.6.0): luma 39.2 vs 35.2 dB and text 43.4 vs 34.7 dB in Tether's favour, chroma and photo in AnyDesk's; from 0.6.2 a settled still page is the host's screen bit for bit (exact still pictures). A 2.3 s blackout on the TCP relay route gives a 4.3 s picture gap (TCP's retry timer); the UDP paths do not have this. The tables below are historical.
Window drag on a GPU-less VM (0.4.0)
Hyper-V VM, 4 vCPU, 8 GB, no GPU, 1920×1080, TetherQS host with software AV1; viewer on a PC with an RTX 3080; both through the production relay.
| Build | Remote frames/s | Longest gap between pictures | Latency p95 |
|---|---|---|---|
| 0.3.0 as reported (refresh storm) | 3–4 | 1.6 s or frozen | 1.2 s |
| 0.4.0 | 20 / 23 | 90 ms | 88 / 55 ms |
| 0.4.0, VM egress only via TLS-inspecting proxy | 20.1 / 22.9 | 99 / 79 ms | 66 / 59 ms |
Against AnyDesk (0.4.0; black-box, same VM, same optical meter)
| Viewer | Latency mean | p95 | Frames/s | Longest freeze |
|---|---|---|---|---|
| AnyDesk 9.8.3 | 62.4 ms | 95 ms | 11.2 | 509 ms |
| Tether 0.4.0 (inspection exempt, like AnyDesk) | 72.2 ms | 98 ms | 12.6 | 507 ms |
| Tether 0.4.0 (TLS-inspected) | 74.3 ms | 102 ms | 14.7 | 563 ms |
On par: same p95 and worst gap, slightly more pictures, AnyDesk about 10 ms lower on average. Optical freeze figures are conservative (motion blurs the barcode); the canvas meter shows Tether's picture never paused more than about 99 ms. In the earlier idle/scrolling comparison on the same VM (0.1, P2P over the Hyper-V switch), Tether averaged 37.9 ms vs 52.1 ms glass-to-glass (27 % lower), p95 59 vs 83 ms, 28.1 vs 19.7 fps.
With a GPU (2026-11-03)
Single PC, RTX 3080, 2560×1440: glass-to-glass mean 24.0 ms (scrolling, Speed) to 30.2 ms (idle, Balanced), 57 fps at full resolution, WebCodecs decode 0.7 ms per frame, HEVC via NVENC zero-copy, about 2.3 Mbit/s for a mostly static desktop. Input: median 12 ms, p95 19 ms over 40 pointer moves. Through a Zscaler-style proxy: 62.8 ms mean, 27.9 fps.
Known limits
- Releases are signed with self-signed certificates and macOS builds are not notarized: users install the trust certificate from
certs/or confirm the operating system's warning once (docs/code-signing.md). Ad-hoc signed builds lose Screen Recording and Accessibility with every update; releases signed with the unchanged certificate keep them. - macOS unattended access (0.6.3): after a restart with FileVault nothing can connect until the disk is unlocked at the Mac; an
admin-group user can replace/Applications/Tether.app, which the root daemon then runs; installing needs a person at the Mac. Not checked: the login window, a restart, an Intel Mac. - Update downloads try only TLS on 443 (proxy or direct), without the port-80 and proxy-to-direct fallbacks.
- The Windows background service refuses new sessions below the policy's minimum version itself, but a release's mandatory or minimum version is enforced by the app and the connection window, not at the logon screen.
- Known weaknesses still open include the server-key MITM of new sessions (W6), key exchange version 0 with non-Tether peers (W1), legacy TCP tunnels (W2) and the public recording upload token (W15):
docs/encryption.md. - A whole Kubernetes node freezing silently with a proxy pod on it stalls sessions until the node is NotReady (~40 s).
- Installer: after an interactive upgrade Tether comes back via “Run Tether”; automatic reopening is guaranteed only for the in-app updater (
/R). - Relay load is sampled every 3 s, so a burst within one interval goes to the same relay.
- Consent needs an interactive user; a modified viewer could capture the frames it receives. Endpoint compromise is out of scope. The ID ↔ IP registry is metadata visible to the relay operator.
- TetherQS without admin access cannot see UAC prompts or type into elevated windows. A macOS custom app renamed in Finder loses its branding.