{ config, ... }: { # Give authelia-main user access to its agenix secrets age.secrets."authelia-jwt-secret" = { file = ./secrets/authelia-jwt-secret.age; owner = "authelia-main"; group = "authelia-main"; }; age.secrets."authelia-storage-key" = { file = ./secrets/authelia-storage-key.age; owner = "authelia-main"; group = "authelia-main"; }; age.secrets."authelia-session-secret" = { file = ./secrets/authelia-session-secret.age; owner = "authelia-main"; group = "authelia-main"; }; age.secrets."authelia-users" = { file = ./secrets/authelia-users.age; owner = "authelia-main"; group = "authelia-main"; }; # Expose overrideable portal assets from this repository. environment.etc."authelia/assets".source = ./authelia-assets; services.authelia.instances.main = { enable = true; secrets = { jwtSecretFile = config.age.secrets."authelia-jwt-secret".path; storageEncryptionKeyFile = config.age.secrets."authelia-storage-key".path; sessionSecretFile = config.age.secrets."authelia-session-secret".path; }; settings = { theme = "auto"; default_2fa_method = "totp"; server.address = "tcp://127.0.0.1:9091"; server.asset_path = "/etc/authelia/assets"; log.level = "info"; totp = { disable = false; issuer = "reudy.net"; period = 30; }; webauthn.disable = true; # File-based user database (simplest, no LDAP needed) authentication_backend.file = { path = config.age.secrets."authelia-users".path; watch = false; }; # SQLite is the simplest storage - fine for a single VPS storage.local.path = "/var/lib/authelia-main/db.sqlite3"; # No email server needed for a homelab — disable email notifications notifier.filesystem.filename = "/var/lib/authelia-main/notifications.txt"; session = { expiration = "1h"; inactivity = "5m"; remember_me = "1d"; cookies = [ { domain = "reudy.net"; authelia_url = "https://auth.reudy.net"; default_redirection_url = "https://hello.reudy.net"; } ]; }; access_control = { # Every request requires two-factor by default default_policy = "two_factor"; # You can add per-domain rules here later, e.g.: # rules = [ # { domain = "hello.reudy.net"; policy = "two_factor"; } # ]; }; regulation = { max_retries = 5; }; }; }; }