ravenli059/dsh-login0

dsh-login

Password gate for dsh-web: opening the web port requires a username/password login; account credentials are stored salted+scrypt-hashed and AES-256-GCM encrypted in a local config file under $DSH_HOME. Host-only cordis plugin, no dsh source changes.

包名
dsh-login
版本
0.1.0
许可证
MIT
最近更新
2026年8月18日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:ravenli059/dsh-login

首次使用(二选一)

A. 网页引导(默认):打开端口 → “创建管理员账号” → 设置用户名密码 → 自动登录。

B. CLI(适合禁掉网页引导)


## 配置

在 profile 的用户层给插件行加配置(`dsh plugin --profile web add` 后会自动把
`dsh-login` 行插入组合;改配置就编辑 `~/.dsh/profiles/web/cordis.patch.yml` 的
`- insert:` 里那行 `dsh-login`,或直接读插件的 `cordis.patch.yml`):

```yaml
- id: dsh-login
  config:
    sessionTtlHours: 12        # 会话有效期(小时),默认 24
    bootstrap: denied          # 禁止网页自助建号,只用 CLI 管账号
    maxAttempts: 10            # 爆破限速:10 次/30s
    cookieName: dsh_session
    loginPath: /login
    logoutPath: /logout
    storePollMs: 2000          # 检测 CLI 改账号的轮询间隔(0=关闭)

全部配置项(均带默认值):enabled(true)、storeFile($DSH_HOME/dsh-login.json)、 keyFile($DSH_HOME/dsh-login.key)、sessionTtlHours(24)、cookieNamebootstrap(auto|denied)、maxAttempts(5)、attemptWindowMs(30000)、 failDelayMs(400)、storePollMs(2000)、loginPath(/login)、logoutPath(/logout)。

主密钥优先级:环境变量 DSH_LOGIN_SECRET(64位 hex 原样使用;任意长口令则 scrypt 派生)→ 密钥文件(不存在则自动生成 64 hex,0600)→ 无密钥时降级明文 JSON(仍 scrypt 哈希,插件会打警告)。