224 lines
11 KiB
Markdown
224 lines
11 KiB
Markdown
---
|
|
title: "Secrets"
|
|
description: "A guide to using secrets when integrating Authelia with Kubernetes."
|
|
lead: "A guide to using secrets when integrating Authelia with Kubernetes."
|
|
date: 2022-05-15T13:52:27+10:00
|
|
draft: false
|
|
images: []
|
|
menu:
|
|
integration:
|
|
parent: "kubernetes"
|
|
weight: 530
|
|
toc: true
|
|
---
|
|
|
|
The following serve as examples of how to inject secrets into the Authelia container on [Kubernetes].
|
|
|
|
## Get Started
|
|
|
|
It's __*strongly recommended*__ that users setting up *Authelia* for the first time take a look at our
|
|
[Get Started](../prologue/get-started.md) guide. This takes you through various steps which are essential to
|
|
bootstrapping *Authelia*.
|
|
|
|
## Creation
|
|
|
|
The following section covers creating example secrets. See [Secret Usage](#usage) for usage details. These examples are
|
|
not intended to be used as is, you should only include secrets that you're actively using and some secrets may be
|
|
missing from these examples. You need to see the [secrets documentation](../../configuration/methods/secrets.md) and
|
|
appropriately adapt these examples to your use case.
|
|
|
|
### Helm Chart
|
|
|
|
The Helm [Chart](chart.md) automatically generates and injects secrets into an Authelia deployment.
|
|
|
|
### Manifest
|
|
|
|
The following manifest is an example which all of the other examples attempt to facilitate as closely as possible. You
|
|
can manually create a secret like this with `kubectl apply -f`.
|
|
|
|
##### String Data Example
|
|
|
|
##### secret.yaml
|
|
|
|
```yaml
|
|
---
|
|
kind: Secret
|
|
apiVersion: v1
|
|
metadata:
|
|
name: authelia
|
|
stringData:
|
|
JWT_SECRET: >-
|
|
NwsVsXv4YCAF9suxWZmT7N6PSzmouCDHqVpzbS5niBKo49b7rTREmwFe6roKswf4
|
|
SESSION_SECRET: >-
|
|
DkezH5zcMQsvaU38YVu673i6JDH4VPiik9xPmYsTN3KPNkxSiiyZ8ASFTdcBcu8q
|
|
REDIS_PASSWORD: >-
|
|
VfhdNhgFG5mLU9s3cjQn9im6dkiWNu3FEUPJRi9bqGm3UV6xzGBZgvdCJhoy26d9
|
|
REDIS_SENTINEL_PASSWORD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q8GKInvi1h7XukRnEvQi9MJ4LY
|
|
P1dZAoGASGcGnTMkmeSXP8ux+dvQJAiJskn/sJIgBZ5uq5GRCeLBUosRSVxM75UK
|
|
vAh/c/RBj+pYXVKuPuHGZCQJxsdcRXzXNGouUtgbaYML5Me/Hagt20QzDRBfuGBg
|
|
qeZBJaXhjElvw6PUWtg4x+LYRCBpq/bS3LK3ozZrSTukVkKDegw=
|
|
-----END RSA PRIVATE KEY-----
|
|
...
|
|
```
|
|
##### Base64 Data Example
|
|
|
|
This is the same manifest as above but encoded in base64.
|
|
|
|
```yaml
|
|
kind: Secret
|
|
apiVersion: v1
|
|
type: Opaque
|
|
metadata:
|
|
name: authelia
|
|
data:
|
|
DUO_SECRET_KEY: ZDR5cGsyVVFYeHVvODZzN3ZKMnJZV1BhNUtveERmVTlKUVdnRXF0QU5pQmFKVlFTRzhQSmJEOVUyNGVpVnVQQw==
|
|
JWT_SECRET: TndzVnNYdjRZQ0FGOXN1eFdabVQ3TjZQU3ptb3VDREhxVnB6YlM1bmlCS280OWI3clRSRW13RmU2cm9Lc3dmNA==
|
|
LDAP_PASSWORD: emFmY0FTaEVCZmdjNDhEaWhkUm5uYjZVSkVHS3F6ZzNGZGVaWFozcmhyZzZ0dTJvRG9ZU0JBODh3OU5QdkRoWg==
|
|
OIDC_HMAC_SECRET: ZVNvcE1qYml1Q01oRWJYR0ZzbTVCOEtXS3N6eFYzQ0pXU0xZclduQkpqYTRyRk52RHh0aTM4OFd5QmpkcnNIYg==
|
|
OIDC_ISSUER_PRIVATE_KEY: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLSBNWElFb2dJQiRBS0NBUUVBeFpWSlAzV0YvL1BHMmZMUW9FQzlEdGRpRkcvKzAwdnFsYlZ6ejQ3bnl4S09OSVBJIGxtTDNVZG1xcEdUS01lLzVCcnFzZTRaQUtsUUhpRGJ3eks5eXBuZmlndEh1dmgvSk8wUzdDaFA3MFJDNjdlZDEgSFYxbnlmejVlVzN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Wmd2ZENKaG95MjZkOQ==
|
|
REDIS_SENTINEL_PASSWORD: c1NKTWZYOUE2UTZ2VHBENnJIWGNMbjJqNWtONTU3Und1b2hBZXladUdxSDlQOUxHZnVTTW56aTl3b1ladU5xVQ==
|
|
SESSION_SECRET: RGtlekg1emNNUXN2YVUzOFlWdTY3M2k2SkRINFZQaWlrOXhQbVlzVE4zS1BOa3hTaWl5WjhBU0ZUZGNCY3U4cQ==
|
|
SMTP_PASSWORD: b2k0WWFnNUhYOEJoYzVKVHI0OW5Sa2RQRXI0SmNQTWZMQVB2WHhOcEh0SHFpSFhmeDNpc2RXWHVUZzd5Q3Rqaw==
|
|
STORAGE_ENCRYPTION_KEY: ckg4N3JqVk1RQnZ6VmdqOHZWR1N4aG9wMlBQd2Rkcko3QjZvU2tHY21vZ2FuTWY0d3FBTnA5QUp3YU1IdDhSQQ==
|
|
STORAGE_PASSWORD: Tk1IZjlaN0M1VVFZdUtLZ2g5QkpUS2VjY29adDZjNjQ3RlFxc0VIaGthcGtrbmRQa1B3M2Q4Ym52a3FMZ2laNQ==
|
|
```
|
|
### Kustomize
|
|
|
|
The following example is a [Kustomize](https://kustomize.io/) example which can be utilized with `kubectl apply -k`. The
|
|
files listed in the `secretGenerator` section of the `kustomization.yaml` must exist and contain the contents of your
|
|
desired secret value.
|
|
|
|
##### kustomization.yaml
|
|
|
|
```yaml
|
|
generatorOptions:
|
|
disableNameSuffixHash: true
|
|
labels:
|
|
type: generated
|
|
app: authelia
|
|
secretGenerator:
|
|
- name: authelia
|
|
files:
|
|
- DUO_SECRET_KEY
|
|
- JWT_SECRET
|
|
- LDAP_PASSWORD
|
|
- OIDC_HMAC_SECRET
|
|
- OIDC_ISSUER_PRIVATE_KEY
|
|
- REDIS_PASSWORD
|
|
- REDIS_SENTINEL_PASSWORD
|
|
- SESSION_SECRET
|
|
- SMTP_PASSWORD
|
|
- STORAGE_ENCRYPTION_KEY
|
|
- STORAGE_PASSWORD
|
|
```
|
|
|
|
## Usage
|
|
|
|
The following section covers using the created example secrets. See [Creation](#creation) for creation
|
|
details.
|
|
|
|
The example is an excerpt for a manifest which can mount volumes. Examples of these are the [Pod], [Deployment],
|
|
[StatefulSet], and [DaemonSet].
|
|
|
|
```yaml
|
|
spec:
|
|
containers:
|
|
- name: authelia
|
|
env:
|
|
- name: AUTHELIA_DUO_API_SECRET_KEY_FILE
|
|
value: /app/secrets/DUO_SECRET_KEY
|
|
- name: AUTHELIA_JWT_SECRET_FILE
|
|
value: /app/secrets/JWT_SECRET
|
|
- name: AUTHELIA_AUTHENTICATION_BACKEND_LDAP_PASSWORD_FILE
|
|
value: /app/secrets/LDAP_PASSWORD
|
|
- name: AUTHELIA_IDENTITY_PROVIDERS_OIDC_HMAC_SECRET_FILE
|
|
value: /app/secrets/OIDC_HMAC_SECRET
|
|
- name: AUTHELIA_IDENTITY_PROVIDERS_OIDC_ISSUER_PRIVATE_KEY_FILE
|
|
value: /app/secrets/OIDC_ISSUER_PRIVATE_KEY
|
|
- name: AUTHELIA_SESSION_REDIS_PASSWORD_FILE
|
|
value: /app/secrets/REDIS_PASSWORD
|
|
- name: AUTHELIA_REDIS_HIGH_AVAILABILITY_SENTINEL_PASSWORD_FILE
|
|
value: /app/secrets/REDIS_SENTINEL_PASSWORD
|
|
- name: AUTHELIA_SESSION_SECRET_FILE
|
|
value: /app/secrets/SESSION_SECRET
|
|
- name: AUTHELIA_NOTIFIER_SMTP_PASSWORD_FILE
|
|
value: /app/secrets/SMTP_PASSWORD
|
|
- name: AUTHELIA_STORAGE_ENCRYPTION_KEY_FILE
|
|
value: /app/secrets/STORAGE_ENCRYPTION_KEY
|
|
- name: AUTHELIA_STORAGE_POSTGRES_PASSWORD_FILE
|
|
value: /app/secrets/STORAGE_ENCRYPTION_KEY
|
|
volumeMounts:
|
|
- mountPath: /app/secrets
|
|
name: secrets
|
|
readOnly: true
|
|
volumes:
|
|
- name: secrets
|
|
secret:
|
|
secretName: authelia
|
|
items:
|
|
- key: DUO_SECRET_KEY
|
|
path: DUO_SECRET_KEY
|
|
- key: JWT_SECRET
|
|
path: JWT_SECRET
|
|
- key: OIDC_HMAC_SECRET
|
|
path: OIDC_HMAC_SECRET
|
|
- key: OIDC_ISSUER_PRIVATE_KEY
|
|
path: OIDC_ISSUER_PRIVATE_KEY
|
|
- key: REDIS_PASSWORD
|
|
path: REDIS_PASSWORD
|
|
- key: REDIS_SENTINEL_PASSWORD
|
|
path: REDIS_SENTINEL_PASSWORD
|
|
- key: SESSION_SECRET
|
|
path: SESSION_SECRET
|
|
- key: SMTP_PASSWORD
|
|
path: SMTP_PASSWORD
|
|
- key: STORAGE_ENCRYPTION_KEY
|
|
path: STORAGE_ENCRYPTION_KEY
|
|
- key: STORAGE_PASSWORD
|
|
path: STORAGE_PASSWORD
|
|
```
|
|
|
|
[Kubernetes]: https://kubernetes.io/
|
|
[Pod]: https://kubernetes.io/docs/concepts/workloads/pods/
|
|
[DaemonSet]: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
|
|
[StatefulSet]: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
|
|
[Deployment]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
|