From 642ab3236465ef2570b933fc92cd024c5c3957ac Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Thu, 24 Sep 2026 20:01:45 -0500 Subject: [PATCH] feat(core): configure authenticated smtp submission for diun - Migrate Diun's mail notification delivery from unauthenticated port 25 to authenticated SMTP submission on port 587. This provisions a dedicated 'notifier' account and injects its password via SOPS, improving internal mail routing accountability and bypassing local hostname trust/validation issues. --- docker-compose.yml | 7 ++++--- nixos/modules/homeserver.nix | 2 ++ nixos/secrets.yaml | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7a58ced..4b04107 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -221,11 +221,12 @@ services: - DIUN_PROVIDERS_DOCKER_WATCHBYDEFAULT=true - DIUN_PROVIDERS_DOCKER_APIVERSION=${DOCKER_API_VERSION:-1.40} - DIUN_NOTIF_MAIL_HOST=stalwart - - DIUN_NOTIF_MAIL_PORT=25 - - DIUN_NOTIF_MAIL_LOCALNAME=${DOMAIN:-roadtotech.me} + - DIUN_NOTIF_MAIL_PORT=587 + - DIUN_NOTIF_MAIL_USERNAME=notifier@${DOMAIN:-roadtotech.me} + - DIUN_NOTIF_MAIL_PASSWORD=${DIUN_SMTP_PASSWORD} - DIUN_NOTIF_MAIL_SSL=false - DIUN_NOTIF_MAIL_INSECURESKIPVERIFY=true - - DIUN_NOTIF_MAIL_FROM=diun@${DOMAIN:-roadtotech.me} + - DIUN_NOTIF_MAIL_FROM=notifier@${DOMAIN:-roadtotech.me} - DIUN_NOTIF_MAIL_TO=kiskaadee@${DOMAIN:-roadtotech.me} volumes: - ./config/diun:/data diff --git a/nixos/modules/homeserver.nix b/nixos/modules/homeserver.nix index 48a3407..f5b3637 100644 --- a/nixos/modules/homeserver.nix +++ b/nixos/modules/homeserver.nix @@ -17,6 +17,7 @@ "gitops/webhook_secret" "brevo/smtp_login" "brevo/smtp_key" + "diun/smtp_password" ] (name: { owner = "kiskaadee"; }); # Generate the unified environment file at runtime in /run/secrets/homeserver.env @@ -38,6 +39,7 @@ SMTP_PORT = "587"; SMTP_LOGIN = config.sops.placeholder."brevo/smtp_login"; SMTP_KEY = config.sops.placeholder."brevo/smtp_key"; + DIUN_SMTP_PASSWORD = config.sops.placeholder."diun/smtp_password"; }; }; diff --git a/nixos/secrets.yaml b/nixos/secrets.yaml index 8af8ea9..a74ee72 100644 --- a/nixos/secrets.yaml +++ b/nixos/secrets.yaml @@ -2,6 +2,8 @@ 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] +diun: + smtp_password: ENC[AES256_GCM,data:ED3NoQWxpuucfpGAiw==,iv:fWmHEnNr9r1OpgteTJwT8Z2iKn1WKPf8WudWWvBnvjA=,tag:MjVAN7IITEm+Og+3k/SGVg==,type:str] traefik: acme_email: ENC[AES256_GCM,data:U2IPYioGlfgSpfZy5E+2+VM0iXQ=,iv:zQ5Txq9H7mF7GcaZfyPPjSQFKa0736/DI7Y4XARMFqM=,tag:7Q4YN9OPA1rRVpXuapewQQ==,type:str] dynu: @@ -55,7 +57,7 @@ sops: yvBksdjSVYITIR6E6sZJx4ujk8Gmu64UsHwxtASMZRQ60sUjLCo8+A== -----END AGE ENCRYPTED FILE----- recipient: age1pln9sxy5j93lklqklfwp3qepx7x4cs4y2w63n9y3ykt68qgra5ysqleesg - lastmodified: "2026-09-23T20:04:29Z" - mac: ENC[AES256_GCM,data:/ZtTAXnsDDzDaIiOSFIo1CgkIH+SwYvSqrUxGKExyYNyorPWu91g4tZKIPJhAgZA+Bv0W4ejPeT28zIAEH2rRhnceXEaH8ofAhIPt3V7AfF4Gwoyr+M51cbDpYkXbSUc3/Wq7whLp3ccP4QyJWUrTiHYZoC5XC4G0CszCSVPy0U=,iv:ul/wlsYMwQJr0vGmgOglebKXGQOEKIM3Jy4hxxEt8eU=,tag:oyKT44BEMHmheRf1NyML/g==,type:str] + lastmodified: "2026-09-25T00:49:38Z" + mac: ENC[AES256_GCM,data:EyJ9V0aYo7isyqnW6HWBz4hD2X6xa+VRNg3TaK88gkX6YCG/H0htBfMf/VYl/hOA/eEZW+uMVys8Ocula9zpY1Pd1gUbWt5FrXQvooYNhtCFCFUAJdsrmif8Ru7AXazFbyhhaeBSBjSQURM0qi69XqllVvfmiSz32WlX/QIOZ/c=,iv:znmm8JuFKSFl2IGGhRG77SE9kqy3uFWUK8VjocJ18n4=,tag:tG000kt5a6W1fa0IEfvLLQ==,type:str] unencrypted_suffix: _unencrypted version: 3.13.3