dsh-auth-ldap: Local Account and LDAP Authentication Gateway for the DSH Web Dashboard

Introduction

The DeepSeek Harness (DSH) Web dashboard does not provide a native login feature. It only supports OAuth login (for billing and quota) and a host-authority-based launch token exchange for process startup. There is no support for multi-user, groups, LDAP, SAML, RBAC, or similar capabilities. Existing community login gateways can only validate passwords stored in local files and cannot integrate with directory services.

dsh-auth-ldap is a plugin that provides a unified login entry point for the DSH Web dashboard: a single login page that supports both local accounts (scrypt records stored in a JSON file) and LDAP/Active Directory accounts, with a single configuration to integrate both.

Plugin Overview

  • Name: dsh-auth-ldap
  • Maintainer: farfoodyou
  • Category: admin-security
  • Status: developer preview
  • Current version: 0.3.2
  • License: MIT

The plugin is declared via dsh.bundle.patch and is automatically inserted into the configuration by dsh plugin add, with no need to manually edit the profile configuration file.

Core Capabilities

Dual-Backend Authentication

  • Local accounts: scrypt password records stored in a YAML file; enabled as an optional backend.
  • LDAP/Active Directory: uses a search-then-bind pattern, supports LDAPS or STARTTLS, and supports mapping directory groups to roles.

Session Management

  • Server-side session table persisted to disk; a restart will not log out all users.
  • Session cookies are signed, HttpOnly, SameSite=Lax, with TTL expiry and revocation support.

Security Policies

  • Login rate limiting: 5 failed attempts per request causes the client address to cool down for 5 minutes; 20 failed attempts per account further reduces the attempt frequency.
  • Correct passwords are never rejected (there is no “account quota” that could lock out operators).
  • Error responses do not reveal whether an account exists.

Operational Capabilities

  • Audit logging: decisions are recorded to <storage.dir>/audit.log (account, address, backend, failure reason).
  • Observe mode: logs decisions without rejecting requests; useful for gradual rollout.
  • Status endpoint: /auth-ldap/status provides deployment status queries without exposing secrets.

Access Control

  • The login page and /api transport are both protected by the gateway; /api retains an independent host fence.
  • The launch token remains available as an “emergency access” mechanism, so operators are not locked out even if the local account file is lost.

Monitoring & Testing

  • A /auth-ldap/status endpoint is provided for smoke testing and monitoring.

Installation & Enablement

Prerequisites

  • Node.js >= 22.19.0
  • DSH >= 0.2.2-rc.1
  • An accessible LDAP v3 directory (OpenLDAP, LLDAP, 389 DS, Active Directory) with LDAPS or STARTTLS support
  • pnpm 12 for development (locked via the packageManager field)

Installation Commands

From the npm registry (after plugin publication):

pnpm dlx @deepseek-ai/dsh plugin --profile web add dsh-auth-ldap

From a git repository:

pnpm dlx @deepseek-ai/dsh plugin --profile web add github:farfoodyou/dsh-auth-ldap

If dsh is already on PATH, you can omit the pnpm dlx @deepseek-ai/dsh prefix and invoke directly:

dsh plugin --profile web add github:farfoodyou/dsh-auth-ldap

The plugin declares dsh.bundle.patch, so during installation the plugin line is automatically inserted into the profile configuration.

Configuration Example

Edit the profile’s user layer (e.g., $DSH_HOME/profiles/web/cordis.patch.yml):

- id: dsh-auth-ldap
  config:
    mode: gate
    local:
      enabled: true
      usersFile: /var/lib/dsh/users.yaml
    ldap:
      enabled: true
      url: ldaps://dc1.corp.example.com:636
      userSearchBase: ou=people,dc=corp,dc=example,dc=com
      userSearchFilter: (sAMAccountName={{username}})
      bindDn: uid=svc-dsh,ou=service,dc=corp,dc=example,dc=com
      bindPasswordEnv: DSH_LDAP_BIND_PASSWORD
      groupSearchBase: ou=groups,dc=corp,dc=example,dc=com
      groupSearchFilter: (member={{dn}})
      adminGroups: [dsh-admins]

Restart the profile after modifying the configuration:

dsh web

Verify the deployment status:

curl -s http://127.0.0.1:3080/auth-ldap/status

Usage

After starting the profile, DSH will print the Web access URL (including the launch token):

dsh web

In the browser:

  1. The printed URL (with ?token=...) can still be used as an “emergency access” credential.
  2. Unauthenticated requests are redirected to the login page.
  3. Log in using a local account or a directory account.
  4. After successful login, the session cookie and the launch token cookie coexist; either one is sufficient to access the GUI.

Operations Commands

curl -s http://127.0.0.1:3080/auth-ldap/status          # View deployment status (no secrets included)
dsh plugin --profile web remove dsh-auth-ldap           # Uninstall the plugin

Use Cases & Considerations

This plugin is suitable for DSH self-hosted deployments that require a unified login entry point and enterprise directory service integration, particularly for multi-user collaboration and group-based permission management scenarios.

Notes:
- The plugin runs with the privileges of the DSH process. Review the source code and license before deploying.
- Currently in developer preview. M1 (gateway + local accounts) and M2 (directory backend) are implemented; directory login requires filling in parameters per docs/ldap-integration.md.

Summary

dsh-auth-ldap provides an auditable, revocable authentication gateway for the DSH Web dashboard, unifying local accounts and LDAP/AD into a single login page while retaining the launch token as an emergency exit. Through server-side session management and rate-limiting policies, it enhances security without locking out operators. For enterprise deployments requiring multi-user collaboration, this is a practical security patch solution.

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

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

Xiaoye