runfali/dsh-login-gateway 预览 preview

runfali/dsh-login-gateway

DeepSeek Harness(dsh)的登录门卫插件。dsh 的 Web UI 默认只监听 127.0.0.1:3080,禁止外部访问;本插件在外部再开一个入口(默认 0.0.0.0:3081),访问者先通过用户名密码登录,登录成功后流量被全量反向代理到 dsh 的 Web UI(HTTP 与 WebSocket 都支持),功能零缺失。

catalog descriptioncatalog 简介 / catalog description:dsh 登录门卫插件:让只监听本机的 dsh Web UI 安全地对外开放——登录墙 + 全量反代,零依赖、零侵入。

Project Overview项目介绍

This is a native login gateway plugin built exclusively for DeepSeek Harness (DSH). By default, DSH’s web UI only listens on 127.0.0.1:3080, which blocks any external network access to the user interface. This plugin adds a separate external entry point that defaults to 0.0.0.0:3081, requires all visitors to authenticate with a username and password, and reverse proxies all authenticated traffic to DSH’s original local web UI. It supports both HTTP and WebSocket connections fully, so all original DSH features work exactly as they would with a direct local connection.

This plugin is designed for users who need to access their locally hosted DSH instance from a local area network or the public internet, without exposing DSH directly to unauthenticated external networks. If you modify DSH’s default configuration to listen on 0.0.0.0, DSH becomes openly accessible to anyone on the network, which creates a major unregulated security risk. This plugin keeps DSH’s original loopback-only configuration fully in place, adding an authentication layer that only allows logged-in users to access DSH, balancing remote accessibility and strong access security.

This plugin has no third-party runtime dependencies, relying only on built-in Node.js modules, and requires Node.js version 22 or higher to run properly. It is distributed under the open-source MIT license, and installed using the standard DSH plugin command dsh plugin add, which only requires a local path to the downloaded plugin directory. After installation completes, you just need to restart DSH for the plugin to take full effect. Users can customize configuration options like listen port, session expiration, and login attempt limits, and the plugin can be fully removed with a single DSH uninstall command.

这是一款专为DeepSeek Harness(DSH)开发的原生登录门卫插件。DSH默认的Web UI仅监听127.0.0.1:3080,禁止外部网络访问,本插件额外开放一个外部访问入口(默认0.0.0.0:3081),要求访问者通过用户名密码登录校验,登录成功后将全量请求反向代理到原DSH Web UI,同时支持HTTP与WebSocket连接,完整保留所有原有功能。

该插件主要解决用户需要从局域网或公网访问本地部署的DSH,但不希望直接将DSH暴露在公网的需求。如果直接修改DSH配置让它监听0.0.0.0,会导致DSH直接裸奔在公网,任何人均可访问,本插件在保留DSH原有本地监听配置的基础上,额外添加了登录校验安全墙,满足外部访问需求的同时保障访问安全。

本插件零第三方运行时依赖,仅使用Node.js内置模块,要求Node 22+版本,遵循MIT开源许可证。安装方式遵循DSH标准插件流程,通过dsh plugin add命令即可完成安装,安装后重启DSH即可生效,支持自定义端口、会话有效期、登录重试次数等配置,卸载仅需一条命令即可完全移除。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 5 stars - very few users, little community feedback星标只有 5,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:runfali/dsh-login-gateway

把 runfali/dsh-login-gateway 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-login-gateway

DeepSeek Harness(dsh)的登录门卫插件。dsh 的 Web UI 默认只监听 127.0.0.1:3080,禁止外部访问;本插件在外部再开一个入口(默认 0.0.0.0:3081),访问者先通过用户名密码登录,登录成功后流量被全量反向代理到 dsh 的 Web UI(HTTP 与 WebSocket 都支持),功能零缺失。

零运行时依赖(只用 Node.js 内置模块),Node 22+ ESM。


它解决什么问题

  • 想从局域网/公网访问本机 dsh,但 dsh 只监听 loopback;
  • 直接改 dsh 让它监听 0.0.0.0 会裸奔在公网上,任何人可访问;
  • 本插件提供:外部入口 + 登录墙 + 全量反代,dsh 本身继续只听 127.0.0.1。

效果预览

首次访问未初始化时,会进入 /setup 引导页,输入一次性令牌并创建管理员账号:

首次访问初始化页面

工作架构

浏览器 ──HTTP/WS──▶ 0.0.0.0:3081(门卫:登录校验 + 会话 Cookie)
                         │ 通过校验后全量反代(改写 Host/Origin/Sec-Fetch-Site 为 loopback 形态)
                         ▼
                    127.0.0.1:3080(dsh Web UI,信任围栏放行,特权 API 全可用)

关键点:反代时把请求头里的 Host/Origin/Sec-Fetch-Site 改写为 loopback 形态,让 dsh 把请求当作"本机请求"信任放行;WebSocket 升级请求同样先校验会话再转发。

dsh 0.1.2-alpha.1 起 dsh 在信任围栏之外又加了一层「浏览器鉴权」:首页与全部 /api(含 WS 升级)必须携带宿主签发的 dsh-auth-* 会话 Cookie,而该 Cookie 只能由启动令牌(打印在服务器终端的 dsh web: …/?token=… URL 里)换取。浏览器只见过门卫地址,永远拿不到这个令牌——所以由门卫在「已登录用户的首页导航」上代跑一次令牌交换:

  • 令牌只出现在门卫 → dsh 这一跳的请求行上,不进入任何下发给浏览器的内容;
  • dsh 回 303 + Set-Cookie,门卫原样透传,浏览器保存后 /api 与 WS 自然带上;
  • Cookie 名按 dsh-auth- + base64url(sha256(authority)) 反推(authority 即门卫改写后的 Host),据此判断是否需要交换,避免每次导航都重复走 303;
  • 自愈:浏览器带着已失效的 dsh-auth-*(密钥轮换、过期残留)时,门卫收到宿主的 401 会剥掉坏 Cookie 重跑一次交换,远端用户不必手动清 Cookie;
  • 登出门卫时一并吊销该 Cookie(属性与 dsh 签发的那份逐字对齐,否则浏览器删不掉)。

对 dsh ≤ 0.1.1 的宿主,connection 服务没有 authenticatedUrl,上述逻辑整体跳过,行为与旧版一致。

快速开始(首次安装)

  1. 用 dsh 标准插件命令安装(本项目是标准 dsh.bundle 插件,无需手改 profile 配置):

    # 本地目录安装(link 形式,profile 直接引用本目录,改源码无需重装)
    dsh plugin --profile web add /path/to/dsh-login-gateway
    
    # 卸载
    dsh plugin --profile web remove dsh-login-gateway
    

    安装/卸载后重启 dsh 生效。

  2. 获取一次性初始化令牌(二选一):

    • 方式 A:看 dsh 启动终端或服务日志输出

      插件会直接输出一行提示,内容类似:

      [login-gateway] 登录门卫未初始化,请访问 http://<主机>:3081/setup 并输入一次性令牌:ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ12-3456
      

      日志示例:

      初始化令牌日志输出

    • 方式 B:读取令牌文件

      令牌同时会写入用户文件同目录下的 setup-token.txt(权限 0600,内容只有令牌本身):

      cat ~/.dsh-login-gateway/setup-token.txt
      

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-locale-ja 下一个 Next dsh-alphasolve →