2023-03-04 12:42:14 +00:00
|
|
|
{{/* Define the secrets */}}
|
|
|
|
{{- define "authelia.secrets" -}}
|
2023-03-07 23:11:28 +00:00
|
|
|
{{- $basename := include "tc.v1.common.lib.chart.names.fullname" $ -}}
|
|
|
|
{{- $fetchname := printf "%s-authelia-secrets" $basename -}}
|
2023-03-08 19:05:10 +00:00
|
|
|
|
|
|
|
{{/* Initialize all keys */}}
|
|
|
|
{{- $oidckey := genPrivateKey "rsa" }}
|
|
|
|
{{- $oidcsecret := randAlphaNum 32 }}
|
|
|
|
{{- $jwtsecret := randAlphaNum 50 }}
|
|
|
|
{{- $sessionsecret := randAlphaNum 50 }}
|
|
|
|
{{- $encryptionkey := randAlphaNum 100 }}
|
|
|
|
|
2023-03-04 12:42:14 +00:00
|
|
|
enabled: true
|
|
|
|
data:
|
2023-03-08 19:05:10 +00:00
|
|
|
{{ with (lookup "v1" "Secret" .Release.Namespace $fetchname) }}
|
|
|
|
{{/* Get previous values and decode */}}
|
|
|
|
{{ $sessionsecret = (index .data "SESSION_ENCRYPTION_KEY") | b64dec }}
|
|
|
|
{{ $jwtsecret = (index .data "JWT_TOKEN") | b64dec }}
|
|
|
|
{{ $encryptionkey = (index .data "ENCRYPTION_KEY") | b64dec }}
|
|
|
|
|
|
|
|
{{/* Check if those keys ever existed. as OIDC is optional */}}
|
|
|
|
{{ if and (hasKey .data "OIDC_PRIVATE_KEY") (hasKey .data "OIDC_HMAC_SECRET") }}
|
|
|
|
{{ $oidckey = (index .data "OIDC_PRIVATE_KEY") | b64dec }}
|
|
|
|
{{ $oidcsecret = (index .data "OIDC_HMAC_SECRET") | b64dec }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2023-03-04 12:42:14 +00:00
|
|
|
SESSION_ENCRYPTION_KEY: {{ $sessionsecret }}
|
2023-03-08 19:05:10 +00:00
|
|
|
JWT_TOKEN: {{ $jwtsecret }}
|
2023-03-04 12:42:14 +00:00
|
|
|
ENCRYPTION_KEY: {{ $encryptionkey }}
|
|
|
|
|
|
|
|
{{- if .Values.authentication_backend.ldap.enabled }}
|
2023-12-22 20:19:14 +00:00
|
|
|
LDAP_PASSWORD: {{ .Values.authentication_backend.ldap.plain_password | quote }}
|
2023-03-04 12:42:14 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- if and .Values.notifier.smtp.enabled .Values.notifier.smtp.plain_password }}
|
2023-12-22 20:19:14 +00:00
|
|
|
SMTP_PASSWORD: {{ .Values.notifier.smtp.plain_password | quote }}
|
2023-03-04 12:42:14 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- if .Values.duo_api.enabled }}
|
2023-12-22 20:19:14 +00:00
|
|
|
DUO_API_KEY: {{ .Values.duo_api.plain_api_key | quote }}
|
2023-03-04 12:42:14 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
STORAGE_PASSWORD: {{ $.Values.cnpg.main.creds.password | trimAll "\"" }}
|
|
|
|
|
2023-03-06 17:16:22 +00:00
|
|
|
REDIS_PASSWORD: {{ .Values.redis.creds.redisPassword | trimAll "\"" }}
|
2023-03-08 20:40:12 +00:00
|
|
|
{{- if .Values.redisProvider.high_availability.enabled }}
|
2023-03-04 12:42:14 +00:00
|
|
|
REDIS_SENTINEL_PASSWORD: {{ .Values.redis.sentinelPassword | trimAll "\"" }}
|
|
|
|
{{- end }}
|
|
|
|
|
2023-03-08 20:40:12 +00:00
|
|
|
OIDC_PRIVATE_KEY: |
|
|
|
|
{{- $oidckey | nindent 4 }}
|
2023-03-04 12:42:14 +00:00
|
|
|
OIDC_HMAC_SECRET: {{ $oidcsecret }}
|
|
|
|
{{- end -}}
|