fix(webui): allow SSH quick pairing behind HTTPS proxies

This commit is contained in:
Xubin Ren committed 2026-11-18 20:15:13 +08:00
1 parent d1e1d7bc5e
commit 307b3bce82
4 files changed
+92 -15

No files matched your search

+4 -2
View File
@@ -25,6 +25,8 @@ The return link targets only an HTTP loopback origin (`127.0.0.1`, `localhost`,
No relay, public WebUI, uploaded private key, QR scan or new firewall rule is involved. The public invitation expires after ten minutes. The returned code is encrypted for that local instance; another computer/request cannot import it. The server host key is pinned from the code copied through your trusted terminal. Do not accept a connection code supplied by someone you do not trust.
Quick pairing can coexist with an existing HTTPS reverse proxy and a configured `publicWsUrl`. Keep that URL for browsers that connect directly. SSH uses the Gateway's plain HTTP listener on loopback, not the public URL. Quick pairing does not support TLS on the Gateway listener itself or `trustedProxyAuth`; it still requires a configured WebUI secret and explicit authorization.
The dedicated device SSH key expires after 90 days. OpenSSH `restrict` disables shell-adjacent features and all SSH forwarding; a forced, fixed Python stdio bridge connects only to the selected loopback nanobot port. It cannot execute the client's SSH command. No extra daemon is installed or started. The server requires OpenSSH with `restrict` and `expiry-time` support, `/usr/bin/python3`, an Ed25519 host key, and the conventional `~/.ssh/authorized_keys` layout. Custom SSH policies/layouts may reject the grant; use existing SSH settings in that case. Windows servers and containers are not supported by quick pairing.
This is still **full access to nanobot**, not read-only access. Its configured tools may themselves run commands or modify files. The WebUI credential stays in the local backend, encrypted at rest alongside a private local decryption key and dedicated SSH identity (directories `0700`, files `0600`). This protects against other OS users, not compromise of your logged-in account. Provider keys are not exported by the pairing protocol. Changes to the remote WebUI secret or port require pairing again; they are not silently refreshed through sudo.
@@ -66,7 +68,7 @@ You can also paste a simple command, for example `ssh -p 2222 -i "~/.ssh/team ke
- Run the local WebUI on a loopback address, using the system OpenSSH client.
- For **existing SSH settings**, your key must already have access to the server. Encrypted keys should be unlocked in the system SSH agent. Interactive SSH passwords are not collected by this UI.
- The remote server needs `python3` and an already running nanobot WebUI with a configured `tokenIssueSecret` (or `token`) in its configuration file.
- The remote gateway must support the authenticated `/webui/terminal` identity probe and the supported WebUI client contract. The local installation must have its WebUI bundle; the remote host only needs the backend endpoints. The initial transport supports HTTP on the server's loopback address; SSH encrypts the connection. A configured public WebSocket URL or trusted-proxy authentication is not supported by this SSH connection mode.
- The remote gateway must support the authenticated `/webui/terminal` identity probe and the supported WebUI client contract. The local installation must have its WebUI bundle; the remote host only needs the backend endpoints. The transport uses HTTP on the server's loopback address; SSH encrypts the connection. The **Use existing SSH settings** flow does not support a configured public WebSocket URL or trusted-proxy authentication.
If this machine has never connected to the server, nanobot displays its SSH fingerprint. Compare it with the server console or your administrator before confirming in the same dialog. **Back** returns to the filled-in form when adding a server. The public key is pinned for this connection, without changing your system `known_hosts`. A **changed** host key is blocked, not automatically accepted. Jump-host-only or non-Ed25519 hosts can use a previously verified system SSH configuration instead of the in-app first-contact verifier.
@@ -139,4 +141,4 @@ SSH authenticates the server. A read-only, fixed Python probe retrieves only Web
Remote-connection actions require an authenticated local WebUI connection, a loopback-bound gateway, and local request origin. They are unavailable from a public/reverse-proxied administration page. Connecting requires server admin access; permission to mention nanobot in Linear is **not** that permission.
Common errors explain whether SSH authentication, a missing config, a service account, WebUI authentication, protocol compatibility or networking failed. Key-agent refusal, unsafe key-file permissions, invalid SSH configuration and server-side port-forwarding denial have separate recovery hints. Login banners are ignored when reading the framed probe result. A failed probe is distinct from an invalid nanobot configuration; raw SSH output and credentials aren't displayed in error messages. If SSH works in a terminal but not in nanobot, check that nanobot was started with access to the same system SSH agent. Configurations whose WebUI secret is supplied only by a service environment, interactive SSH passwords, and remote WebUIs with a public WebSocket URL need additional setup; this flow does not silently weaken their authentication.
Common errors explain whether SSH authentication, a missing config, a service account, WebUI authentication, protocol compatibility or networking failed. Key-agent refusal, unsafe key-file permissions, invalid SSH configuration and server-side port-forwarding denial have separate recovery hints. Login banners are ignored when reading the framed probe result. A failed probe is distinct from an invalid nanobot configuration; raw SSH output and credentials aren't displayed in error messages. If SSH works in a terminal but not in nanobot, check that nanobot was started with access to the same system SSH agent. Configurations whose WebUI secret is supplied only by a service environment and interactive SSH passwords need additional setup; this flow does not silently weaken their authentication.