Skip to main content

Identity Management

Centralized authentication, authorization, and secrets management for RavenmaskOS.


Overview

The identity management stack implements a layered, enterprise-grade security model:

┌─────────────────────────────────────────────────────────────────┐
│ EXTERNAL REQUEST │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│ LAYER 1: EDGE (Traefik) │
│ - TLS termination (Let's Encrypt) │
│ - Route 53 DNS validation │
│ - ForwardAuth middleware │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│ LAYER 2: AUTHENTICATION │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ OAuth2-Proxy │───▶│ Zitadel │ │
│ │ (ForwardAuth) │ │ (OIDC/SSO) │ │
│ └─────────────────┘ └─────────────────┘ │
│ OR │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ NextAuth.js │───▶│ Zitadel │ │
│ │ (Direct OIDC) │ │ (OIDC/SSO) │ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│ LAYER 3: AUTHORIZATION │
│ ┌─────────────────┐ │
│ │ OpenFGA │ ← Fine-grained permissions │
│ │ (AuthZ) │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│ LAYER 4: SERVICE IDENTITY (In Progress) │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ SPIRE Server │───▶│ SPIRE Agent │ │
│ │ (Trust Domain) │ │ (Workload ID) │ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│ LAYER 5: SECRETS │
│ ┌─────────────────┐ │
│ │ OpenBao │ ← Dynamic credentials, rotation │
│ │ (Secrets) │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Components

ServicePurposeURLStatus
ZitadelOIDC/SSO Providerauth.ravenhelm.dev✅ Running
OAuth2-ProxyForward Auth Middlewareoauth.ravenhelm.dev✅ Running
OpenFGAFine-grained AuthorizationInternal✅ Running
SPIREService Identity (SPIFFE)Internal⚠️ Partial
OpenBaoSecrets Managementvault.ravenhelm.dev✅ Production

OpenBao Sub-Pages

PageDescription
OpenBao OIDCZitadel SSO authentication for UI access
OpenBao AppRoleService-to-service authentication
OpenBao Auto-UnsealGCP KMS auto-unseal configuration
OpenBao Norns IntegrationHow Norns fetches secrets from vault

Authentication Flows

Flow 1: OAuth2-Proxy (ForwardAuth)

Used for services without native OIDC support.

User → Traefik → OAuth2-Proxy Check

┌─────────────┴─────────────┐
↓ ↓
Cookie Valid Cookie Invalid
↓ ↓
Forward to Redirect to Zitadel
Service ↓
User Authenticates

Authorization Code

OAuth2-Proxy exchanges
code for tokens

Set secure cookie

Redirect to service

Protected Services:

  • Homepage (dashboard.ravenhelm.dev)
  • n8n UI (n8n.ravenhelm.dev)
  • Homebridge (homebridge.ravenhelm.dev)

Flow 2: Direct OIDC (NextAuth.js)

Used for Next.js applications with native OIDC.

User → Next.js App → NextAuth.js

Redirect to Zitadel

User Authenticates

Authorization Code

NextAuth exchanges
code for tokens

JWT Session Cookie

App renders with
user context

Services Using Direct OIDC:

  • Norns Admin (norns.ravenhelm.dev)
  • Bifrost Admin (bifrost.ravenhelm.dev)
  • Grafana (grafana.ravenhelm.dev)

Service Integration Matrix

ServiceAuth MethodIntegration TypeNotes
HomepageOAuth2-ProxyTraefik ForwardAuthFull protection
n8nOAuth2-Proxy + PATHybridUI protected, API uses PAT
HomebridgeOAuth2-ProxyTraefik ForwardAuthFull protection
NornsNextAuth.jsDirect OIDCNative integration
BifrostNextAuth.jsDirect OIDCNative integration
GrafanaGeneric OAuthDirect OIDCRole mapping enabled
LangfuseNextAuth.jsDirect OIDCNative integration

OIDC Applications

Registered in Zitadel:

ApplicationClient IDType
OAuth2-Proxy351314046345084937Web (PKCE)
Norns Admin350642335773687817Web
Grafana351369960024506377Web
GitLab351312537486163977Web

PropertyValue
Name_oauth2_proxy
Domain.ravenhelm.dev
Securetrue (HTTPS only)
HttpOnlytrue
SameSiteLax
Max-Age24 hours

PKCE (Proof Key for Code Exchange)

OAuth2-Proxy uses S256 code challenge method to prevent authorization code interception attacks.


Trust Domain

All services operate under the ravenhelm.dev trust domain:

  • DNS: *.ravenhelm.dev → Traefik
  • OIDC Issuer: https://auth.ravenhelm.dev
  • SPIFFE Trust Domain: spiffe://ravenhelm.dev
  • Cookie Domain: .ravenhelm.dev

Quick Commands

# Check all identity services
for svc in zitadel oauth2-proxy spire-server spire-agent openbao; do
echo "=== $svc ==="
docker ps --filter "name=$svc" --format "{{.Names}}: {{.Status}}"
done

# Test OIDC discovery
curl -s https://auth.ravenhelm.dev/.well-known/openid-configuration | jq .issuer

# Check OAuth2-Proxy logs
docker logs oauth2-proxy 2>&1 | tail -20

# View Zitadel logs
docker logs zitadel 2>&1 | tail -20

# Check SPIRE server health
docker exec spire-server /opt/spire/bin/spire-server healthcheck

# Check OpenBao status
docker exec openbao bao status

Secrets Management

OpenBao (Production)

Secrets are centrally managed in OpenBao with the following features:

FeatureStatus
KV v2 Secrets Engine✅ Active
GCP KMS Auto-Unseal✅ Active
OIDC Authentication✅ Active
AppRole (Services)✅ 4 services configured
Norns Integration✅ Reading from vault

Secret Paths:

  • secret/api-keys/ - Anthropic, OpenAI, Deepgram, etc.
  • secret/database/ - PostgreSQL, Redis
  • secret/integrations/ - Slack, Twilio, GitLab
  • secret/services/ - Langfuse, LiveKit
  • secret/infrastructure/ - AWS

See Secrets Migration for full migration status.

Legacy: Environment Files

Some services still use .env files as backup, but primary source is now OpenBao.


Implementation Status

ComponentPhaseStatus
ZitadelPhase 1✅ Production
OAuth2-ProxyPhase 1✅ Production
Direct OIDC AppsPhase 1✅ Production
SPIRE ServerPhase 2✅ Running
SPIRE AgentPhase 2⚠️ Attestation Issues
OpenBaoPhase 2✅ Production (GCP KMS auto-unseal, OIDC, AppRole)
OpenFGAPhase 2✅ Production
Norns → OpenBaoPhase 3✅ Integrated

Runbooks

Zitadel / OAuth2

OpenBao


Troubleshooting

See individual service pages for specific troubleshooting: