mirror of
https://gitlab.kube.huskypup.net/Scooby/Homelabv4.git
synced 2026-08-21 11:36:50 +00:00
Move all 8 Authentik OIDC client_secrets out of plaintext git
Completes the 'make the repo proper' cleanup from earlier this session -
these were flagged but deliberately not touched in 185e9c2 given the
blast radius (live SSO for 8 apps). User confirmed: fix all 8 now.
infrastructure/authentik/{argocd,gitlab,nextcloud,grafana,n8n,guacamole,
rancher,vault}-blueprint.yaml: converted from plain ConfigMap (client_secret
hardcoded) to ExternalSecret with a templated blueprint body
(client_secret: "{{ .clientSecret }}") pulling from Vault. Chart already
supports mounting blueprints from Secrets (blueprints.secrets, alongside
blueprints.configMaps) - infrastructure/authentik/values.yaml updated to
route these 8 there instead.
For argocd/nextcloud/n8n/guacamole/rancher: Vault already had the matching
value at secret/<app>-oauth (the APP side was already Vault-backed via its
own ExternalSecret) - the blueprint was the only remaining plaintext copy.
For gitlab/grafana/vault: Vault had no copy at all yet - created
secret/{gitlab,grafana,vault}-oauth with the EXISTING live values (not
rotated - these are the actual working credentials right now, rotating
would break login until every consumer is updated in lockstep, which is
out of scope for a cleanup pass). Also fixed the OTHER plaintext copies
that existed for these three specifically:
- apps/gitlab/manifests/external-secret-oidc.yaml (new): replaces a
manually kubectl-created, never-git-tracked gitlab-oidc-secret.
- infrastructure/grafana/manifests/grafana-oauth-secret.yaml: was a
plain Secret whose own comment said 'hardcoded from blueprint'.
- infrastructure/vault/manifests/vault-init-{configmap,job}.yaml: this
one COULDN'T be converted to the same ExternalSecret-from-Vault
pattern - it's the PostSync Job that grants ESO's own Kubernetes-auth
role in Vault, so ESO can't yet authenticate to pull anything from
Vault at the point this script runs (genuinely circular). Sourced
from a new vault-oidc-bootstrap Secret instead - created once
manually (kubectl, not git, matching how Vault's own root/unseal
material is already handled), independent of the ESO pipeline.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
c6d4294be6
commit
d9a4c16481
@@ -1,51 +1,74 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
# 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
|
||||
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: ed2ba1c6378c7a46341b5162f39a7fab80e37596b01ed387c3719e8e0040344cf1daa307476c2e7a7f75041b3979275b1ebf00bb8bad94c864b4a38ded544f7b
|
||||
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
|
||||
- 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"]]
|
||||
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
|
||||
- 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
|
||||
- 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
|
||||
|
||||
Reference in New Issue
Block a user