PC sign-in: a logged-in home PC signs its browser in with no prompt (AUT-13) #203

Merged
merge-queue merged 5 commits from pc-sign-in into main 2026-11-28 18:51:03 -08:00
Owner

A logged-in home PC signs its browser in to auth.romaine.life with no prompt, as the PC's sponsor: the same user row, role (admin included) and apps as a Microsoft sign-in. Nelson's ask: "if im logged in to my pc, that should log me in to auth. it shouldn't even ask".

Added

  • romaine-auth pc-cert (client/pc-cert*.go): a self-signed certificate over the PC's existing TPM device key, subject and issuer CN=romaine.life PC sign-in on every PC, installed in the Windows user's personal store linked to the key; idempotent (installed / current). Verified on nelsonpc: certutil's signature test passes and Windows TLS 1.3 presents it with no prompt. home-sync runs it and sets Chrome/Firefox auto-selection (romaine-life/at-home-tools#565, delivered).
  • pc.auth.romaine.life (k8s/templates/pc-sign-in.yaml): a ListenerSet listener with a ClientTrafficPolicy that requests a client certificate naming only that issuer, verifies no chain, and forwards it (XFCC SanitizeSet) to the pod's own port 8081. A NetworkPolicy lets only the shared gateway's Envoy proxies reach 8081; every other port's ingress is unchanged. DNS is a DNSEndpoint CNAME to auth.romaine.life; the route parents only the ListenerSet, so no plain-HTTP path reaches it.
  • src/pc-sign-in.ts: port 8081 serves only GET /api/auth/pc/code (exact CORS for auth.romaine.life), matching the certificate's public key to a non-revoked device row and refusing a pending sponsor; a 60-second one-time code, redeemed at POST /api/auth/pc/redeem, a Better Auth endpoint, so the session and cookie are Better Auth's own and a pending OIDC authorization resumes through oauth_query.
  • Every signed-out entry point tries it first (the chooser, Microsoft-only OIDC clients, /admin, /cli, /api/auth/cli/user-login, break-glass and Azure access approval pages), falling back at once (5-second cap) to what it did before. Sign-out sets a browser-session cookie so the PC doesn't sign straight back in.

Changed: the rule that a machine key never signs a person in (README, src/device-helpers.ts) is reversed, as Nelson decided; any process running as that Windows user can use the key, which he accepted.

