dsh-auth-gate
DSH Web UI 的认证门禁插件,提供 SVG 图形验证码与防暴力破解保护
AI 분석
核心用途是为 DSH Web 界面添加安全访问控制。适合将 DSH 部署在公网或多用户共享环境、需要防止未经授权访问和暴力破解的用户。
설치
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:jiang539/dsh-auth-gate或手动生成(⚠️ 明文会出现在 shell 历史与进程列表中,仅限一次性使用):
node -e "console.log(require('bcryptjs').hashSync('你的密码', 10))" > ~/.dsh/auth.passwd
配置
所有选项都在插件条目的 config 中设置(可在 profile 的 cordis.patch.yml 或
--patch 覆盖层中修改):
| Key | 默认值 | 说明 |
|---|---|---|
passwordFile | ~/.dsh/auth.passwd | 密码文件路径(~ 展开为操作系统用户主目录) |
sessionTimeout | 3600 | 会话有效期(秒),滑动窗口续期 |
captchaExpires | 300 | 验证码有效期(秒) |
maxLoginAttempts | 5 | 同一 IP 连续失败多少次后锁定 |
blockDuration | 300 | 锁定持续时长(秒) |
trustProxy | false | 是否信任 X-Forwarded-For(仅当 Nginx 与 DSH 同机、直接对端为回环地址时生效;取代理追加的最后一项) |
devCaptchaText | false | 仅限开发 — 在 /auth/captcha 中回显验证码答案,便于 curl 调试;生产环境切勿开启 |
profile 覆盖示例: