2021-08-28 11:37:53 +00:00
|
|
|
{{/* Define the secrets */}}
|
|
|
|
{{- define "authelia.secrets" -}}
|
|
|
|
---
|
|
|
|
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Secret
|
|
|
|
type: Opaque
|
|
|
|
metadata:
|
2021-08-31 20:30:32 +00:00
|
|
|
name: authelia-secrets
|
|
|
|
{{- $autheliaprevious := lookup "v1" "Secret" .Release.Namespace "authelia-secrets" }}
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- $oidckey := "" }}
|
|
|
|
{{- $oidcsecret := "" }}
|
|
|
|
{{- $jwtsecret := "" }}
|
|
|
|
{{- $sessionsecret := "" }}
|
2021-12-03 22:10:11 +00:00
|
|
|
{{- $encryptionkey := "" }}
|
2021-08-28 11:37:53 +00:00
|
|
|
data:
|
|
|
|
{{- if $autheliaprevious }}
|
|
|
|
SESSION_ENCRYPTION_KEY: {{ index $autheliaprevious.data "SESSION_ENCRYPTION_KEY" }}
|
|
|
|
JWT_TOKEN: {{ index $autheliaprevious.data "JWT_TOKEN" }}
|
2021-12-05 23:57:57 +00:00
|
|
|
{{- if ( hasKey $autheliaprevious.data "ENCRYPTION_KEY" ) }}
|
|
|
|
ENCRYPTION_KEY: {{ index $autheliaprevious.data "ENCRYPTION_KEY" }}
|
|
|
|
{{- else }}
|
|
|
|
{{- $encryptionkey := randAlphaNum 100 }}
|
2022-02-22 23:10:13 +00:00
|
|
|
ENCRYPTION_KEY: {{ $encryptionkey | b64enc }}
|
2021-12-05 23:57:57 +00:00
|
|
|
{{- end }}
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- else }}
|
|
|
|
{{- $jwtsecret := randAlphaNum 50 }}
|
|
|
|
{{- $sessionsecret := randAlphaNum 50 }}
|
2021-12-03 22:10:11 +00:00
|
|
|
{{- $encryptionkey := randAlphaNum 100 }}
|
2022-02-22 23:10:13 +00:00
|
|
|
SESSION_ENCRYPTION_KEY: {{ $sessionsecret | b64enc }}
|
|
|
|
JWT_TOKEN: {{ $jwtsecret | b64enc}}
|
|
|
|
ENCRYPTION_KEY: {{ $encryptionkey | b64enc }}
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- end }}
|
2021-08-31 20:30:32 +00:00
|
|
|
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- if .Values.authentication_backend.ldap.enabled }}
|
2021-09-01 15:14:17 +00:00
|
|
|
LDAP_PASSWORD: {{ .Values.authentication_backend.ldap.plain_password | b64enc | quote }}
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- end }}
|
2021-08-31 20:30:32 +00:00
|
|
|
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- if .Values.notifier.smtp.enabled }}
|
2021-09-01 15:14:17 +00:00
|
|
|
SMTP_PASSWORD: {{ .Values.notifier.smtp.plain_password | b64enc | quote }}
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- end }}
|
2021-08-31 20:30:32 +00:00
|
|
|
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- if .Values.duo_api.enabled }}
|
|
|
|
DUO_API_KEY: {{ .Values.duo_api.plain_api_key | b64enc }}
|
|
|
|
{{- end }}
|
2021-08-31 20:30:32 +00:00
|
|
|
|
2021-10-09 23:20:01 +00:00
|
|
|
STORAGE_PASSWORD: {{ .Values.postgresql.postgresqlPassword | trimAll "\"" | b64enc }}
|
2021-08-31 20:30:32 +00:00
|
|
|
|
2021-11-12 21:12:20 +00:00
|
|
|
REDIS_PASSWORD: {{ .Values.redis.redisPassword | trimAll "\"" | b64enc }}
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- if .Values.redisProvider.high_availability.enabled}}
|
2021-11-12 21:12:20 +00:00
|
|
|
REDIS_SENTINEL_PASSWORD: {{ .Values.redis.sentinelPassword | trimAll "\"" | b64enc }}
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- end }}
|
2021-08-31 20:30:32 +00:00
|
|
|
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- if $autheliaprevious }}
|
2021-09-14 15:51:39 +00:00
|
|
|
{{- if and ( hasKey $autheliaprevious.data "OIDC_PRIVATE_KEY" ) ( hasKey $autheliaprevious.data "OIDC_HMAC_SECRET" ) }}
|
2021-08-28 11:37:53 +00:00
|
|
|
OIDC_PRIVATE_KEY: {{ index $autheliaprevious.data "OIDC_PRIVATE_KEY" }}
|
2021-09-14 15:51:39 +00:00
|
|
|
OIDC_HMAC_SECRET: {{ index $autheliaprevious.data "OIDC_HMAC_SECRET" }}
|
2021-08-28 11:37:53 +00:00
|
|
|
{{- else }}
|
|
|
|
{{- $oidckey := genPrivateKey "rsa" }}
|
|
|
|
{{- $oidcsecret := randAlphaNum 32 }}
|
|
|
|
OIDC_PRIVATE_KEY: {{ $oidckey | b64enc }}
|
|
|
|
OIDC_HMAC_SECRET: {{ $oidcsecret | b64enc }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
|
|
|
|
{{- end -}}
|