Introduction¶
When running DeepSeek Harness (DSH) locally, the Web GUI is typically accessible only through a direct browser connection. If you need to use it in a public network environment, you need to expose the port to external access, which usually means bypassing DSH’s own request isolation (loopback host + origin matching) and cookie signing mechanism. Directly exposing the port via frpc introduces security risks, because once DSH’s cookie reaches the browser, it effectively grants a stranger control over the machine.
dsh-frp is a DeepSeek Harness plugin that intercepts public traffic through a local gateway. Inside the gateway, it performs login session verification, DSH cookie exchange, and request header rewriting, ultimately forwarding traffic transparently to the local DSH Web GUI. DSH’s cookie never leaves the gateway—it exists only in the Host process’s memory—thereby exposing the local GUI to the public network while maintaining security isolation.
What It Is¶
dsh-frp is a DSH bundle maintained by trymesoft, categorized as a “Network Tool.” It manages an frpc process, publishing the local DSH Web GUI via an HTTP vhost tunnel to the user’s own frps server, with a login gateway placed in front. The gateway first verifies the user’s identity, then injects DSH’s cookie for legitimate requests and strips Set-Cookie from responses, keeping only the gateway’s own HMAC-signed session cookie.
Core Features¶
- Single-entry login: Visitors first see a standalone login page (displayed in Chinese or English based on
Accept-Language). No DSH content is directly accessible. Both HTTP and WebSocket traffic go through the same session check. - DSH cookie never leaves the gateway: All
Set-Cookieheaders in proxied responses are stripped. The browser only holds the gateway’s own session cookie. DSH’s signed cookie exists solely in the Host process’s memory. - Truly revocable credential rotation: Changing the public password updates the session epoch in the Host credential store, immediately invalidating all devices.
- Managed frpc: The plugin panel downloads a pinned frp version with SHA-256 verification, or uses a local binary; monitors proxy status via frpc’s admin API instead of parsing stdout; retains log tail.
- Genuine fault states: The panel clearly identifies the fault layer—gateway, frpc process, proxy registration, or missing configuration; when the local GUI is unavailable, the public entry point returns its own 502 page.
- Configured via DSH: Settings are saved in the Host’s configuration editor; secrets are stored in the credential store and never written to
cordis.patch.yml. - Zero runtime dependencies: Pure ESM, using only Node core modules.
- No proxy tools, no telemetry: The plugin registers no tools, does not touch session data, and its only network peers are the user’s frps, the local GUI, and (at request time) the configured frp publication URL.
Workflow¶
- The plugin starts a loopback-only gateway on an OS-assigned port, exchanges the DSH startup token to obtain a DSH signed cookie (stored in memory).
- The plugin generates an
frpc.tomlpointing to that gateway, startsfrpc, and polls frpc’s local admin API for proxy status. - Visitors access via nginx → frps → frpc → gateway. The gateway requires its own login session, normalizes request headers into a format accepted by DSH’s isolation rules, injects the DSH cookie, strips
Set-Cookiefrom responses, and rewritesLocationto the public origin. - If the GUI returns a
401for a bodyless request, the gateway re-exchanges the DSH cookie and retries. If the gateway crashes, the plugin immediately terminatesfrpc—a live tunnel must never outlive the authentication layer.
Installation & Enablement¶
Install from GitHub into an existing profile:
dsh plugin --profile <profile> add github:trymesoft/dsh-frp
Install from a local checkout:
dsh plugin --profile <profile> add /path/to/dsh-frp
In DSH Desktop, use “Plugins → Add plugin” to enter the package name, Git URL, tarball, or local directory. Then open “Plugins → frp tunnel” and enable the bundle.
The plugin has no build steps or install scripts; the installation process does not execute any generated code.
Configuration & Usage¶
1. Prepare frps and nginx¶
frps.toml requires token authentication and an HTTP vhost port. Since the plugin routes via customDomains, subdomainHost is not needed:
bindPort = 17000
vhostHTTPPort = 17002
auth.method = "token"
auth.token = "<a long random token>"
Place TLS in front of the vhost port using nginx. By default, it will return 404 and drop WebSocket connections. The Host header must be explicitly set, otherwise nginx will rewrite it to $proxy_host, preventing frps from routing by Host.
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
server {
listen 443 ssl;
server_name dsh.example.com; # Your public domain
location / {
proxy_pass http://127.0.0.1:17002; # frps vhostHTTPPort
proxy_http_version 1.1;
proxy_set_header Host $host; # Required: frps routes by Host
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr; # Override, do not append
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 3600s; # WebSocket idle keepalive
proxy_send_timeout 3600s;
client_max_body_size 50m; # Default 1m blocks uploads
}
}
X-Forwarded-For must be overridden with $remote_addr. Frps appends the address it sees (your nginx); the gateway treats the second-to-last entry as the visitor’s address.
Ensure the firewall only allows nginx and the host itself to access 17002 / 17003; otherwise, visitors can bypass nginx and access the same vhost directly via HTTP.
2. Configure the Tunnel¶
In DSH, open “Plugins → frp tunnel”:
- frps Connection — Server address, port (
bindPort, e.g.17000), public domain (dsh.example.com), and public entry URL (https://dsh.example.com). Save the frps authentication token in the same section. Saving connection changes reloads the plugin; if values are unchanged, no reload occurs. Saving only the token triggers a reload. - Gateway Configuration — Public password (for gateway login), DSH cookie TTL, gateway port range (OS-assigned). Saving gateway configuration reloads the plugin.
- frpc Configuration — Custom domain (
dsh.example.com), frpc admin port (default7400), local GUI port (default7401). Saving frpc configuration reloads the plugin.
After saving, the plugin starts the gateway and frpc. The panel displays status (healthy/faulted) and recent logs. Check logs to troubleshoot issues.
3. Verify¶
Visit https://dsh.example.com and enter the public password on the login page. After successful login, you should see the DSH Web GUI. Open browser developer tools and inspect the Cookie header in requests—it should contain only the gateway’s own session cookie, with no DSH cookies.
Use Cases & Notes¶
- Suitable for scenarios requiring public network access to the local DSH Web GUI, such as remote debugging, demos, or team collaboration.
- The plugin runs with the permissions of the current dsh process. It is recommended to review the source code and license (MIT) before installation.
- The plugin registers no tools, does not access session data, and its network peers are limited to your frps, the local GUI, and the configured frp publication URL (at request time).
- Ensure the firewall only allows nginx and the host itself to access the vhost port to prevent direct access that bypasses nginx.
Summary¶
dsh-frp securely exposes the local DSH Web GUI to the public network through a local gateway and controlled frpc traffic. It ensures that DSH’s sensitive cookies never leave the gateway and exist only in the Host process’s memory, providing remote access capability while maintaining security isolation. Ideal for developers who need to use local DSH in a public network environment.