87 lines
2.4 KiB
Nix
87 lines
2.4 KiB
Nix
{ 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";
|
|
};
|
|
|
|
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";
|
|
|
|
log.level = "info";
|
|
|
|
totp = {
|
|
issuer = "srazka.com";
|
|
period = 30;
|
|
};
|
|
|
|
# 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 = "srazka.com";
|
|
authelia_url = "https://auth.srazka.com";
|
|
default_redirection_url = "https://hello.srazka.com";
|
|
}
|
|
];
|
|
};
|
|
|
|
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.srazka.com"; policy = "two_factor"; }
|
|
# ];
|
|
};
|
|
|
|
regulation = {
|
|
max_retries = 5;
|
|
};
|
|
};
|
|
};
|
|
}
|