Depends on the shared gateway running Envoy Gateway v1.9 (romaine-life/infra-bootstrap#42, delivered).

Work package: https://openproject.home.romaine.life/wp/AUT-13

🤖 Generated with Claude Code

A logged-in home PC signs its browser in to auth.romaine.life with no prompt, as the PC's sponsor: the same user row, role (admin included) and apps as a Microsoft sign-in. Nelson's ask: "if im logged in to my pc, that should log me in to auth. it shouldn't even ask". **Added** - `romaine-auth pc-cert` (client/pc-cert*.go): a self-signed certificate over the PC's existing TPM device key, subject and issuer `CN=romaine.life PC sign-in` on every PC, installed in the Windows user's personal store linked to the key; idempotent (`installed` / `current`). Verified on nelsonpc: certutil's signature test passes and Windows TLS 1.3 presents it with no prompt. home-sync runs it and sets Chrome/Firefox auto-selection (romaine-life/at-home-tools#565, delivered). - `pc.auth.romaine.life` (k8s/templates/pc-sign-in.yaml): a ListenerSet listener with a ClientTrafficPolicy that requests a client certificate naming only that issuer, verifies no chain, and forwards it (XFCC SanitizeSet) to the pod's own port 8081. A NetworkPolicy lets only the shared gateway's Envoy proxies reach 8081; every other port's ingress is unchanged. DNS is a DNSEndpoint CNAME to auth.romaine.life; the route parents only the ListenerSet, so no plain-HTTP path reaches it. - src/pc-sign-in.ts: port 8081 serves only `GET /api/auth/pc/code` (exact CORS for auth.romaine.life), matching the certificate's public key to a non-revoked device row and refusing a pending sponsor; a 60-second one-time code, redeemed at `POST /api/auth/pc/redeem`, a Better Auth endpoint, so the session and cookie are Better Auth's own and a pending OIDC authorization resumes through `oauth_query`. - Every signed-out entry point tries it first (the chooser, Microsoft-only OIDC clients, `/admin`, `/cli`, `/api/auth/cli/user-login`, break-glass and Azure access approval pages), falling back at once (5-second cap) to what it did before. Sign-out sets a browser-session cookie so the PC doesn't sign straight back in. **Changed**: the rule that a machine key never signs a person in (README, src/device-helpers.ts) is reversed, as Nelson decided; any process running as that Windows user can use the key, which he accepted. Depends on the shared gateway running Envoy Gateway v1.9 (romaine-life/infra-bootstrap#42, delivered). Work package: https://openproject.home.romaine.life/wp/AUT-13 🤖 Generated with [Claude Code](https://claude.com/claude-code)
pc.auth.romaine.life serves GET /api/auth/pc/code alone: the gateway forwards the PC's
client certificate in X-Forwarded-Client-Cert, its public key must equal a live device
row's, and the sponsor (admin or user) gets a one-time code good for 60 seconds, readable
by https://auth.romaine.life alone. POST /api/auth/pc/redeem is a Better Auth endpoint that
turns the code into an ordinary session for the sponsor, so the oauth-provider hooks resume
a pending authorization off it. Every signed-out entry point (the chooser, Microsoft-only
clients, /admin, /cli, /azure-access, /break-glass, the native-desktop login) tries it
first and falls back at once. Sign-out pauses it for the browser session. The k8s
templates (ListenerSet, ClientTrafficPolicy in Request mode naming CN=romaine.life PC
sign-in, the route and certificates) deploy after the gateway's upgrade.
Anything reaching the auth Service could send Host pc.auth.romaine.life with a certificate
built over a PC's public key, and get a code. The PC app now listens on its own port, 8081
(Service port `pc`), which the main port never serves whatever the Host; the pc.auth route
targets it and parents only its ListenerSet, so no plain-HTTP path reaches it; DNS comes from
a CNAME DNSEndpoint to auth.romaine.life instead; and a NetworkPolicy admits only Gateway
main's Envoy pods to 8081, leaving every other port open as before. The page's code fetch is
capped at 5 seconds.
README: PC sign-in's own port and NetworkPolicy (AUT-13)
All checks were successful
Suite go / check-test-windows (pull_request) Successful in 1m35s
Suite web-app / publish-static (pull_request) Has been skipped
Suite go / check-services (pull_request) Has been skipped
Suite release / deploy-image (pull_request) Has been skipped
Suite tofu / scope (pull_request) Successful in 29s
Suite web-app / scope (pull_request) Successful in 29s
Suite release / build (go, ubuntu-latest) (, go, false, ubuntu-latest, , go) (pull_request) Has been skipped
Suite go / reused-checks (pull_request) Successful in 23s
Suite tofu / apply (pull_request) Has been skipped
Suite release / finalize (pull_request) Has been skipped
Suite tofu / check-plan (pull_request) Has been skipped
Suite web-app / check-image (pull_request) Has been skipped
Suite release / scope (pull_request) Successful in 35s
Suite release / publish (pull_request) Has been skipped
Suite web-app / publish (pull_request) Has been skipped
Suite release / module (pull_request) Has been skipped
Suite release / home-sync (pull_request) Has been skipped
Suite default / check-logs (pull_request) Successful in 19s
Suite default / check-rules (pull_request) Successful in 19s
Suite release / reserve (pull_request) Has been skipped
Suite go / check-test-linux (pull_request) Successful in 36s
Suite tofu / reused-checks (pull_request) Successful in 25s
Suite go / check-format (pull_request) Successful in 23s
Suite release / check-build (go, ubuntu-latest) (, go, false, ubuntu-latest, , go) (pull_request) Successful in 1m31s
Suite default / reused-checks (pull_request) Successful in 25s
Suite web-app / check-test (.) (pull_request) Successful in 3m46s
Suite web-app / reused-checks (pull_request) Successful in 19s
Suite release / check-package (pull_request) Successful in 2m39s
merge-queue landed on main
Suite release / reused-checks (pull_request) Successful in 28s
160d1c1c0b
merge-queue deleted branch pc-sign-in 2026-11-28 18:51:03 -08:00
Sign in to join this conversation.
No description provided.