Files
ZitPlane/docs/P05-OIDC-07.md
T

33 lines
4.9 KiB
Markdown
Raw Normal View History

# P05-OIDC-07 — Production HTTPS & Recovery Contract (Design Only)
**Status:** Read-only forensic design COMPLETE. Previous [Gitea Run #99](https://dev.ivib.cc/vibtools/ZitPlane/actions/runs/99) job #214 **SUCCESS** on `7d6b6d0704b9e39bcb6e74257dadf0b64a19fc0f` proved source-built imported Login V2, real Chromium PKCE/state/nonce/Auth.js Account session/negative/logout and owned cleanup **in disposable HTTP localhost CI only**. **Production HTTPS/DNS/Console/MFA/SSO NOT VERIFIED.** No new CI was run for this document.
## Proposed two-domain architecture (not live/verified)
| Public entry | Proposed purpose | Required secure routing |
| --- | --- | --- |
| `https://auth.vib.tools` | **One canonical ZITADEL OIDC issuer**, discovery, API and Admin Console | HTTPS 443; valid certificate; internal ZITADEL h2c/HTTP2 8080; `/ui/v2/login/**` goes to imported Login V2 internal 3000; `/ui/console/**` to ZITADEL Go |
| `https://account.vib.tools` | Separate Account Portal/Auth.js relying party, **not another issuer** | HTTPS 443; private Account service; exact callback `https://account.vib.tools/api/auth/callback/zitadel`; never accept arbitrary HTTP/wildcard origins |
These hostnames are **design targets only**, not verified DNS or public services. The tracked `deployment/docker/compose.backend.dev.yaml` explicitly uses `localhost`, HTTP issuer, development bootstrap and local port 8080. **Never deploy that file as-is to public Coolify/VPS.**
## Required security and operations checks before any real deployment
- **TLS and proxy:** trusted HTTPS issuer and certificate renewal; secure modern TLS; edge rejects unknown Host; strips and replaces untrusted `Forwarded`/`X-Forwarded-*`; ZITADEL gRPC/gRPC-Web requires **h2c/HTTP2 upstream** behind TLS terminator; no public ZITADEL 8080, Login 3000 or PostgreSQL 5432 (including IPv6). Verify Login path and Console independently.
- **OIDC/cookies:** register exact client/callback and approved post-logout URIs, keep PKCE/state/nonce; only trust Auth.js `AUTH_TRUST_HOST` behind validated proxy; verify actual Secure+HttpOnly+SameSite and host-only scope on real HTTPS. Current portal logout is **local**, not global SSO. Control CORS/CSRF/server-action origins; stage HSTS/preload carefully.
- **Admin and Login cutover:** verify real Console login and privileged API recovery *before* instance-wide Login V2 enablement, keep separate securely vaulted break-glass `IAM_OWNER` credential, and test per-app staged cutover/rollback first.
- **Identity secrets:** secure manager/offline encrypted escrow for the ZITADEL **32-byte master key**, restricted separate PostgreSQL credentials, least-privilege `IAM_LOGIN_CLIENT` PAT or supported key (not IAM_OWNER), independent Login session cookie secret, Auth.js `AUTH_SECRET` and confidential client secret, TLS/ACME and SMTP credentials; document expiry, rotation and incident response. **Do not reuse dev .env, temporary PAT, test account, or local volumes.**
- **Data recovery:** encrypted offsite Postgres backups **with separately protected matching master key**, operator-defined RPO/RTO, isolated periodic restore drill and rollback plan; no destructive restore to production as a CI test.
- **Production images:** digest-pinned ZITADEL/Login/Account, current dependency security review, provenance/SBOM/signature, vulnerability scan, rollback and monitoring alerts. The successful Run #99 image was runner-local and removed, **not a deployable release**.
**Status matrix:** Disposable custom Login/PKCE/Auth.js = **VERIFIED**. HTTPS origin validation and protected Account APIs = **IMPLEMENTED**. Live domains/TLS, production secure cookies/redirect registration, Console/MFA/SSO, managed secrets/backups/rollback = **UNVERIFIED/BLOCKED**. Proposed routing and security requirements above = **PROPOSED**.
## Operator sequence before production
1. Accept a **separate CI-only production configuration dry-run** that validates required HTTPS origin, exact paths, private h2c/Host and secret-reference policy using dummy data, **without deploying or contacting hosts**.
2. Separately approve secure production image artifacts, secret custody and encrypted backup/recovery design and tests.
3. Only after documented authorization, prepare actual infrastructure and test real HTTPS/OIDC, Console recovery and strict redirects. MFA/passkeys and multiple SaaS login require their own acceptance gates.
Detailed source mapping, source-backed evidence, priority blockers and the next exact P05-OIDC-08 Scope Lock: [notes/P05-OIDC-07.md](../notes/P05-OIDC-07.md).
Official references: [ZITADEL reverse proxy](https://zitadel.com/docs/self-hosting/manage/reverseproxy/reverse_proxy), [Login V2 safe cutover](https://zitadel.com/docs/self-hosting/manage/adopt-login-v2), [production checklist](https://zitadel.com/docs/self-hosting/manage/productionchecklist), [Login client/session](https://zitadel.com/docs/self-hosting/manage/login-client), [Auth.js deployment](https://authjs.dev/getting-started/deployment).