Skip to content

Authelia

Container : LXC 103 (authelia:9091)
URL : https://auth.ncls.ltd

Services protégés : voir SSO.

Configuration

Fichiers :

  • Config : /opt/docker/authelia/configuration.yml
  • Users : /opt/docker/authelia/users_database.yml
  • DB : /opt/docker/authelia/db.sqlite3

Utilisateur admin :

Modifier le mot de passe

# Générer hash bcrypt
pct exec 103 -- docker run --rm authelia/authelia:latest authelia hash-password 'NOUVEAU_PASSWORD'

# Éditer users_database.yml avec le nouveau hash
pct exec 103 -- nano /opt/docker/authelia/users_database.yml

# Redémarrer
pct exec 103 -- docker restart authelia

Forward Auth (Caddy)

Snippet réutilisable défini dans le Caddyfile global :

(authelia_sso) {
    forward_auth authelia:9091 {
        uri /api/authz/forward-auth
        copy_headers Remote-User Remote-Groups Remote-Name Remote-Email
    }
}

Inclus dans chaque vhost protégé avec import authelia_sso.

Ajouter une application

  1. Ajouter le domaine dans configuration.ymlaccess_control :

    - domain: newapp.ncls.ltd
      policy: one_factor
    
  2. Redémarrer Authelia :

    pct exec 103 -- docker restart authelia
    
  3. Ajouter import authelia_sso dans le vhost Caddy — voir Caddy.

Vérification

# Tester redirection SSO
curl -I https://portainer.ncls.ltd
# HTTP/2 302 → https://auth.ncls.ltd/...

# Logs
pct exec 103 -- docker logs authelia --tail 50

# Vérifier endpoint
pct exec 103 -- docker exec caddy wget -qO- http://authelia:9091/api/verify
# 401 (normal sans auth)

Troubleshooting

Symptôme Cause probable Fix
500 Internal Server Error Endpoint /api/verify incorrect Vérifier snippet authelia.conf
403 Forbidden Domaine absent de access_control Ajouter domaine dans configuration.yml
401 en boucle Cookies session mal configurés Vérifier domain: ncls.ltd dans config
502 Bad Gateway Backend inaccessible Vérifier IP/port et proxy_ssl_verify off si HTTPS self-signed