feat(auth): transition authelia user database to sops-managed template

- Implement `users.yml` template generation via `sops-nix` to securely inject hashed credentials.
- Update `docker-compose.yml` to mount the generated user database as a read-only secret.
- Update `homeserver.nix` to expose Traefik ingress ports (80, 443) on the system firewall.
- Add `authelia_user_kiskaadee_password_hash` to `secrets.yaml`.

Rationale: Eliminates plaintext storage of Authelia user credentials and enforces security best practices by treating the authentication database as a dynamic, protected runtime asset.
This commit is contained in:
kiskaadee committed 2026-06-29 00:17:26 -05:00
1 parent 6c48a3601d
commit 5a617bef2c
2 files changed
+22 -2

No files matched your search

+19
View File
@@ -15,6 +15,7 @@
"authelia_session_secret"
"authelia_storage_encryption_key"
"authelia_identity_validation_reset_password_jwt_secret"
"authelia_user_kiskaadee_password_hash"
] (name: { owner = "kiskaadee"; });
# 2. Generate the unified environment file at runtime in /run/secrets/homeserver.env
@@ -31,6 +32,21 @@
};
};
# Generate the declarative Authelia user database file at runtime in /run/secrets/users.yml
sops.templates."users.yml" = {
owner = "kiskaadee";
content = ''
users:
kiskaadee:
displayname: "Kiskaadee"
password: "${config.sops.placeholder.authelia_user_kiskaadee_password_hash}"
email: "fcortesbio@gmail.com"
groups:
- admins
- dev
'';
};
# 3. Define the declarative systemd service to manage the homeserver container stack
systemd.services.homeserver-core = {
description = "Homeserver Core Stack (Traefik, Authelia, Homepage, etc.)";
@@ -46,4 +62,7 @@
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
};
};
# 4. Open ports in the firewall for Traefik
networking.firewall.allowedTCPPorts = [ 80 443 ];
}
+3 -2
View File
@@ -15,6 +15,7 @@ acme_email: ENC[AES256_GCM,data:nQwu6pSUVGwkoq3wvY1wKNMMvis=,iv:jDY32yCLQCruelme
authelia_session_secret: ENC[AES256_GCM,data:sz99LUaspa4PyTZb0ukBPKZ5uQoomEiDZ/+IxU9OxzLhBysZChTZ7nIMAmxnffbT6dHuWE3cvGntKAAOqx7DKpTOkk/YFZk31Z1FfYZ59csrIW9LChWc7EeM21SzS9Z+1jU9Zo5PBsK93X7E1m9OTKtinCwivb+hLa6AVpmdOm4=,iv:V+oxP22Nm3DyY6/SA61SrQoVwraixlM8RANQ9wejFnI=,tag:8bAuoJ6jkg5hsrzMna23vQ==,type:str]
authelia_storage_encryption_key: ENC[AES256_GCM,data:f/pHK6GORv8iHiQbDvybi/KShoKl9b3NJbfW6m8iBK4X0A9n9UiYj+LBRFY79xs78YvYj/fDROaWN1fQM6nXJf+HsUqZ7/V3cIfk8eQdYto1mVI53VByIAEURQopnb9/+ypAN61YnCwkL2CEm0ID/sOmbLVO/aQmK7ccuN9CP2I=,iv:BcoAkOdR/gGoiiP+KJNa0H/9rXpfZf2h8dT0sw5o9pU=,tag:DsPWeWABjZVvDHC5dE1XDA==,type:str]
authelia_identity_validation_reset_password_jwt_secret: ENC[AES256_GCM,data:HNK2JEBHQBWuNnuqiqyhbk3NOoRhV40C4H+aM7kbFl+Ag1u0Vh4yafpQuyhzBH/e2jb3KDDu12m/7u2jv8bTLFhlp3b91KeKLz4c1sVoMNRzGYzIyynx42KYutaFLH42sBVgOQ/sCw1ug+Plt2bGFMK20PODdNzFELStvk4qH1Q=,iv:6nqNlshXJoemh97LlpUCp2t/AmXmxzufzjRZYEJzGXc=,tag:ATA3lP2hQl+jFFUERIayTw==,type:str]
authelia_user_kiskaadee_password_hash: ENC[AES256_GCM,data:oMZwQZVCpFCqpG54I/InM2P3wkTLT79ed9O0esf1+67haa/tDjQKDDQ6h1oh75bm/IpUWmQAGthJIz7+Pu34poWq0C7YDC3zMLLdo5YA1p7iw9f0t4r21+HcTdKsWu67jw==,iv:X7dD/Ddw/PyqgOoUveHWJrDuxuzM2F9RnJyv33boBTM=,tag:JosTeokQwyz3mfyUCT/Uww==,type:str]
sops:
age:
- enc: |
@@ -35,7 +36,7 @@ sops:
KHX+ZcBi2WoOtZJEs5G+Z6fGeZHjJ1X2JTCv9oINsppu8FUovkYX/A==
-----END AGE ENCRYPTED FILE-----
recipient: age18q3lr2z4yeg2f86my42ym4hx0dvcwgjshmchyhdkgwvf4k37dsyq3mcjse
lastmodified: "2026-06-28T20:42:01Z"
mac: ENC[AES256_GCM,data:DLSddOxineqmumP8wXS0HSyBi+bIIQu+Z/A6pqnMlJatkY4+7Zh40fNqWYeTgJBx63JF6xBouZ9eEyY9kL8TNzKLIAG7PhUTnRoLZeo7xwsZEdLQXgKCY6jmxgDjVLikOw+oZJomxl/ujMC9Fwza4eGbFN9D/7LilLlNX4BAaO8=,iv:io6JdZr10vj6mDQ0+1y+saEW6quuHPjF2fBF4IcSdM4=,tag:a2dnqn0pPYTVOxBrEdZE9Q==,type:str]
lastmodified: "2026-06-28T21:17:49Z"
mac: ENC[AES256_GCM,data:KVIvGRw+kgGuxYHavttDLECqkGpShJMAileRpvT4I5u24hkIk+kziA/LlgfXAQ3AFEr5EqG0wDKTVTMRifXiK5RInTgqlx1Md4ohRpiO2rFvVUFFlve1W8pUyOOtiwhkN7Bd21cltvGfI1XM4pHegYVliPDlQp5pbMFdA4JpFxQ=,iv:PpP+fe790zun9iG9Nv7ymJlAOzldB41fy5F+m/Rykys=,tag:avtpH7O6j81efoJ39bvp8w==,type:str]
unencrypted_suffix: _unencrypted
version: 3.13.1