Files
Scooby HuskyandClaude Sonnet 5 bb749b32b9 Fix VPS Vault OIDC login: missing redirect_uri + missing DNS
Two pre-existing gaps (not caused by this session's earlier work),
surfaced when the user started testing the VPS's standby Vault
(infrastructure/vps-standby/vault/) login via Authentik SSO:

1. VPS Vault's own auth/oidc/role/default allowed_redirect_uris only had
   vault.kube.huskypup.net (home) and localhost:8250 - never had
   vault.vps.huskypup.net registered, even though VPS's Vault shares the
   same Authentik OAuth2 provider/client_id as home's. Fixed on both
   sides: the shared blueprint (redirect_uris list) and VPS Vault's own
   role config directly (separate Vault instance/backend, needed its own
   write).

2. auth.kube.huskypup.net (Authentik itself) had NO public DNS record at
   all - it only ever resolved via UniFi's local DNS for home-LAN
   clients. Vault's OIDC backend runs server-side on the VPS and needs to
   fetch Authentik's discovery document directly - it silently returned
   an empty auth_url because it couldn't resolve the hostname at all
   ('missing auth_url' in Vault's UI, root cause only found by checking
   DNS resolution from inside the VPS's own vault pod). Added a public
   Cloudflare A record, same pattern as vault.kube.huskypup.net and
   pg-authentik.ha.huskypup.net earlier - user confirmed before adding,
   given it's Authentik itself. This likely also fixes OIDC for any other
   VPS-hosted app doing SSO against home's Authentik, not just Vault.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-20 20:33:22 -05:00

84 lines
3.7 KiB
YAML

---
# Was a plain ConfigMap with client_secret hardcoded in plaintext - found
# and fixed 2026-08-20. Unlike argocd/nextcloud, Vault had NO copy of
# this at all - the only places it existed were here AND in
# infrastructure/vault/manifests/vault-init-configmap.yaml (embedded in a
# shell script that runs `vault write auth/oidc/config` once at cluster
# init - also fixed alongside this, same Vault path). Created
# secret/vault-oauth with the existing live value (not rotated - this is
# what Vault's OWN oidc auth method is currently configured with).
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: authentik-blueprints-vault
namespace: authentik
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: vault-backend
target:
name: authentik-blueprints-vault
creationPolicy: Owner
template:
metadata:
labels:
goauthentik.io/blueprint: "true"
data:
vault.yaml: |-
version: 1
metadata:
name: vault-oidc
entries:
- model: authentik_providers_oauth2.oauth2provider
id: vault-provider
state: present
identifiers:
name: Vault
attrs:
name: Vault
client_id: 9816a5ae7e7914b5d18f4ab939d011a98f8c8d6b3bb6777c46431afa06ac4a85
client_secret: "{{ .clientSecret }}"
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
authentication_flow: !Find [authentik_flows.flow, [slug, default-authentication-flow]]
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
redirect_uris:
- url: "https://vault.kube.huskypup.net/ui/vault/auth/oidc/oidc/callback"
matching_mode: strict
# VPS's own standby Vault instance (infrastructure/vps-standby/vault/)
# shares this SAME Authentik provider/client_id - found missing
# 2026-08-21 while testing VPS vault login ("missing auth_url" -
# Vault silently returns no auth_url when the UI's computed
# redirect_uri isn't in allowed_redirect_uris; same fix needed on
# the VPS Vault's own auth/oidc/role/default, done separately since
# it's a fully independent Vault instance/backend).
- url: "https://vault.vps.huskypup.net/ui/vault/auth/oidc/oidc/callback"
matching_mode: strict
- url: "http://localhost:8250/oidc/callback"
matching_mode: strict
property_mappings:
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, openid]]
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, email]]
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, profile]]
client_type: confidential
access_code_validity: "minutes=10"
access_token_validity: "hours=1"
refresh_token_validity: "days=30"
signing_key: !Find [authentik_crypto.certificatekeypair, [name, "authentik Internal JWT Certificate"]]
- model: authentik_core.application
id: vault-application
state: present
identifiers:
slug: vault
attrs:
name: Vault
slug: vault
policy_engine_mode: any
provider: !KeyOf vault-provider
data:
- secretKey: clientSecret
remoteRef:
key: vault-oauth
property: client-secret