Add Authelia configuration and secrets management
This commit is contained in:
parent
e46346d929
commit
74f191b42a
9 changed files with 128 additions and 4 deletions
84
authelia.nix
Normal file
84
authelia.nix
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
{ 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;
|
||||
# Periodically re-reads the file; useful for adding users without restart
|
||||
watch = true;
|
||||
};
|
||||
|
||||
# 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"; }
|
||||
# ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue