From e3cde575fddeb1dd60f69f86e34a4028ee6bb38f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 11 Jul 2022 09:38:57 +0200 Subject: ... --- hosts/surtr/email/default.nix | 5 ++++- modules/postfix-mta-sts-resolver.nix | 17 ++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/hosts/surtr/email/default.nix b/hosts/surtr/email/default.nix index 9bdaac75..83bf02f5 100644 --- a/hosts/surtr/email/default.nix +++ b/hosts/surtr/email/default.nix @@ -726,6 +726,9 @@ in { sopsFile = ./spm-keys.json; }; - services.postfix-mta-sts-resolver.enable = true; + services.postfix-mta-sts-resolver = { + enable = true; + loglevel = "debug"; + }; }; } diff --git a/modules/postfix-mta-sts-resolver.nix b/modules/postfix-mta-sts-resolver.nix index 9e126361..454f24f2 100644 --- a/modules/postfix-mta-sts-resolver.nix +++ b/modules/postfix-mta-sts-resolver.nix @@ -12,6 +12,11 @@ in { redis = mkEnableOption "redis cache" // { default = true; example = false; }; + loglevel = mkOption { + type = types.enum ["debug" "info" "warn" "error" "fatal"]; + default = "info"; + }; + settings = mkOption { type = types.attrs; }; @@ -19,12 +24,10 @@ in { }; config = mkIf cfg.enable { - services.postfix-mta-sts-resolver.settings.path = "/run/postfix-mta-sts-resolver/map.sock"; - services.postfix-mta-sts-resolver.settings.mode = 432; # 0o0660 - - services.postfix-mta-sts-resolver.settings.cache = mkIf cfg.redis { - redis.url = "unix://${toString config.services.redis.servers.postfix-mta-sts-resolver.unixSocket}"; - }; + services.postfix-mta-sts-resolver.settings = { + path = "/run/postfix-mta-sts-resolver/map.sock"; + mode = 432; # 0o0660 + } // (optionalAttrs cfg.redis { cache.redis.url = "unix://${toString config.services.redis.servers.postfix-mta-sts-resolver.unixSocket}"; }); services.redis.servers.postfix-mta-sts-resolver = mkIf cfg.redis { enable = true; @@ -43,7 +46,7 @@ in { before = ["postfix.service"]; serviceConfig = { - ExecStart = "${pkgs.postfix-mta-sts-resolver}/bin/mta-sts-daemon -c ${pkgs.writeText "mta-sts-daemon.yml" (generators.toYAML {} cfg.settings)}"; + ExecStart = "${pkgs.postfix-mta-sts-resolver}/bin/mta-sts-daemon -v ${cfg.loglevel} -c ${pkgs.writeText "mta-sts-daemon.yml" (generators.toYAML {} cfg.settings)}"; SupplementaryGroups = mkIf cfg.redis config.services.redis.servers.postfix-mta-sts-resolver.user; RuntimeDirectory = "postfix-mta-sts-resolver"; -- cgit v1.2.3