fix(core): grant authelia u:1000 ACLs, switch ACME to cloudflare, and add ratelimit middleware
- nixos/modules/homeserver.nix: grant u:1000 rwX POSIX ACLs on config/authelia and db.sqlite3 so Authelia can write SQLite state under operator ownership - docker-compose.yml & homeserver.nix: switch Traefik DNS-01 ACME provider from dynu to cloudflare (CF_DNS_API_TOKEN via cloudflare/dns_api_token) - docker-compose.yml: add public-ratelimit Traefik middleware (average=20, burst=40, period=1s) for public workload routes
This commit is contained in:
1 parent
47d059ee8d
commit
90f3ca930c
2 files changed
+11
-4
No files matched your search
+7
-2
@@ -44,7 +44,7 @@ services:
|
|||||||
- "80:80"
|
- "80:80"
|
||||||
- "443:443"
|
- "443:443"
|
||||||
environment:
|
environment:
|
||||||
- DYNU_API_KEY=${DYNU_API_KEY}
|
- CF_DNS_API_TOKEN=${CF_DNS_API_TOKEN}
|
||||||
- DOCKER_API_VERSION=${DOCKER_API_VERSION:-1.40}
|
- DOCKER_API_VERSION=${DOCKER_API_VERSION:-1.40}
|
||||||
command:
|
command:
|
||||||
- "--log.level=INFO"
|
- "--log.level=INFO"
|
||||||
@@ -61,7 +61,7 @@ services:
|
|||||||
- "--entrypoints.websecure.http.tls.domains[0].sans=*.${DOMAIN}"
|
- "--entrypoints.websecure.http.tls.domains[0].sans=*.${DOMAIN}"
|
||||||
# SSL Setup
|
# SSL Setup
|
||||||
- "--certificatesresolvers.myresolver.acme.dnschallenge=true"
|
- "--certificatesresolvers.myresolver.acme.dnschallenge=true"
|
||||||
- "--certificatesresolvers.myresolver.acme.dnschallenge.provider=dynu"
|
- "--certificatesresolvers.myresolver.acme.dnschallenge.provider=cloudflare"
|
||||||
- "--certificatesresolvers.myresolver.acme.email=${ACME_EMAIL}"
|
- "--certificatesresolvers.myresolver.acme.email=${ACME_EMAIL}"
|
||||||
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
|
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -81,6 +81,11 @@ services:
|
|||||||
- "traefik.http.middlewares.authelia-auth.forwardauth.trustForwardHeader=true"
|
- "traefik.http.middlewares.authelia-auth.forwardauth.trustForwardHeader=true"
|
||||||
- "traefik.http.middlewares.authelia-auth.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Email,Remote-Name"
|
- "traefik.http.middlewares.authelia-auth.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Email,Remote-Name"
|
||||||
|
|
||||||
|
# Middleware: Public Rate Limit (mitigates scraper/crawler bursts on public routes)
|
||||||
|
- "traefik.http.middlewares.public-ratelimit.ratelimit.average=20"
|
||||||
|
- "traefik.http.middlewares.public-ratelimit.ratelimit.burst=40"
|
||||||
|
- "traefik.http.middlewares.public-ratelimit.ratelimit.period=1s"
|
||||||
|
|
||||||
# Dashboard - Public (HTTPS)
|
# Dashboard - Public (HTTPS)
|
||||||
- "traefik.http.routers.traefik-dash.rule=Host(`traefik.${DOMAIN}`)"
|
- "traefik.http.routers.traefik-dash.rule=Host(`traefik.${DOMAIN}`)"
|
||||||
- "traefik.http.routers.traefik-dash.entrypoints=websecure"
|
- "traefik.http.routers.traefik-dash.entrypoints=websecure"
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
'';
|
'';
|
||||||
# Define the keys to decrypt from secrets.yaml
|
# Define the keys to decrypt from secrets.yaml
|
||||||
sops.secrets = (lib.genAttrs [
|
sops.secrets = (lib.genAttrs [
|
||||||
"dynu/api_key"
|
"cloudflare/dns_api_token"
|
||||||
"traefik/acme_email"
|
"traefik/acme_email"
|
||||||
"authelia/session_secret"
|
"authelia/session_secret"
|
||||||
"authelia/storage_encryption_key"
|
"authelia/storage_encryption_key"
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
DOMAIN = config.homelab.domain;
|
DOMAIN = config.homelab.domain;
|
||||||
LLDAP_LDAP_BASE_DN = ldapBaseDn;
|
LLDAP_LDAP_BASE_DN = ldapBaseDn;
|
||||||
DOCKER_API_VERSION = "1.40";
|
DOCKER_API_VERSION = "1.40";
|
||||||
DYNU_API_KEY = config.sops.placeholder."dynu/api_key";
|
CF_DNS_API_TOKEN = config.sops.placeholder."cloudflare/dns_api_token";
|
||||||
ACME_EMAIL = config.sops.placeholder."traefik/acme_email";
|
ACME_EMAIL = config.sops.placeholder."traefik/acme_email";
|
||||||
AUTHELIA_SESSION_SECRET = config.sops.placeholder."authelia/session_secret";
|
AUTHELIA_SESSION_SECRET = config.sops.placeholder."authelia/session_secret";
|
||||||
AUTHELIA_STORAGE_ENCRYPTION_KEY = config.sops.placeholder."authelia/storage_encryption_key";
|
AUTHELIA_STORAGE_ENCRYPTION_KEY = config.sops.placeholder."authelia/storage_encryption_key";
|
||||||
@@ -326,6 +326,8 @@
|
|||||||
"d ${config.homelab.coreDir}/config/stalwart/data 0777 ${config.homelab.operatorUser} users -"
|
"d ${config.homelab.coreDir}/config/stalwart/data 0777 ${config.homelab.operatorUser} users -"
|
||||||
"d ${config.homelab.coreDir}/config/stalwart/etc 0777 ${config.homelab.operatorUser} users -"
|
"d ${config.homelab.coreDir}/config/stalwart/etc 0777 ${config.homelab.operatorUser} users -"
|
||||||
"d ${config.homelab.sitesDir} 0755 ${config.homelab.operatorUser} users -"
|
"d ${config.homelab.sitesDir} 0755 ${config.homelab.operatorUser} users -"
|
||||||
|
"a+ ${config.homelab.coreDir}/config/authelia - - - - d:u:1000:rwX,u:1000:rwx,m::rwx"
|
||||||
|
"a+ ${config.homelab.coreDir}/config/authelia/db.sqlite3 - - - - u:1000:rw,m::rw"
|
||||||
"a+ ${config.homelab.coreDir}/config/authelia/emails.txt - - - - u:1000:rw,m::rw"
|
"a+ ${config.homelab.coreDir}/config/authelia/emails.txt - - - - u:1000:rw,m::rw"
|
||||||
"d /home/${config.homelab.operatorUser}/.local/state/homelab/gitops 0755 ${config.homelab.operatorUser} users -"
|
"d /home/${config.homelab.operatorUser}/.local/state/homelab/gitops 0755 ${config.homelab.operatorUser} users -"
|
||||||
"d /home/${config.homelab.operatorUser}/.local/state/homelab/docker 0755 ${config.homelab.operatorUser} users -"
|
"d /home/${config.homelab.operatorUser}/.local/state/homelab/docker 0755 ${config.homelab.operatorUser} users -"
|
||||||
|
|||||||
Reference in new issue
Block a user