Files
conversation-history/Projects/DeepSeek Harness/2026-08-23-art0-dsh-passkey-remote-access-implementation-handoff.md
T

366 lines
15 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: art0 DSH passkey-protected remote access implementation handoff
date: 2026-08-23
status: proposed
server: art0
tags:
- deepseek-harness
- dsh
- art0
- passkeys
- pocket-id
- oauth2-proxy
- traefik
- kubernetes
- security
---
# art0 DSH passkey-protected remote access implementation handoff
## Objective
Make the DeepSeek Harness Web UI on `art0` reachable securely from a browser outside the local network, protected by a real login and passkey authentication.
The deployment must preserve DSH's loopback-only posture, protect HTTP APIs and WebSocket streams, fit the existing Traefik-to-Kubernetes architecture, survive reboots, and avoid exposing model-provider credentials.
No remote-access implementation was deployed during the investigation documented here.
## Recommended design
Use Pocket ID as a passkey-only OpenID Connect identity provider and OAuth2 Proxy as the authenticated reverse proxy in front of DSH.
```text
Browser
|
| HTTPS
v
Traefik on art0
|
| Host: dsh.fetcherpay.com
v
K8s ClusterIP: dsh-access
|
v
OAuth2 Proxy pod (hostNetwork: true)
| \
| authenticated request \ OIDC redirect
v v
127.0.0.1:3080 Pocket ID
DeepSeek Harness auth.fetcherpay.com
```
Recommended public names:
- `dsh.fetcherpay.com` — protected DSH application
- `auth.fetcherpay.com` — Pocket ID login and passkey enrollment
Pocket ID is a small, passkey-only OIDC provider. OAuth2 Proxy supports generic OIDC discovery and authenticated WebSocket proxying, both of which are required for the DSH browser transport.
## Why this design fits art0
- Traefik already owns public ports 80 and 443.
- Public routing remains in `/home/garfield/letsencrypt/manual/tls.yml`.
- Traefik will route to a Kubernetes Service ClusterIP, not a Docker container IP.
- DSH remains bound to `127.0.0.1:3080` and is never directly exposed.
- A `hostNetwork: true` access-proxy pod can reach the host's loopback DSH listener.
- Pocket ID can run as a normal Kubernetes workload with persistent storage.
- OAuth2 Proxy handles HTTP requests, cookies, OIDC redirects, authorization, and WebSocket upgrades.
Do not enable the Traefik Docker provider as part of this work.
## Current state observed on 2026-08-23
| Item | Current state |
|---|---|
| DSH version | `0.1.1-rc.2` |
| DSH source checkout | `/home/garfield/IdeaProjects/deepseek-harness` |
| DSH launcher | `/home/garfield/.npm-global/bin/dsh` |
| DSH listener | `127.0.0.1:3080` |
| Observed command | `dsh web --no-open` |
| Observed PID | `678037` |
| Process start | 2026-08-21 18:02 EDT |
| Process supervision | None; parented by a Codex app-server process |
| User systemd | Available and running |
| User lingering | Enabled for `garfield` |
| Public DSH route | None |
| Authentication service | None found in Docker or MicroK8s |
| `dsh.fetcherpay.com` DNS | No A record found |
| `auth.fetcherpay.com` DNS | No A record found |
| DNS provider | GoDaddy nameservers (`ns65.domaincontrol.com`, `ns66.domaincontrol.com`) |
| art0 public address | `104.190.60.129` |
| Available memory | Approximately 28 GiB at investigation time |
The model-provider configuration is documented separately in [[2026-08-23-art0-dsh-model-providers-routing-and-credentials]]. Do not copy API keys into this note, Kubernetes manifests, Git, shell history, or Traefik configuration.
## Critical DSH security boundary
DSH's `--trusted-host` setting is not authentication. It is a Host/Origin and DNS-rebinding fence.
The DSH CLI intentionally refuses a normal `--host 0.0.0.0` launch because the Web UI exposes an agent control plane capable of running shell commands, reading and editing files, and spending configured provider credentials.
The browser transport uses:
- HTTP POST requests under `/api`
- WebSocket downlinks at `/api/events.mux` and `/api/events.host`
- Web UI assets and plugin bundles
Authentication must protect all of these paths. Protecting only the HTML landing page is insufficient.
### Privileged API limitation
Even when `dsh.fetcherpay.com` is supplied through `--trusted-host`, current DSH source pins several methods to a loopback Host authority:
- settings read/write operations
- credential description and mutation
- model discovery using draft credentials
- agent-preset authoring operations
- native directory/path actions
Ordinary model selection, session creation, prompts, tools, shell execution, filesystem work, and WebSocket event delivery can be made available through a trusted public authority. The privileged configuration plane remains blocked unless a real DSH-side authentication bridge presents the authenticated request to the core in a loopback-trusted form.
This creates two valid implementation levels.
## Implementation level 1: protected remote agent access
Recommended first release.
Capabilities:
- Passkey-only login
- Protected Web UI, plugin bundles, APIs, and WebSockets
- Create and use DSH sessions remotely
- Use configured models and agent tools
- DSH remains loopback-only
- Provider settings and credentials continue to be managed through SSH/local access
Advantages:
- No custom DSH security plugin
- Smaller attack surface
- Easier to validate and maintain while DSH is in developer preview
- Estimated implementation and testing time: 2–4 hours after DNS is available
## Implementation level 2: full remote Settings support
Add only after level 1 is stable.
This requires a small, auditable DSH-side authentication bridge that:
1. Accepts an identity assertion only from the local OAuth2 Proxy connection.
2. Authenticates the assertion cryptographically or with a high-entropy shared secret.
3. Fails closed when the expected DSH route structure changes.
4. Protects HTTP, plugin assets, APIs, and WebSocket upgrades.
5. Presents already-authenticated privileged RPC calls to the DSH core using its loopback authority path.
6. Never accepts client-supplied forwarded identity headers directly from the Internet.
The community `dsh-webui-auth` plugin demonstrates runtime route gating and authenticated loopback-shaped dispatch. It currently implements password authentication, not passkeys. Treat it as a design reference requiring source review and a pinned commit, not as a package to install blindly.
Estimated implementation and testing time for levels 1 and 2 together: 4–8 hours. Allow more time if a clean upstream-compatible plugin must be written and tested from scratch.
## Required implementation work
### 1. DNS
Create the following GoDaddy A records:
| Name | Type | Value |
|---|---|---|
| `dsh.fetcherpay.com` | A | `104.190.60.129` |
| `auth.fetcherpay.com` | A | `104.190.60.129` |
Confirm both names resolve before requesting certificates.
### 2. Pocket ID
Deploy Pocket ID in MicroK8s with:
- Namespace consistent with the existing infrastructure policy, preferably `fetcherpay`
- ClusterIP Service
- PersistentVolumeClaim for its database and uploaded data
- `APP_URL=https://auth.fetcherpay.com`
- Encryption key supplied from a Kubernetes Secret or mounted secret file
- `ALLOW_INSECURE_CALLBACK_URLS=false`
- A narrowly scoped `TRUST_PROXY` value for the direct Traefik/proxy source
- Readiness and liveness probes
- Resource requests and limits
- A documented backup and restore procedure
Create the administrator only after HTTPS is working. Enroll at least two passkeys:
- Primary synced or platform passkey
- Recovery passkey, preferably a separate hardware security key
Do not rely on a single phone or laptop as the only authenticator.
### 3. Pocket ID OIDC client
Create a dedicated OIDC client for DSH access:
- Redirect URI: `https://dsh.fetcherpay.com/oauth2/callback`
- Scopes: `openid profile email`
- PKCE: S256
- Exact redirect URI matching
- No insecure callback URLs
Store the OIDC client secret in a Kubernetes Secret, not in a checked-in manifest.
### 4. OAuth2 Proxy
Deploy OAuth2 Proxy with:
- Generic OIDC provider
- Issuer URL `https://auth.fetcherpay.com`
- Upstream `http://127.0.0.1:3080`
- `hostNetwork: true`
- A non-conflicting local listen port
- WebSocket proxying enabled
- Reverse-proxy mode enabled
- Trusted proxy CIDRs set explicitly
- Secure, HttpOnly cookies
- A narrow cookie domain scoped to `dsh.fetcherpay.com`
- PKCE S256
- A specific email, subject, or group allowlist
- No IP-based authentication bypass
- Authentication required for every DSH route except OAuth2 Proxy's own callback and health endpoints
- A random cookie secret stored in a Kubernetes Secret
- Readiness and liveness probes
- Resource requests and limits
The Kubernetes Service for this pod should be ClusterIP. Traefik should route only to that Service.
### 5. Persistent DSH service
Replace the current ad hoc process with a systemd user service for `garfield`.
The unit should:
- Use `/home/garfield/IdeaProjects/deepseek-harness` as the working directory
- Start `/home/garfield/.npm-global/bin/dsh web --no-open --trusted-host dsh.fetcherpay.com`
- Preserve the existing `DSH_HOME` behavior
- Restart on failure with bounded backoff
- Send logs to journald or the existing protected DSH log
- Load credentials without placing secret values in the unit file or command line
- Set a conservative umask
User lingering is already enabled, so the service can survive logout and start at boot.
Before switching processes, confirm no active DSH session will be interrupted unexpectedly.
### 6. Traefik routing
Update `/home/garfield/letsencrypt/manual/tls.yml` with two HTTPS routers:
- `dsh.fetcherpay.com` to the OAuth2 Proxy ClusterIP Service
- `auth.fetcherpay.com` to the Pocket ID ClusterIP Service
Requirements:
- Use the existing certificate resolver pattern
- Route to Kubernetes Service ClusterIPs
- Preserve `Host`, `X-Forwarded-Proto`, `X-Forwarded-Host`, and client-address forwarding correctly
- Support WebSocket upgrades
- Add appropriate security headers without breaking Pocket ID WebAuthn or DSH WebSockets
- Do not add API keys, OIDC client secrets, cookie secrets, or encryption keys to `tls.yml`
Validate the Traefik dynamic configuration before and after the change.
### 7. Optional DSH authentication bridge
Required only for implementation level 2.
Before installation:
- Audit every dependency and installation script
- Pin the exact package version or Git commit
- Confirm fail-closed behavior if route wrapping fails
- Confirm identity headers are ignored unless the socket peer is the local proxy
- Confirm logout or session revocation closes or invalidates WebSocket access
- Test against the installed DSH version, not only the latest upstream branch
- Document the upgrade test required before every DSH version change
## Acceptance tests
### Network exposure
- `127.0.0.1:3080` remains the only DSH listener.
- Port 3080 is unreachable from an external machine.
- Traefik is the only public entry point.
- The public route targets a K8s ClusterIP.
### Authentication
- An unauthenticated request to `/` redirects to login.
- Unauthenticated assets and plugin bundles cannot be loaded.
- Unauthenticated `/api` requests return 401/403 and never reach DSH.
- Unauthenticated WebSocket handshakes are rejected.
- A registered passkey completes login successfully.
- An unknown Pocket ID user cannot access DSH.
- Logout invalidates subsequent HTTP calls and WebSocket reconnects.
- Expired sessions require a new passkey authentication.
### DSH behavior
- The workspace list loads.
- A session can be created.
- Each configured model vendor can be selected.
- A prompt streams to completion.
- Tool approvals and results appear over the WebSocket connection.
- Refresh and browser reconnection recover correctly.
- Level 1: privileged settings calls remain blocked and are managed locally.
- Level 2: settings and credential operations work only after authentication.
### Resilience
- DSH restarts automatically after a forced process failure.
- DSH, Pocket ID, and OAuth2 Proxy return after an `art0` reboot.
- Pocket ID data survives pod replacement.
- A tested backup can restore Pocket ID identity and OIDC configuration.
- Traefik fails closed when OAuth2 Proxy or Pocket ID is unavailable.
### Browser/device coverage
- Desktop Chrome or Safari
- Mobile browser over cellular data
- Incognito/private window
- At least two separately stored passkeys
## Rollback plan
Rollback should not require exposing DSH directly.
1. Remove or disable the two Traefik routers.
2. Confirm the public hostnames no longer reach DSH or Pocket ID.
3. Keep DSH on `127.0.0.1:3080` for SSH-port-forwarded/local use.
4. Stop the OAuth2 Proxy and Pocket ID workloads if necessary.
5. Preserve Pocket ID persistent data and secrets for diagnosis unless compromise is suspected.
6. If a DSH bridge was installed, remove it from the Web profile and restart DSH using the last known-good pinned profile.
Do not roll back by binding DSH to `0.0.0.0` or forwarding port 3080 publicly.
## Operational cautions
- Treat public access to DSH as access to a remote shell. A DSH session can run commands, alter files, and consume paid model APIs.
- DSH is in developer preview and may change internal Web routes without compatibility guarantees.
- Pin versions for Pocket ID, OAuth2 Proxy, and any DSH authentication bridge.
- Review authentication after every DSH upgrade before restoring the public route.
- Back up Pocket ID data and retain a second passkey before depending on it for access.
- Never put provider API keys into documentation, Git, Kubernetes ConfigMaps, Traefik files, or command-line flags.
## Source references
- [DeepSeek Harness repository and developer-preview warning](https://github.com/deepseek-ai/deepseek-harness)
- [DSH CLI Web and trusted-host reference](https://github.com/deepseek-ai/deepseek-harness/blob/master/apps/cli/reference/README.md)
- [Pocket ID introduction](https://pocket-id.org/docs/introduction)
- [Pocket ID installation](https://pocket-id.org/docs/setup/installation)
- [Pocket ID environment variables](https://pocket-id.org/docs/configuration/environment-variables)
- [Pocket ID user and passkey management](https://pocket-id.org/docs/setup/user-management)
- [OAuth2 Proxy configuration](https://oauth2-proxy.github.io/oauth2-proxy/configuration/overview/)
- [OAuth2 Proxy endpoints](https://oauth2-proxy.github.io/oauth2-proxy/features/endpoints/)
- [Community dsh-webui-auth reference implementation](https://github.com/Yuuz12/dsh-webui-auth)
## Recommended handoff decision
Proceed with implementation level 1 using `dsh.fetcherpay.com` and `auth.fetcherpay.com`. Validate passkey login, DSH sessions, WebSockets, reboot behavior, and external network isolation. Keep settings and provider credentials local initially.
After level 1 has operated successfully, separately review and approve the DSH authentication bridge required for full remote Settings support.