Categories
Tags
AdGuard Audiobookshelf Authelia Authentik Backup BookLore Books Ceph Cloudinit Cluster Community CrowdSec DevOps Diun dns-over-https dns-over-tls Docker Duplicati Encryption Fedora Firewall Grimmory Hardware Homelab IaC IAM IdP IT Karakeep Kea-DHCP Keycloak Kubernetes Linkwarden Linux Markdown Mealie Memos Mermaid MikroTik Mini Server Nextcloud Obsidian Open Source open source OPNsense pfSense Pi-hole PKM Podman Postgresql Proxmox Security Self-Hosting Server Software Development SSO Storage Terraform Traefik Trilium Vaultwarden Video Zerobyte Zitadel Автоматизация Виртуализация
Table of Contents
Table of Contents
758 words
4 minutes
Установка Authelia в Docker | Полный гайд
Установка Authelia в Docker | Полный гайд
Authelia — это современное решение для управления доступом и двухфакторной аутентификации, которое легко разворачивается в Docker-среде. В этом руководстве мы разберём, что такое Authelia, как его установить и чем оно отличается от других решений для SSO (Single Sign-On).
---Что такое Authelia?
Authelia — это открытая платформа для аутентификации и авторизации, предназначенная для защиты веб-приложений, развернутых за обратным прокси (например, Traefik или NGINX).
Основные функции Authelia:
- Защита любых веб-приложений по домену или URI
- Поддержка 2FA (TOTP, Duo, WebAuthn и др.)
- Интеграция с LDAP, Active Directory, или файлами
- Совместимость с Traefik, NGINX, Caddy
- Полноценный SSO механизм
- Поддержка ACL (прав доступа на основе правил)
Чем отличается Authelia от других решений?
| Характеристика | Authelia | Authentik | Keycloak | ZITADEL |
|---|---|---|---|---|
| Легкость установки | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐ | ⭐⭐ |
| Поддержка 2FA | ✅ | ✅ | ✅ | ✅ |
| Поддержка SSO | ✅ | ✅ | ✅ | ✅ |
| Open Source | ✅ | ✅ | ✅ | ✅ |
| Web-интерфейс | ❌ (консоль) | ✅ | ✅ | ✅ |
| Производительность | Высокая | Средняя | Низкая | Средняя |
| Поддержка ACL | ✅ | ✅ | Ограничено | ❌ |
Authelia — отличный выбор для тех, кто хочет максимальную безопасность при минимуме ресурсов, особенно в self-hosted среде.
Предварительные требования
Перед установкой убедитесь, что у вас есть:
- Docker и Docker Compose
- Обратный прокси (например, Traefik)
- Настроенные домены и HTTPS (например, через Let’s Encrypt)
- Базовые знания работы с YAML и Docker
Примерная структура проекта
1authelia/2├── configuration.yml3├── users.yml4├── docker-compose.yml5└── secrets1services:2 authelia:3 image: "authelia/authelia"4 container_name: "authelia"5 volumes:6 - "./secrets:/secrets:ro"7 - "./config:/config"8 - "./logs:/var/log/authelia/"9 networks:10 proxy:11 labels:12 - "traefik.enable=true"13 - "traefik.http.routers.authelia.rule=Host(`authelia.domain.ru`)"14 - "traefik.http.routers.authelia.entrypoints=https"15 - "traefik.http.routers.authelia.tls=true"16 - "traefik.http.middlewares.authelia.forwardAuth.address=http://authelia:9091/api/verify?rd=https://authelia.stilicho.ru"17 - "traefik.http.middlewares.authelia.forwardAuth.trustForwardHeader=true"18 - "traefik.http.middlewares.authelia.forwardAuth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email"19 - "traefik.http.services.authelia.loadbalancer.server.port=9091"20 environment:21 TZ: "Europe/Moscow"22 AUTHELIA_IDENTITY_VALIDATION_RESET_PASSWORD_JWT_SECRET_FILE: "/secrets/JWT_SECRET" # tr -cd '[:alnum:]' < /dev/urandom | fold -w 64 | head -n 1 > ./secrets/JWT_SECRET23 AUTHELIA_SESSION_SECRET_FILE: "/secrets/SESSION_SECRET" # tr -cd '[:alnum:]' < /dev/urandom | fold -w 64 | head -n 1 > ./secrets/SESSION_SECRET24 AUTHELIA_STORAGE_ENCRYPTION_KEY_FILE: "/secrets/STORAGE_ENCRYPTION_KEY" # tr -cd '[:alnum:]' < /dev/urandom | fold -w 64 | head -n 1 > ./secrets/STORAGE_ENCRYPTION_KEY25
26 #whoami-secure:27 # image: "traefik/whoami"28 # restart: "unless-stopped"29 # container_name: "whoami-secure"30 # labels:31 # - "traefik.enable=true"32 # - "traefik.http.routers.whoami-secure.rule=Host(`whoami-secure.stilicho.ru`)"33 # - "traefik.http.routers.whoami-secure.entrypoints=https"34 # - "traefik.http.routers.whoami-secure.middlewares=authelia@docker"35 # networks:36 # proxy:37
38networks:39 proxy:40 external: true1users:2 stilicho: ## Username3 displayname: "stilicho"4 ## WARNING: This is a default password for testing only!5 ## IMPORTANT: Change this password before deploying to production!6 ## Generate a new hash using the instructions at:7 ## https://www.authelia.com/reference/guides/passwords/#passwords8 ## Password is 'authelia'9 password: "$argon2id$v=19$m=65536,t=3,p=4$uSPUUUh/a5U7pNso6g2cMA$YJECeQHkv/qXZDB3W9ADkWj7DMSJRWcn/pVHTUvCbtI"10 email: "authelia@authelia.com"11 groups:12 - "admin"13 - "dev"1server:2 address: tcp://0.0.0.0:9091/3log:4 level: debug5theme: dark6# This secret can also be set using the env variables AUTHELIA_JWT_SECRET_FILE7#jwt_secret:8default_redirection_url: https://authelia.stilicho.ru9totp:10 issuer: authelia.com11
12# duo_api:13# hostname: api-123456789.example.com14# integration_key: ABCDEF15# # This secret can also be set using the env variables AUTHELIA_DUO_API_SECRET_KEY_FILE16# secret_key: 1234567890abcdefghifjkl17
18authentication_backend:19 file:20 path: /config/users.yml21 password:22 algorithm: argon223 # Recommended Parameters24 # Uses 2 GiB memory, then immediately releases it.25 # See https://www.authelia.com/reference/guides/passwords/#recommended-parameters-argon226 # See https://www.rfc-editor.org/rfc/rfc9106.html#section-4 for details on tuning the parameters for your hardware.27 # After saving configuration file, password hash can be generated by running: docker run -v ./configuration.yml:/configuration.yml --rm authelia/authelia:latest authelia crypto hash generate --config /configuration.yml --password 'yourpassword'28 argon2:29 variant: argon2id30 iterations: 131 memory: 209715232 parallelism: 433 key_length: 3234 salt_length: 1635 # Recommended Parameters when constrained by low memory or low powered hardware. Uses 64 KiB memory, then immediately releases it.36 # argon2:37 # variant: argon2id38 # iterations: 339 # memory: 6553640 # parallelism: 441 # key_length: 3242 # salt_length: 1643
44access_control:45 default_policy: deny46 rules:47 # Rules applied to everyone48 - domain: traefik-dashboard.stilicho.ru49 policy: two_factor50 #- domain: portainer.stilicho.ru #для portainer есть oidc51 # policy: two_factor52 - domain: nginx.stilicho.ru53 policy: two_factor54
55session:56 name: authelia_session57 # This secret can also be set using the env variables AUTHELIA_SESSION_SECRET_FILE58 #secret:59 expiration: 14400 # 4 hour60 inactivity: 14400 # 4 hour61 domain: stilicho.ru # Should match whatever your root protected domain is62
63 # redis:64 # host: redis65 # port: 637966 # # This secret can also be set using the env variables AUTHELIA_SESSION_REDIS_PASSWORD_FILE67 # # password: authelia68
69regulation:70 max_retries: 371 find_time: 12072 ban_time: 30073
74storage:75 #encryption_key: /secrets/STORAGE_ENCRYPTION_KEY # Now required76 local:77 path: /config/db.sqlite378
79#password_policy:80# zxcvbn:81# enabled: true82# min_score: 483
84#identity_providers:85# oidc:86## The other portions of the mandatory OpenID Connect 1.0 configuration go here.87## See: https://www.authelia.com/c/oidc88# clients:89# - client_id: 'portainer'90# client_name: 'Portainer'91# client_secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng' # The digest of 'insecure_secret'.92# public: false93# authorization_policy: 'two_factor'94# require_pkce: false95# pkce_challenge_method: ''96# redirect_uris:97# - 'https://portainer.stilicho.ru'98# scopes:99# - 'openid'100# - 'profile'101# - 'groups'102# - 'email'103# response_types:104# - 'code'105# grant_types:106# - 'authorization_code'107# access_token_signed_response_alg: 'none'108# userinfo_signed_response_alg: 'none'109# token_endpoint_auth_method: 'client_secret_post'110
111#log:112# level: info113# format: text114# file_path: /logs/authelia.log115# keep_stdout: false116
117notifier:118 # smtp:119 # username: test120 # # This secret can also be set using the env variables AUTHELIA_NOTIFIER_SMTP_PASSWORD_FILE121 # password: password122 # host: mail.example.com123 # port: 25124 # sender: admin@example.com125 filesystem:126 filename: /config/notification.txt Установка Authelia в Docker | Полный гайд
/posts/single-sign-on/authelia/ Some information may be outdated
Categories
Tags
AdGuard Audiobookshelf Authelia Authentik Backup BookLore Books Ceph Cloudinit Cluster Community CrowdSec DevOps Diun dns-over-https dns-over-tls Docker Duplicati Encryption Fedora Firewall Grimmory Hardware Homelab IaC IAM IdP IT Karakeep Kea-DHCP Keycloak Kubernetes Linkwarden Linux Markdown Mealie Memos Mermaid MikroTik Mini Server Nextcloud Obsidian Open Source open source OPNsense pfSense Pi-hole PKM Podman Postgresql Proxmox Security Self-Hosting Server Software Development SSO Storage Terraform Traefik Trilium Vaultwarden Video Zerobyte Zitadel Автоматизация Виртуализация
Table of Contents