diff --git a/SECURITY.md b/SECURITY.md index 1480517..17a65d8 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -55,7 +55,7 @@ Home connections are vulnerable to bandwidth saturation. ## 🛠️ Security Checklist for Production - [ ] Manage all production secrets declaratively in `nixos/secrets.yaml` encrypted with Age / SOPS. -- [ ] Maintain user password hashes in `nixos/secrets.yaml` (`authelia/users//password_hash`). +- [ ] Maintain user accounts and group memberships dynamically in LLDAP (`users.roadtotech.me`). - [ ] Verify `X-Gitea-Signature` webhook secret is populated in `nixos/secrets.yaml` (`gitops/webhook_secret`). - [ ] Run `./scripts/test` and `nix flake check` before applying changes to verify structural and security invariants. - [ ] Disable Traefik/Authelia access from the public internet if only local use is needed (via Firewall/IP Whitelisting). diff --git a/config/authelia/configuration.yml b/config/authelia/configuration.yml index 633023a..40fd2f7 100644 --- a/config/authelia/configuration.yml +++ b/config/authelia/configuration.yml @@ -32,15 +32,15 @@ access_control: - domain: 'auth.{{ env "DOMAIN" }}' policy: bypass - domain: 'users.{{ env "DOMAIN" }}' - policy: bypass + policy: one_factor - domain: '*.{{ env "DOMAIN" }}' policy: one_factor session: name: authelia_session secret: '{{ env "AUTHELIA_SESSION_SECRET" }}' - expiration: 3600 - inactivity: 300 + expiration: 43200 + inactivity: 3600 remember_me: 1M cookies: - domain: '{{ env "DOMAIN" }}' diff --git a/docker-compose.yml b/docker-compose.yml index 8441386..70cf37e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -124,6 +124,7 @@ services: - "traefik.http.routers.lldap.tls=true" - "traefik.http.routers.lldap.tls.certresolver=myresolver" - "traefik.http.routers.lldap.service=lldap-svc" + - "traefik.http.routers.lldap.middlewares=authelia-auth@docker" # Public (Redirect) - "traefik.http.routers.lldap-red.rule=Host(`users.${DOMAIN}`)" - "traefik.http.routers.lldap-red.entrypoints=web" @@ -259,6 +260,7 @@ services: - "traefik.http.routers.homepage.tls=true" - "traefik.http.routers.homepage.tls.certresolver=myresolver" - "traefik.http.routers.homepage.service=homepage-svc" + - "traefik.http.routers.homepage.middlewares=authelia-auth@docker" # Public (Redirect) - "traefik.http.routers.homepage-red.rule=Host(`${HOMEPAGE_DOMAIN:-dashboard.${DOMAIN}}`)" - "traefik.http.routers.homepage-red.entrypoints=web" diff --git a/nixos/modules/homeserver.nix b/nixos/modules/homeserver.nix index 3656a49..0d7025b 100644 --- a/nixos/modules/homeserver.nix +++ b/nixos/modules/homeserver.nix @@ -3,38 +3,6 @@ { config, lib, pkgs, ... }: -let - # Declarative user database for Authelia - autheliaUsers = { - kiskaadee = { - displayName = "kiskaadee"; - email = "fcortesbio@gmail.com"; - groups = [ "admins" "dev" ]; - passwordPlaceholder = config.sops.placeholder."authelia/users/kiskaadee/password_hash"; - }; - misa = { - displayName = "misa"; - email = "icdf0728@gmail.com"; - groups = [ "users" ]; - passwordPlaceholder = config.sops.placeholder."authelia/users/misa/password_hash"; - }; - valenvg = { - displayName = "valenvg"; - email = "vegavalentina069@gmail.com"; - groups = [ "users" ]; - passwordPlaceholder = config.sops.placeholder."authelia/users/valenvg/password_hash"; - }; - }; - - renderUser = username: user: " " + username + ":\n" - + " displayname: \"" + user.displayName + "\"\n" - + " password: '" + user.passwordPlaceholder + "'\n" - + " email: \"" + user.email + "\"\n" - + " groups:\n" - + (lib.concatMapStringsSep "\n" (g: " - " + g) user.groups); - - renderedUsersYaml = "users:\n" + (lib.concatStringsSep "\n\n" (lib.mapAttrsToList renderUser autheliaUsers)) + "\n"; -in { # Define the keys to decrypt from secrets.yaml sops.secrets = lib.genAttrs [ @@ -43,9 +11,6 @@ in "authelia/session_secret" "authelia/storage_encryption_key" "authelia/jwt_secret" - "authelia/users/kiskaadee/password_hash" - "authelia/users/misa/password_hash" - "authelia/users/valenvg/password_hash" "lldap/jwt_secret" "lldap/key_seed" "lldap/admin_password" @@ -70,12 +35,6 @@ in }; }; - # Generate the declarative Authelia user database file at runtime in /run/secrets/users.yml - sops.templates."users.yml" = { - owner = "kiskaadee"; - content = renderedUsersYaml; - }; - # Define the declarative systemd service to manage the homeserver container stack systemd.services.homeserver-core = { description = "Homeserver Core Stack (Traefik, Authelia, Homepage, etc.)"; diff --git a/nixos/secrets.yaml b/nixos/secrets.yaml index 61dc71c..3a509d1 100644 --- a/nixos/secrets.yaml +++ b/nixos/secrets.yaml @@ -2,13 +2,6 @@ authelia: session_secret: ENC[AES256_GCM,data:TmujJ9I51cQrzRMcvFkhFnG1CICebOM332NUTwXSj33niFdrV3xfHWR3h83/WcNk+M/i0AjcFtZ7fRYNW5VV2766p2BAfsaihSN8yQPrsQRNPyQKvSgij2xWL/B5I1a7NQGRh7xX6yiQYqaPzrwKnlcv8kmKp8aFPlkdmWYOCPc=,iv:Pcj6yu1MvZBJ0VPfuEO4RiTiE5SOULI/jGAz8dy/X4g=,tag:firz8cjG9HP8HEgKM4c53Q==,type:str] storage_encryption_key: ENC[AES256_GCM,data:ycsfhh9cAsIbSEVaPvCH8ky0t+zayLtI6NVLcb+v2HIJMYSqD8eXu7JCvp5E0u1PkGTyaAoatXtcdChb2ABEiUNeqlOPXciF4ED+4yFAXftfMKy/M4AAYgp9jBA1v8JsE5mfBEOfmnBWV5SwGSaHBcQgUoJubKqcODPfHOmkKwg=,iv:1bgvgcClI+2VG6wXa5el5jfOrkCx+bj33VYiFdA1gas=,tag:0n7nJaZomtllFzSH2+Z8yw==,type:str] jwt_secret: ENC[AES256_GCM,data:C1FnoRi49PSaIZNp+SAS6Q5+odYwai75OR4UfvGx1Jk8wb4nVDUASpaOgm7ZFJysTX4WjuQi99PYyG5GshlHoJ5dVbLSFpEq7MSSiY8tZA2PqnHmIODNYARfFw6lB7udPjz8ANyU2UcrnwRKXnDD+T2Pa1uL9joW5rg7vWZlRks=,iv:IDZ2/wbmCPoR14b1imZrTJR5LuQp6V91tcZ/Z5Znl0w=,tag:d0UQ49QcEqgD+PCIBoOJ7Q==,type:str] - users: - kiskaadee: - password_hash: ENC[AES256_GCM,data:/Sz5Z5YH2+ksjLw60/PkL/P3PJgYR4FEHV3CFlLShP1RASpJ+b3c8ywXlkUEKqNacfIkgaZsYsIpeNwApEYFt+4QLpDOPrX1wyF1sFnD5bDaeKJkV7wVgDO18D6LWJPX4A==,iv:TivrHulGSMtqDtWYyFHL36MHzLCymmceH0ptzF+dvBk=,tag:WQce4BeqHg4jS30gHSqZMw==,type:str] - misa: - password_hash: ENC[AES256_GCM,data:pYNPWzT1m+uYjrz8ZMWROz+q7qcp6+TaYsVmXT5899ItWVX5S2wF0cz08uTu3fveF3iHp27IWOwd3TBpmc0xmkYyeY31LCCMXrtRhuqVzfshVy29jHI/QNgeH4T3kU6UVg==,iv:7kS2+OiUWlApeReOunbJ1i4nYFpl9dcFryjTIOLUEe0=,tag:JYiV8/NJSzetvyzAzWMnWg==,type:str] - valenvg: - password_hash: ENC[AES256_GCM,data:GYf6/rvz2WK5w2T0usPbAP8LQY8EqOKPcFQJrHVEjjN/dVaQqg9IMm5cA0+dyYuJpW/+bdALdIDLjSYIFF3L7KgLij0jiIJhJxxV+7e1HIto+WhoavKBNfv5OREmW9cM7Q==,iv:zZeAL5v0YOHGca8ZebQirucUA7UtR5gnucKVfNJSzTc=,tag:cgm1qBzQKmpD5ttZKWHHjw==,type:str] traefik: acme_email: ENC[AES256_GCM,data:U2IPYioGlfgSpfZy5E+2+VM0iXQ=,iv:zQ5Txq9H7mF7GcaZfyPPjSQFKa0736/DI7Y4XARMFqM=,tag:7Q4YN9OPA1rRVpXuapewQQ==,type:str] dynu: @@ -59,7 +52,7 @@ sops: yvBksdjSVYITIR6E6sZJx4ujk8Gmu64UsHwxtASMZRQ60sUjLCo8+A== -----END AGE ENCRYPTED FILE----- recipient: age1pln9sxy5j93lklqklfwp3qepx7x4cs4y2w63n9y3ykt68qgra5ysqleesg - lastmodified: "2026-09-15T06:06:49Z" - mac: ENC[AES256_GCM,data:IeWQBILtVRdg4Ls35evY0QwhtLSXujYXTE3IYnpT57uZMa/xenRU6hRVNJiWd2yXyToVbITMHBM8oMVURrhonQ+L/vMf1RCmD7h0NsREY7UxeUwdSATy9jJHS+W2m+IuR+H2DJMa2hi4e/eRDM5wS+rfkz3GKZ502DC21DxrkbU=,iv:TM57w/JnTN16JncoG0BI9k6P0SrnXrgYWc0/4vlb5cQ=,tag:MVLYHV/KcSqY9CJRA3OM2A==,type:str] + lastmodified: "2026-09-15T06:39:55Z" + mac: ENC[AES256_GCM,data:3hvpi4UNkaRVkp4K6jD/httdSAH64P83dwp4Swpjt9Zc3u34Ql4Le5boTCRKzkgZwv1REPbafNkvaMkODL6ZToeFCFSDsFYNIa9Qp6kupow5Ed9H7wEQBYOzSObI+imSE6JZ3kWYYdksnnopOwsiHsYDBV2PVqLSld7g7CEnH8g=,iv:D7SDeAq3brsoajkIXbDv0gdUPkLOxXhVUpdKfo7Ch+8=,tag:PX3F0Mh79/ehNkgkk1Y2PQ==,type:str] unencrypted_suffix: _unencrypted version: 3.13.3