diff --git a/nixos/modules/services/mail/postsrsd.nix b/nixos/modules/services/mail/postsrsd.nix index 68a4c101206..a1af16ec9ac 100644 --- a/nixos/modules/services/mail/postsrsd.nix +++ b/nixos/modules/services/mail/postsrsd.nix @@ -20,17 +20,29 @@ in { description = "Whether to enable the postsrsd SRS server for Postfix."; }; - domain = mkOption { - type = types.str; - description = "Domain name for rewrite"; - }; - secretsFile = mkOption { type = types.path; default = "/var/lib/postsrsd/postsrsd.secret"; description = "Secret keys used for signing and verification"; }; + domain = mkOption { + type = types.str; + description = "Domain name for rewrite"; + }; + + separator = mkOption { + type = types.enum ["-" "=" "+"]; + default = "="; + description = "First separator character in generated addresses"; + }; + + # bindAddress = mkOption { # uncomment once 1.5 is released + # type = types.str; + # default = "127.0.0.1"; + # description = "Socket listen address"; + # }; + forwardPort = mkOption { type = types.int; default = 10001; @@ -43,6 +55,18 @@ in { description = "Port for the reverse SRS lookup"; }; + timeout = mkOption { + type = types.int; + default = 1800; + description = "Timeout for idle client connections in seconds"; + }; + + excludeDomains = mkOption { + type = types.listOf types.str; + default = []; + description = "Origin domains to exclude from rewriting in addition to primary domain"; + }; + user = mkOption { type = types.str; default = "postsrsd"; @@ -86,7 +110,7 @@ in { path = [ pkgs.coreutils ]; serviceConfig = { - ExecStart = ''${pkgs.postsrsd}/sbin/postsrsd "-s${cfg.secretsFile}" "-d${cfg.domain}" -f${toString cfg.forwardPort} -r${toString cfg.reversePort}''; + ExecStart = ''${pkgs.postsrsd}/sbin/postsrsd "-s${cfg.secretsFile}" "-d${cfg.domain}" -a${cfg.separator} -f${toString cfg.forwardPort} -r${toString cfg.reversePort} -t${toString cfg.timeout} "-X${concatStringsSep "," cfg.excludeDomains}"''; User = cfg.user; Group = cfg.group; PermissionsStartOnly = true;