前言¶
DSH 的插件模式把 Web 服务能力拆成可组合的 bundle。如果你的 DSH 部署需要给 Web 服务增加认证,又不希望只依赖浏览器原生认证弹窗,也不牺牲 curl、CLI 工具和自动化 API 客户端的访问方式,下面介绍 dsh-plugin-auth-webserver。
这个插件是 DeepSeek Harness(DSH)的原生 Web 认证 bundle。它提供 DSH-themed web login page、HMAC cookie sessions and logout、Web GUI settings card、dual-mode authentication and WebSocket protection、HTTP Basic Auth fallback、remote IP privileged RPC trust delegation、Web Crypto UUID auto-polyfill,并支持 English 和 Simplified Chinese。
这是什么¶
- 插件名:
dsh-plugin-auth-webserver - 定位:DSH 的原生 Web 认证 bundle
- GitHub 仓库:
https://github.com/kolawong/dsh-plugin-auth-webserver - 许可证:MIT © 2026 kola
核心功能¶
下面列出的能力来自插件的已核实描述:
DSH-themed web login page:提供 DSH 风格的 Web 登录页。HMAC cookie sessions and logout:使用 HMAC cookie 维持会话,并支持登出。Web GUI settings card:在 DSH Web GUI 中提供设置卡片。Dual-mode authentication and WebSocket protection:提供双模式认证,并覆盖 WebSocket 保护。HTTP Basic Auth fallback for CLI tools, curl, and automated API clients:为 CLI 工具、curl和自动化 API 客户端保留 HTTP Basic Auth 回退。Remote IP privileged RPC trust delegation:支持远程 IP privileged RPC trust delegation。Web Crypto UUID auto-polyfill:提供 Web Crypto UUID auto-polyfill。English and Simplified Chinese:支持英文和简体中文。
安装与启用¶
使用 git-host 方式安装时,可以指定 commit:
dsh plugin --profile web add github:kolawong/dsh-plugin-auth-webserver#<commit-sha>
这里的 <commit-sha> 替换为你要安装的具体提交号。
安装完成后,启动 web profile:
dsh --profile web
然后打开:
http://your-server-ip:3080
即可看到登录页。
配置¶
可以通过 profile 自己的 patch 覆盖 webserver-auth 行。文件路径为:
$DSH_HOME/profiles/web/cordis.patch.yml
需要覆盖的字段包括:
- id: webserver-auth
config:
host: <host>
port: <port>
username: <username>
password: <password>
其中 password 的默认值是 '';留空会禁用认证。
如果在 Web GUI 的设置卡片中修改配置,状态会保存到:
$DSH_HOME/plugins/dsh-plugin-auth-webserver/state.json
该文件权限为 0600。
环境变量 DSH_AUTH_USER 和 DSH_AUTH_PASS 会同时覆盖配置文件和已保存状态。
API endpoints¶
插件提供以下接口:
POST /api/auth.login
POST /api/auth.logout
GET /api/auth.get
POST /api/auth.update
适用场景与注意¶
适合这类使用方式:
- 给 DSH Web 服务增加 Web 登录页。
- 使用 HMAC cookie 会话和登出能力。
- 通过 Web GUI 设置卡片管理认证配置。
- 让 Web 表单、cookie 会话与 HTTP Basic Auth 共存。
- 为 CLI 工具、
curl和自动化 API 客户端保留 Basic Auth 回退。 - 需要 WebSocket protection。
- 需要 remote IP privileged RPC trust delegation。
- 需要 Web Crypto UUID auto-polyfill。
- 需要英文和简体中文界面。
使用注意:
- 插件会以当前
dsh进程权限运行。 - 安装前应检查源码和许可证。
- 该插件依赖以下 peer dependencies:
@deepseek-ai/cordis >=4.0.0
@deepseek-ai/schemastery >=3.0.0
结尾¶
dsh-plugin-auth-webserver 的价值在于把 DSH Web 服务的认证能力拆成一个独立 bundle:Web 登录页、cookie 会话、Web GUI 设置、Basic Auth 回退、WebSocket 保护、远程 IP RPC trust delegation 和 Web Crypto polyfill 放在同一个插件里提供。
GitHub 仓库:
https://github.com/kolawong/dsh-plugin-auth-webserver