longhorn: log in through authentik on the Gateway

Longhorn has no users of its own; nginx guarded it with basic auth using apr1 hashes, which Envoy Gateway does not support. An Envoy Gateway SecurityPolicy now sends visitors through an authentik OIDC application that only admins may use. The client secret lives in Vault at kv/longhorn-oidc and reaches both authentik and Envoy through External Secrets.
This commit is contained in:
Ruben Hensen committed 2026-10-23 21:07:31 +02:00
1 parent 009b8ce510
commit 910b792452
6 files changed
+179

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: authentik-blueprint-longhorn
data:
longhorn-oidc.yaml: |
version: 1
metadata:
name: Longhorn OIDC
entries:
# Envoy Gateway does the login for Longhorn, which has no users of its
# own (see longhorn/httproute.yaml).
- model: authentik_providers_oauth2.oauth2provider
id: longhorn-provider
state: present
identifiers:
name: Longhorn
attrs:
name: Longhorn
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]]
client_type: confidential
client_id: longhorn
client_secret: !Env [LONGHORN_OIDC_CLIENT_SECRET, ""]
redirect_uris:
- matching_mode: strict
url: https://longhorn.rubenhensen.nl/oauth2/callback
# Envoy's test port until the switch from ingress-nginx
- matching_mode: strict
url: https://longhorn.rubenhensen.nl:10443/oauth2/callback
signing_key: !Find [authentik_crypto.certificatekeypair, [name, "authentik Self-signed Certificate"]]
property_mappings:
- !Find [authentik_providers_oauth2.scopemapping, [managed, goauthentik.io/providers/oauth2/scope-openid]]
- !Find [authentik_providers_oauth2.scopemapping, [managed, goauthentik.io/providers/oauth2/scope-email]]
- !Find [authentik_providers_oauth2.scopemapping, [managed, goauthentik.io/providers/oauth2/scope-profile]]
- model: authentik_core.application
id: longhorn-app
state: present
identifiers:
slug: longhorn
attrs:
name: Longhorn
provider: !KeyOf longhorn-provider
meta_launch_url: https://longhorn.rubenhensen.nl
# Longhorn can delete volumes, so only admins get in.
- model: authentik_policies.policybinding
state: present
identifiers:
order: 0
target: !KeyOf longhorn-app
attrs:
group: !Find [authentik_core.group, [name, "authentik Admins"]]
+18
View File
@@ -135,3 +135,21 @@ spec:
remoteRef:
key: kv/actualbudget-oidc
property: client_secret
---
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: longhorn-oidc-client-secret
spec:
secretStoreRef:
name: vault-backend
kind: ClusterSecretStore
refreshInterval: 15m
target:
name: longhorn-oidc-client-secret
creationPolicy: Owner
data:
- secretKey: client_secret
remoteRef:
key: kv/longhorn-oidc
property: client_secret