authelia/autheliaAuthelia是一个开源认证和授权服务器,通过Web门户为应用程序提供双因素认证和单点登录(SSO)功能。它作为反向代理的配套工具,允许、拒绝或重定向请求。
!Authelia架构图
Authelia可作为独立服务安装,也可通过Docker或Kubernetes作为容器部署,为各类应用提供集中式身份验证和授权控制。
Authelia适用于需要集中式身份验证和授权控制的各种环境,包括:
Authelia特别适合与反向代理配合使用,为多个应用程序提供统一的身份验证层,而无需修改应用程序本身。
bashdocker run -d \ --name=authelia \ -p 9091:9091 \ -v /path/to/authelia/config:/config \ -e TZ=Asia/Shanghai \ --restart unless-stopped \ authelia/authelia:latest
Local模式(本地测试)
yamlversion: '3.8' services: authelia: image: authelia/authelia:latest container_name: authelia volumes: - ./authelia/config:/config ports: - "9091:9091" environment: - TZ=Asia/Shanghai restart: unless-stopped depends_on: - redis - mysql redis: image: redis:alpine container_name: authelia-redis volumes: - ./redis:/data restart: unless-stopped mysql: image: mariadb:10 container_name: authelia-mysql volumes: - ./mysql:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=rootpassword - MYSQL_DATABASE=authelia - MYSQL_USER=authelia - MYSQL_PASSWORD=autheliapassword restart: unless-stopped
Lite模式(轻量级生产部署)
yamlversion: '3.8' services: authelia: image: authelia/authelia:latest container_name: authelia volumes: - ./authelia/config:/config - ./authelia/users:/users ports: - "9091:9091" environment: - TZ=Asia/Shanghai restart: unless-stopped networks: - authelia-network nginx: image: nginx:alpine container_name: authelia-nginx volumes: - ./nginx/conf:/etc/nginx/conf.d - ./nginx/ssl:/etc/nginx/ssl ports: - "80:80" - "443:443" depends_on: - authelia restart: unless-stopped networks: - authelia-network networks: authelia-network: driver: bridge
Authelia的主要配置文件是configuration.yml,位于配置目录中。以下是关键配置部分:
yamlserver: host: 0.0.0.0 port: 9091 path: "" read_buffer_size: 4096 write_buffer_size: 4096 enable_pprof: false enable_expvars: false disable_healthcheck: false tls: key: "" certificate: "" client_certificates: [] log: level: info format: text file_path: "" keep_stdout: true
yamlauthentication_backend: password_reset: enabled: true disable_notifier: false issuer: Authelia <***> file: path: /config/users_database.yml password: algorithm: argon2id iterations: 3 key_length: 32 memory: 65536 parallelism: 4 salt_length: 16
yamlsession: name: authelia_session secret: unsecure_session_secret expiration: 3600 inactivity: 300 domain: example.com cookie: path: / secure: false http_only: true same_site: lax partitioned: false
yamlaccess_control: default_policy: deny rules: - domain: "public.example.com" policy: bypass - domain: "login.example.com" policy: one_factor - domain: "secure.example.com" policy: two_factor groups: - admins - domain: "singlefactor.example.com" policy: one_factor
Authelia支持以下关键环境变量:
| 环境变量 | 描述 | 默认值 |
|---|---|---|
TZ | 设置时区 | UTC |
AUTHELIA_CONFIG | 配置文件路径 | /config/configuration.yml |
AUTHELIA_SESSION_SECRET_FILE | 会话密钥文件路径 | 无 |
AUTHELIA_STORAGE_ENCRYPTION_KEY_FILE | 存储加密密钥文件路径 | 无 |
AUTHELIA_JWT_SECRET_FILE | JWT密钥文件路径 | 无 |
nginxlocation /authelia { internal; proxy_pass [***] proxy_set_header Host $host; proxy_set_header X-Original-URL $scheme://$http_host$request_uri; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Forwarded-Uri $request_uri; proxy_set_header X-Forwarded-Ssl on; proxy_pass_request_body off; proxy_set_header Content-Length ""; } location / { auth_request /authelia; auth_request_set $target_url $scheme://$http_host$request_uri; auth_request_set $user $upstream_http_remote_user; auth_request_set $groups $upstream_http_remote_groups; auth_request_set $name $upstream_http_remote_name; auth_request_set $email $upstream_http_remote_email; proxy_set_header Remote-User $user; proxy_set_header Remote-Groups $groups; proxy_set_header Remote-Name $name; proxy_set_header Remote-Email $email; proxy_pass [***] }
Authelia采用Apache 2.0许可证。详细信息请参见LICENSE文件。
manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务