wiki-grav/pages/02.linux/authentik/default.en.md

120 lines
3.3 KiB
Markdown
Raw Normal View History

2022-10-10 19:17:35 +02:00
---
title: Authentik
visible: false
---
[toc]
2022-12-16 11:46:32 +01:00
2022-10-10 19:17:35 +02:00
## Podman
2022-12-16 11:46:32 +01:00
2022-10-10 19:17:35 +02:00
### Network and Pod
2022-12-16 11:46:32 +01:00
2023-02-19 15:21:41 +01:00
```sh
podman network create net_authentik
2023-02-26 21:18:12 +01:00
podman pod create --name pod_authentik --network net_authentik -p 9000:9000 -p 9443:9443
2023-02-19 15:21:41 +01:00
```
2022-10-10 19:17:35 +02:00
#### Port Mappings
2022-12-16 11:46:32 +01:00
2022-10-10 19:17:35 +02:00
```
2023-02-26 21:18:12 +01:00
9000: Authentik HTTP
9443: Authentik HTTPS
2022-10-10 19:17:35 +02:00
```
### Database
2022-12-16 11:46:32 +01:00
```sh
2023-02-19 15:21:41 +01:00
podman run --name authentik_db \
2022-10-10 19:17:35 +02:00
-e PGDATA=/var/lib/postgresql/data/pgdata \
2023-02-26 21:18:12 +01:00
-e POSTGRES_USER={DB USER} \
-e POSTGRES_PASSWORD={DB PASS} \
-e POSTGRES_DB={DB NAME} \
2022-10-10 19:17:35 +02:00
-v /mnt/authentik_db:/var/lib/postgresql/data \
--pod pod_authentik \
-d docker.io/postgres:14
```
### Redis
2022-12-16 11:46:32 +01:00
```sh
2023-02-19 15:21:41 +01:00
podman run --name authentik_redis \
2022-10-10 19:17:35 +02:00
-v /mnt/authentik_redis:/data \
--pod pod_authentik \
-d docker.io/redis:7 \
redis-server --save 60 1 --loglevel warning
```
### Application Server
2022-12-16 11:46:32 +01:00
2022-10-10 19:17:35 +02:00
https://goauthentik.io/docs/installation/docker-compose
2022-12-16 11:46:32 +01:00
2023-02-26 21:18:12 +01:00
Generate `PG_PASS` and `AUTHENTIK_SECRET_KEY` using `openssl rand -base64 40 / 50`
2022-10-10 19:17:35 +02:00
2023-02-26 21:18:12 +01:00
```sh
podman run --name authentik_server \
-e PG_PASS={RANDOM PASS} \
-e AUTHENTIK_SECRET_KEY={RANDOM SECRET} \
-e AUTHENTIK_REDIS__HOST=authentik_redis \
-e AUTHENTIK_POSTGRESQL__HOST=authentik_db \
-e AUTHENTIK_POSTGRESQL__USER={DB USER} \
-e AUTHENTIK_POSTGRESQL__NAME={DB NAME} \
-e AUTHENTIK_POSTGRESQL__PASSWORD={DB PASS} \
# SMTP Host Emails are sent to
-e AUTHENTIK_EMAIL__HOST={SMTP SERVER} \
-e AUTHENTIK_EMAIL__PORT=465 \
# Optionally authenticate (don't add quotation marks to your password)
-e AUTHENTIK_EMAIL__USERNAME={SMTP USER} \
-e AUTHENTIK_EMAIL__PASSWORD={SMTP PASS} \
# Use StartTLS
-e AUTHENTIK_EMAIL__USE_TLS=false \
# Use SSL
-e AUTHENTIK_EMAIL__USE_SSL=true \
-e AUTHENTIK_EMAIL__TIMEOUT=10 \
# Email address authentik will send from, should have a correct @domain
-e AUTHENTIK_EMAIL__FROM={EMAIL} \
-v /mnt/authentik/media:/media \
-v /mnt/authentik/templates:/templates \
-v /mnt/authentik/geoip:/geoip \
--pod pod_authentik \
-d ghcr.io/goauthentik/server:latest \
server
2022-10-10 19:17:35 +02:00
```
### Application Worker
2022-12-16 11:46:32 +01:00
2023-02-26 21:18:12 +01:00
```sh
podman run --name authentik_worker \
-e PG_PASS={RANDOM PASS} \
-e AUTHENTIK_SECRET_KEY={RANDOM SECRET} \
-e AUTHENTIK_REDIS__HOST=authentik_redis \
-e AUTHENTIK_POSTGRESQL__HOST=authentik_db \
-e AUTHENTIK_POSTGRESQL__USER={DB USER} \
-e AUTHENTIK_POSTGRESQL__NAME={DB NAME} \
-e AUTHENTIK_POSTGRESQL__PASSWORD={DB PASS} \
# SMTP Host Emails are sent to
-e AUTHENTIK_EMAIL__HOST={SMTP SERVER} \
-e AUTHENTIK_EMAIL__PORT=465 \
# Optionally authenticate (don't add quotation marks to your password)
-e AUTHENTIK_EMAIL__USERNAME={SMTP USER} \
-e AUTHENTIK_EMAIL__PASSWORD={SMTP PASS} \
# Use StartTLS
-e AUTHENTIK_EMAIL__USE_TLS=false \
# Use SSL
-e AUTHENTIK_EMAIL__USE_SSL=true \
-e AUTHENTIK_EMAIL__TIMEOUT=10 \
# Email address authentik will send from, should have a correct @domain
-e AUTHENTIK_EMAIL__FROM={EMAIL} \
-v /mnt/authentik/media:/media \
-v /mnt/authentik/certs:/certs \
-v /mnt/authentik/templates:/templates \
-v /mnt/authentik/geoip:/geoip \
--pod pod_authentik \
-d ghcr.io/goauthentik/server:latest \
worker
2022-10-10 19:17:35 +02:00
```
2022-12-16 11:46:32 +01:00
2023-02-26 21:18:12 +01:00
## Setup
2022-10-10 19:17:35 +02:00
2023-02-26 21:18:12 +01:00
After starting all containers, visit the path `https://{SERVER IP}:{PORT}/if/flow/initial-setup/` in your browser.
The default user is called `akadmin`