Preface¶
The DeepSeek Harness (DSH) web interface only listens on the local loopback address by default. This is intentional: dsh web --host 0.0.0.0 will be directly rejected, with an error message explaining that doing so would expose remote code execution to the network. Even with --trusted-host to relax Host validation, chat works, but Settings, Models, Plugins, etc. will still show “unavailable in this browser”—the client will not initiate the corresponding RPCs in non-loopback scenarios.
If you are already using Tailscale for networking and want to operate the DSH running on your home or office computer from your phone or other tailnet devices, without exposing dsh, LAN, or public network ports, you need to add a controlled access path without “removing dsh’s two security barriers”. Below is the design and usage of the community plugin dsh-tailnet-gateway (maintainer OutLawZhangSan-liii, repository OutLawZhangSan-liii/dsh-tailnet-gateway). The plugin is released under MIT license, current package version is 0.1.0; the README states it was developed and verified on dsh 0.1.5-rc.1, Web profile, Windows.
Most capabilities in the DSH ecosystem are mounted as plugins; the plugin directory site SkillHub’s dsh-tailnet-gateway page has no official affiliation with DeepSeek/Huanfang. Please read the source code and license yourself before installation.
What is this¶
dsh-tailnet-gateway is an ES module DSH plugin with no additional runtime dependencies (entry point lib/index.js). It starts an authenticated reverse proxy on local 127.0.0.1, publishing the loopback-only-bound dsh web to your tailnet via Tailscale Serve. The companion script grant-access.mjs issues one-time authorization links for browsers that cannot manually set cookies (e.g., mobile phones).
The plugin does not expand dsh’s two barriers of “request trust” and “privileged RPC”, but adds a second gate before them: by rewriting Host / Origin / Referer to the loopback authority, it makes the upstream dsh see legitimate loopback calls from the local machine, rather than bypassing validation.
Access Path¶
After the above steps, the typical path is as follows (from the README):
phone (Tailscale app)
│
│ 1. WireGuard, end-to-end encrypted, tailnet members only
▼
tailscaled ── 2. terminates TLS for the *.ts.net name
│ 3. stamps Tailscale-User-Login + X-Forwarded-For,
│ OVERWRITING whatever the client sent
▼
tailscale serve :443 ── 4. published with: tailscale serve --bg 7242
│
▼
gateway 127.0.0.1:7242 ── 5. this plugin. Two gates:
│ - the stamped login must be allowed
│ - optional per-device tailnet IP allowlist
│ 6. rewrites Host/Origin/Referer to the
│ loopback authority, then forwards
▼
dsh web 127.0.0.1:3080 ── 7. sees a genuine loopback call from this
machine, so the privileged fence is
satisfied honestly — not bypassed
The key points are three: identity comes from header fields overwritten by tailscaled, tailnet peers cannot self-report identity; both gateway and dsh listeners remain on 127.0.0.1; rejection happens before connecting to dsh, so failed requests do not reach the upstream.
Core functionality and remote-side capabilities¶
| Capability | Access via tailnet |
|---|---|
| Chat, run agent, tools, jobs, workflows | Available |
| File browsing/upload, session and goal views | Available |
| Settings, Models, Plugins, Agent presets | Not available in browser UI |
The last item is a deliberate design: the plugin only implements the access-side gateway, not patching the client bundle; related pages will be read-only degraded, and server-side privilege barriers remain in effect.
Security-related behaviors are covered by tests in test/gateway.test.js, including loopback binding clamping, rejection without identity headers, taking the first item of X-Forwarded-For, WebSocket upgrade paths being gated equally.
Installation and Activation¶
This plugin is not installed via dsh plugin add github:..., but mounted in the patch layer of the Web profile. You need to obtain a copy of the repository first (the path must point to the file lib/index.js, not a directory, otherwise Node ESM will report ERR_UNSUPPORTED_DIR_IMPORT). The runtime requires Node >=20 (see package.json).
1. Mount the plugin¶
Edit the Web profile’s %USERPROFILE%\.dsh\profiles\web\cordis.patch.yml, adding:
- insert:
- id: tailnet-gateway
name: '<absolute path to this repo>/lib/index.js'
config:
upstreamPort: 3080
If the profile is configured with patchReload: live, running dsh may hot-load this line, but it is still recommended to verify the listening address with the following command rather than assuming it has taken effect:
Get-NetTCPConnection -State Listen | Where-Object { $_.LocalPort -in 3080, 7242 } |
Select-Object LocalAddress, LocalPort, OwningProcess
Both 3080 and 7242 should be 127.0.0.1, and OwningProcess should be the same dsh PID; if 0.0.0.0 appears, it should be considered abnormal.
2. Configure Tailscale Serve¶
Two browser authorizations that cannot be completed in scripts are required:
- Enable Serve for the tailnet: the first execution of
tailscale serve --bg 7242will promptServe is not enabled on your tailnetand provide an authorization link. - Enable HTTPS certificates in HTTPS Certificates at https://login.tailscale.com/admin/dns; if not enabled,
tailscale certandtailscale servewill fail for the same reason.
Then publish the gateway:
tailscale serve --bg 7242
tailscale serve status
3. Configuration options (optional)¶
| Key | Default | Meaning |
|---|---|---|
enabled |
true |
Whether to start listening |
host |
127.0.0.1 |
Binding address, clamped to loopback, non-loopback will be rejected |
port |
7242 |
Must match the port published by tailscale serve; 0 means OS assignment |
requireLogin |
true |
Whether Tailscale identity is required; when disabled, equivalent to an open loopback proxy |
allowedLogins |
[] |
Allowed Tailscale login names; empty means any account in the tailnet |
allowedPeers |
[] |
Optional device tailnet IP whitelist (consistent with tailscale status) |
upstreamPort |
3080 |
The dsh web port being proxied |
Example of further tightening:
config:
upstreamPort: 3080
allowedLogins: ['you@example.com']
allowedPeers: ['100.64.0.7']
If allowedPeers is filled incorrectly, it will lock out the tailnet entry; local 127.0.0.1:3080 is still available, but the patch needs to be modified locally.
Typical usage: authorizing mobile browser¶
First set the environment variable, then run the grant tool:
$env:DSH_TAILNET_ORIGIN = 'https://<machine>.<tailnet>.ts.net'
node grant-access.mjs
The script will print a one-time link and generate a QR code; if needed, also publish the grant route:
tailscale serve --bg --set-path=/grant http://127.0.0.1:7245
Open the link in the target device’s browser. After that, daily use with the bare origin is sufficient:
https://<machine>.<tailnet>.ts.net/
The session cookie has a default 30 days absolute validity period (not a sliding window), remains valid after dsh web restarts because the signing key is persisted. After expiration, the browser will show a 401 page again (text includes dsh web authentication required; reopen the URL printed by dsh web), server data is unaffected; simply re-run grant-access.mjs in the same device’s browser and open the new link. Optional --days 90 or --days 7 to adjust the lifetime.
To revoke all devices: stop dsh, delete the client-connection/browser-session record from %USERPROFILE%\.dsh\.credentials.yaml, then restart dsh to make the new key effective, and re-grant each device.
Verification and Operations¶
Verification commands in the repository:
node --test test/gateway.test.js # 15 unit + real-socket integration tests
node verify.mjs all # live gateway + full TLS chain
node verify.mjs cookie "<pair>" # a specific cookie authenticates dsh
The chain step of verify.mjs treats a 401 response from / as success, indicating that dsh session validation has responded, showing that the preceding chain is clear.
Operational notes:
- The dsh process must remain running; closing the terminal that started
dsh webwill take away the tailnet entry. - On Windows,
tailscale-ipn.exemust be running, otherwiseBackendState: NoStatewill cause Serve and other commands to fail. tailscale certmay leave private key files in the current directory; Serve does not depend on these copies, they can be deleted after use.
Rollback: remove the tailnet-gateway insert from cordis.patch.yml and restart dsh, then execute tailscale serve --https=443 off. The plugin does not write additional files and requires no npm package installation.
Use cases and caveats¶
Who it’s for: Those who already have a Tailscale tailnet, need to operate local DSH daily capabilities (chat, agent, files, etc.) from mobile or other private network devices, and accept that Settings/Models/Plugins etc. are unavailable in the remote browser.
Must be aware:
- The plugin runs with the same process privileges as dsh; if the gateway is directly accessed by other local processes at
127.0.0.1:7242and identity headers are forged, it may gain capabilities that dsh’s local privileged RPC would reject—the README explicitly states this does not constitute a boundary for “adversarial code already running on the machine”. - A compromised tailnet device, leaked Tailscale account, or stolen cookie within 30 days are all within the threat model;
allowedLogins/allowedPeersand Tailscale ACL are used to narrow the scope. - The documentation and examples are primarily for Windows / PowerShell; Linux users need to map
%USERPROFILE%and Tailscale client behavior themselves.
Please read the full GitHub repository (including the Troubleshooting table) and check the LICENSE (MIT) before installation.
Conclusion¶
dsh-tailnet-gateway, without altering dsh’s loopback security model, uses Tailscale identity and Serve to securely extend the Web UI to the tailnet, and uses the grant flow to solve the session problem for mobile browsers. Directory page: https://www.skillhub.cn/plugins/OutLawZhangSan-liii/dsh-tailnet-gateway; source code and full documentation: https://github.com/OutLawZhangSan-liii/dsh-tailnet-gateway.