From 1a82257636d92ce21ba3275d85955074a4091341 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Tue, 4 Mar 2025 20:14:45 +0100 Subject: modules/stalwart-mail: Avoid hardcoding `vhack.eu` email address --- modules/by-name/st/stalwart-mail/module.nix | 19 +++++++++++++++++++ modules/by-name/st/stalwart-mail/settings.nix | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/by-name/st/stalwart-mail/module.nix b/modules/by-name/st/stalwart-mail/module.nix index 4595c21..76149c3 100644 --- a/modules/by-name/st/stalwart-mail/module.nix +++ b/modules/by-name/st/stalwart-mail/module.nix @@ -20,6 +20,18 @@ in { package = lib.mkPackageOption vhackPackages "stalwart-mail-free" {}; + admin = lib.mkOption { + description = '' + Email address to advertise as administrator. This is the address, where dkim, spv + etc. refusal reports are sent to. + + The format should be: `mailto:@` + ''; + type = lib.types.str; + example = "mailto:dmarc+rua@example.com"; + default = ""; + }; + fqdn = lib.mkOption { type = lib.types.str; example = "mail.foss-syndicate.org"; @@ -103,6 +115,13 @@ in { }; config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = cfg.admin != ""; + message = "You need to specify an admin address."; + } + ]; + services.stalwart-mail = { # NOTE(@bpeetz): We do not use the nixos service, as it comes with too much # bothersome default configuration and not really any useful config. diff --git a/modules/by-name/st/stalwart-mail/settings.nix b/modules/by-name/st/stalwart-mail/settings.nix index 0f382ee..06b5062 100644 --- a/modules/by-name/st/stalwart-mail/settings.nix +++ b/modules/by-name/st/stalwart-mail/settings.nix @@ -57,7 +57,7 @@ in { from-name = "'TLS Report'"; from-address = "'noreply-tls@${cfg.fqdn}'"; org-name = "'Foss Syndicate Mail Handling'"; - contact-info = "'admin@vhack.eu'"; + contact-info = "'${cfg.admin}'"; send = "daily"; max-size = 26214400; # 25 MiB sign = lib.mkIf (cfg.security != null) "['ed25519']"; @@ -67,7 +67,7 @@ in { from-name = "'DMARC Report'"; from-address = "'noreply-dmarc@${cfg.fqdn}'"; org-name = "'Foss Syndicate Mail Handling'"; - contact-info = "'admin@vhack.eu'"; + contact-info = "'${cfg.admin}'"; send = "weekly"; max-size = 26214400; # 25MiB sign = lib.mkIf (cfg.security != null) "['ed25519']"; -- cgit 1.4.1