dsh-web-login: Adding an Independent Password Gate for the DeepSeek Harness Web GUI

Preface

After self-hosting DeepSeek Harness, the Web interface is often exposed directly to the LAN or the public internet. While Harness has its own authentication and API paths, the root path / and the frontend entry point may still be accessed by scanners or accidental visitors before any additional hardening is applied. Reverse proxies and firewalls can block some traffic, but they may not cover operational habits such as “requiring a password upon first access, rate-limiting failures, and maintaining an audit trail of operations.”

This article introduces the community plugin dsh-web-login (maintained by liyang52520), listed under the admin-security category. It provides a password gate for the Harness Web GUI that is independent of Harness’s built-in processes: requests that fail verification will not enter Harness, nor will they obtain a launch token. Harness’s original authentication and /api/* endpoints remain unaffected.

What is this

dsh-web-login is a zero-dependency Cordis plugin that takes over / and /index.html. It forwards requests to Harness only after verification is successful; credentials are stored using salted scrypt hashing, and session cookies are signed with HMAC-SHA256 and bound to the host.

The current version of the plugin is 1.4.0 (see package.json in the repository), licensed under MIT, and requires Node >= 20.

Core Features

The capabilities explicitly listed in the documentation are as follows:

First-Run Setup — Set a password on the page during the first visit. This must be verified together with a one-time setup token printed when dsh starts, preventing public internet scanners from preempting the setup.

Sessions — “Remember Me” defaults to 30 days when checked; otherwise, it defaults to 12 hours. Both are configurable.

Brute-Force Protection — Locks the same real client IP for 300 seconds (default) after 5 (default) consecutive failures. The IP source is determined by configurations such as clientIpHeader.

Audit Logs — Records events such as login, password changes, lockouts, and logouts. Plaintext passwords are never logged.

Management Interface — After logging in, users can change passwords, reset passwords, or log out the local device via Harness Settings → Login Gate. The interface adapts to the Harness theme.

Boundary with Harness — The plugin does not alter Harness’s handling of /api/*. If local Agents need to bypass the gate, trustDirectLoopback must be explicitly configured, or the Cookie must be carried via /__login (see details below).

Installation and Activation

The dependency pnpm is required for installation. Since dsh does not include pnpm natively, a missing pnpm will result in a pnpm was not found error, and the profile will remain unchanged. You can install pnpm globally first, then use the official command to add the plugin to the web profile:

npm i -g pnpm
dsh plugin --profile web add git+https://github.com/liyang52520/dsh-web-login.git

The package declares dsh.bundle, so dsh will automatically register it in dsh.profile.bundles. Generally, manual configuration file edits are not needed. A dsh restart is required after modification to load the plugin. Example for systemd deployment:

systemctl restart dsh

Maintenance commands:

dsh plugin --profile web update dsh-web-login    # Upgrade
dsh plugin --profile web remove dsh-web-login    # Uninstall

DSH_HOME must be consistent with the running instance (default ~/.dsh). If the paths are inconsistent, the command may still succeed but will install to a different profile, rendering it invalid for the current process.

Typical Usage

First-Time Password Setup

A one-time token is printed in the dsh startup logs, for example:

dsh web-login: setup-token: 7rJfiimRBtBZbZZqbEY3_O6VBO3Te-bA

Under systemd, you can view it with journalctl -u dsh; for foreground runs, check the terminal; for containers, check docker logs. Open the site in a browser, enter the token, and set a password to complete the initial configuration.

Managing the Gate in Settings

After logging into Harness, navigate to Settings → Login Gate:

Action Effect
Change Password Verifies the current password before setting a new one; rotates the signing key, invalidating sessions on other devices
Reset Password Deletes the stored password; all devices must undergo the first-time setup again
Logout Clears the session only for the current device

By default, remote browsers are allowed to modify settings via password verification (unlockRemoteSettings: true). If you wish to allow settings changes only from local loopback, please review the “Settings are read-only” section in the README.

Optional Configuration

Write config in the profile’s cordis.patch.yml according to the plugin id (the entire config section will be replaced; keys not listed will retain their defaults):

- id: web-login
  config:
    title: My Harness
    rememberDays: 7

Common keys (refer to the GitHub README for the full table):

Key Default Description
enabled true If false, no routes are taken over
title "DeepSeek Harness" Page title and login page title
passwordMinLength 8 Minimum password length
rememberDays 30 Number of days for “Remember Me” sessions
sessionHours 12 Number of hours for sessions when “Remember Me” is unchecked
maxFailures 5 Number of consecutive failures triggering a lockout
lockoutSeconds 300 Lockout duration (seconds)
clientIpHeader "x-real-ip" Header to retrieve the real client IP
trustDirectLoopback false Whether to treat local loopback requests without proxy headers as verified

If local Agents need to access documentation directly without a Cookie, you can enable this after understanding the risks regarding SSH tunnels and same-machine user access:

- id: web-login
  config:
    trustDirectLoopback: true

A safer approach is to keep this option disabled and POST the password to /__login while reusing the dsh_gate Cookie.

Still getting 403 after login

This is often caused by a mismatch between Harness’s Host/Origin validation and the current access hostname. The plugin will log a hint the first time this occurs: declare --trusted-host for dsh and forward the real Host and Origin headers when behind a reverse proxy (see the README Troubleshooting section for nginx examples).

Use Cases and Notes

Who it is for — Deployers who self-host Harness, desire an extra layer of password protection for the Web entry, require failure lockouts and auditing, and prefer the management entry to be integrated within Harness settings.

Runtime and Trust — The plugin is loaded with the current dsh process and possesses the same permissions as dsh. Before installation, you should review the source code and the MIT license on GitHub to determine if it is suitable for production use.

Ecosystem Note — DeepSeek Harness adopts an “everything is a plugin” philosophy. The SkillHub plugin directory is a community site and is not officially affiliated with DeepSeek or High-Flyer. For manual installation, do not mix the bundle from dsh plugin add with a duplicate web-login insert in cordis.patch.yml, otherwise the configuration tree will fail to load.

Links

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye