P7 Private Network lane: product spec (Tailscale v1 + WireGuard self-hosted) + backlog tickets DC-140..DC-152
This commit is contained in:
2 files changed
+313
No files matched your search
+121
@@ -433,3 +433,124 @@ Tickets DC-046 through DC-049 implement pluggable auth + email magic link. Sami
|
||||
- **prerequisite:** None. `caddy-upstream-watcher.js` already provides equivalent monitoring.
|
||||
- **result:** Shipped GLM-pending (Codex quota dead). Before/after on DNS2 (`journalctl -u caddy --since "5 minutes ago" | grep health_checker.active | wc -l`): **before = ~30 entries / 5min** (active probe every 10s, all failing); **after = 0 entries / 5min**. Live-verified: `caddy validate` succeeded (after removing `.bak` file that caused `ambiguous site definition`), Caddy reloaded via `caddy-apply`, route `arch.sami → 100.120.159.34:5000` still active in admin API (verified via `curl http://localhost:2019/config/apps/http/servers/srv0/routes` — `health_uri: None, health_interval: None` confirms the block is gone). Container `dashcaddy-api Up About an hour (healthy)` (no restart needed — only Caddyfile changed, not container). Live HTTP smoke all green: `https://status.sami=200`, `https://dashcaddy.net=200`, `https://ca.sami=200`, `https://status.sami/api/health=401` (auth-gated, expected). Watcher state for `100.120.159.34:5000`: `consecutiveFailures: 1905`, `lastError: "probe timeout"`, `status: down`, `dead: true` — correctly tracked in `/opt/dashcaddy/dashcaddy-api/data/caddy-upstreams.json`. Backup deleted (would have caused site-definition ambiguity on next Caddy reload). Git: change lives only in DNS2's `/etc/caddy/sites/arch.sami` (the `/etc/caddy` git repo `.gitignore` excludes `sites/` per design — only the main `Caddyfile` is tracked). The dashcaddy source repo (`/root/dashcaddy`) carries only this BACKLOG.md documentation update on branch `dc/DC-084-arch-sami-caddy-healthcheck-removal`.
|
||||
- **Tests:** No source code change; existing `__tests__/caddy-upstream-watcher.test.js` 26/26 pass (baseline preserved). 2465/2465 repo tests pass (4 pre-existing billing test suites fail with `Cannot find module pdfkit` — unrelated to this change).
|
||||
# P7 — Private Network lane (DC-140 … DC-152)
|
||||
|
||||
> Spec: `specs/PRIVATE-NETWORK-SPEC.md`. Parent feature: DashCaddy Private Network
|
||||
> (Tailscale mode v1 + WireGuard self-hosted mode). Ordered by dependency, not by
|
||||
> value. All commits judge-gated (min B).
|
||||
|
||||
### DC-140: Network provider abstraction (`src/network/`)
|
||||
- **status:** todo
|
||||
- **owner:** (fleet)
|
||||
- **details:** `provider.js` (contract + JSDoc), `registry.js` (active provider +
|
||||
capabilities), `errors.js` (ProviderError with code/retryable). No feature code
|
||||
may import a provider directly — registry only. Provider contract methods:
|
||||
getStatus, listDevices, listPeople, createInvite, revokeInvite, blockPerson,
|
||||
unblockPerson, removePerson, revokeDevice, syncAccess, whois, configureDns.
|
||||
Tailscale provider wraps existing tailscale-coord.js + tailscale-manager.js.
|
||||
Registry defaults to inactive until the wizard connects one. Tests: registry
|
||||
resolution, capability flags, error mapping. Files: `src/network/*.js`,
|
||||
`__tests__/network-registry.test.js`, `__tests__/network-provider-tailscale.test.js`.
|
||||
|
||||
### DC-141: People store + routes (`routes/network-people.js`)
|
||||
- **status:** todo
|
||||
- **details:** people.json atomic store (invite-store pattern), CRUD routes under
|
||||
`/api/v1/network/people`, admin-protection (`protectedAt`), last-admin guard
|
||||
`assertNotLastAdmin()` exported for reuse. Sync endpoint merging provider users
|
||||
into people. Tests: store CRUD, route contract, guard (cannot block/remove
|
||||
last admin), sync merge idempotency.
|
||||
|
||||
### DC-142: Tailscale invites (link-first) via provider
|
||||
- **status:** todo
|
||||
- **details:** POST/GET/DELETE `/api/v1/network/invites` calling provider
|
||||
createInvite/revokeInvite. Tailscale: user-invites API, email optional —
|
||||
inviteUrl is the artifact (share-text pre-formed sentence, copy button,
|
||||
navigator.share, opt-in email checkbox; never log raw invite URLs to console).
|
||||
Reuse DC-085 share pattern. Tests: route contract with mocked provider,
|
||||
no-raw-token-in-logs assertion.
|
||||
|
||||
### DC-143: Block / unblock / remove person + revoke device
|
||||
- **status:** todo
|
||||
- **details:** POST `/network/people/:id/block|unblock|remove`,
|
||||
`/network/devices/:id/revoke`. Orchestrates: provider calls, session kill
|
||||
(existing auth store), access-map purge/restore, audit log entries. Block must
|
||||
be fully reversible (snapshots pre-block grants). Remove deletes devices +
|
||||
person record. Tests: orchestration order (mocked provider), reversibility,
|
||||
last-admin guard integration, audit entries written.
|
||||
|
||||
### DC-143 cleanup note: access map module itself is DC-145.
|
||||
|
||||
### DC-144: Groups (DashCaddy-side) + resources
|
||||
- **status:** todo
|
||||
- **details:** groups in people-store (array on person), group CRUD routes,
|
||||
resource model (services registry projection + manual entries), per-resource
|
||||
`sensitive` flag. No Tailscale-group mapping — ever (free plan caps 3; compiled
|
||||
rules are per-user). Tests: group CRUD, resource projection, sensitive flag
|
||||
validation.
|
||||
|
||||
### DC-145: Access map store + grid API
|
||||
- **status:** todo
|
||||
- **details:** `network-access.json` grants store, bulk GET/PUT
|
||||
`/network/access` (whole-grid save, atomic), effective-access computation
|
||||
(group grants + person overrides), change events for compiler subscription.
|
||||
This file is the single source of truth. Tests: store, effective access
|
||||
resolution (group + override precedence), atomic whole-grid save.
|
||||
|
||||
### DC-146: Technitium integration
|
||||
- **status:** todo
|
||||
- **details:** Technitium HTTP API client (credential via credential-manager),
|
||||
per-resource/per-device record upserts (idempotent), split-DNS configure when
|
||||
provider capability present, verify-by-resolve after write, wizard check step.
|
||||
Tests: API client with mocked HTTP, idempotent upsert, failure paths.
|
||||
|
||||
### DC-147: CA naming + name constraint + install page hardening
|
||||
- **status:** todo
|
||||
- issued from existing DashCA (routes/ca.js): operator-named root (setup-time,
|
||||
rename = guided re-trust), critical nameConstraints (permitted DNS subtree =
|
||||
private TLD), leaf regression tests (SAN + serverAuth EKU + ≤398d), branded
|
||||
install page with per-OS steps incl. iOS enable-trust second step + fingerprint
|
||||
+ Android native-app caveat, encrypted root-key backup step (passphrase +
|
||||
checksum). Tests: parse issued cert and assert constraint/SAN/EKU/validity;
|
||||
install-page content checks.
|
||||
|
||||
### DC-148: Tailscale ACL compiler + lockout guard
|
||||
- **status:** todo
|
||||
- **details:** access map → per-user HuJSON policy compiler. Hard rules:
|
||||
last-active-admin must keep access to the DashCaddy host resource; host device
|
||||
keeps egress; dry-run (ACL preview/test) before every push; last-known-good
|
||||
policy retained for rollback; post-push hash stored, pre-push hash compare →
|
||||
drift banner on mismatch. Provider.syncAccess(tailscale) uses this. Tests:
|
||||
golden-policy cases, lockout adversarial cases (each rule), drift detection,
|
||||
preview-failure refusal to push.
|
||||
|
||||
### DC-149: WireGuard provider — hub management
|
||||
- **status:** todo
|
||||
- **details:** `providers/wireguard.js`: wg-quick iface `dcnet0`, address pool
|
||||
10.d.c.0.0/16 stable assignment, keygen on hub, peer store, systemd unit
|
||||
if missing. All execFile-mocked in tests. Tests: pool assignment stability,
|
||||
peer add/remove, unit generation, error paths (missing wg binary).
|
||||
|
||||
### DC-150: WireGuard invites (QR) + client config
|
||||
- **status:** todo
|
||||
- **details:** one-time token (7d TTL, single-use) → redemption page rendering
|
||||
client config + QR (qrencode -t ansiutf8 → pre? no: PNG served) with Address,
|
||||
DNS=Technitium hub IP, AllowedIPs = private zone only (split tunnel). Private
|
||||
key shown once, never stored server-side. Tests: token lifecycle, config
|
||||
template correctness (allowed-ips, DNS), single-use enforcement, expiry.
|
||||
|
||||
### DC-151: WireGuard firewall matrix (nftables)
|
||||
- **status:** todo
|
||||
- **details:** per-resource nft sets (net_dc_res_<name>), peer IPs per grant,
|
||||
transactional apply (build temp ruleset → `nft -c` → `nft -f` → verify →
|
||||
rollback file), host admin ports restricted to admin peers. Tests: ruleset
|
||||
golden text, transactional failure injection (nft -c fails → no apply),
|
||||
verify-step failure, admin-port isolation.
|
||||
|
||||
### DC-152: Setup wizard + status page
|
||||
- **status:** todo
|
||||
- **details:** mode pick → credentials/endpoint → private domain pick
|
||||
(.internal default, home.arpa, custom+warning) → provider connect + sync →
|
||||
Technitium check → CA naming (locked-in warning) → first admin person.
|
||||
Status page: who's online, recent connections (provider status + DashCaddy
|
||||
connection log). Reuse monitoring widget patterns. Tests: wizard step
|
||||
contracts, status aggregation with mocked providers.
|
||||
Reference in new issue
Block a user