postsrsd: additional configuration

fixes #19933
This commit is contained in:
Gregor Kleen 2016-10-27 19:35:02 +02:00 committed by Jörg Thalheim
parent cf1ec8ed33
commit d5ec2a2c9d
No known key found for this signature in database
GPG Key ID: CA4106B8D7CC79FA

View File

@ -20,17 +20,29 @@ in {
description = "Whether to enable the postsrsd SRS server for Postfix."; description = "Whether to enable the postsrsd SRS server for Postfix.";
}; };
domain = mkOption {
type = types.str;
description = "Domain name for rewrite";
};
secretsFile = mkOption { secretsFile = mkOption {
type = types.path; type = types.path;
default = "/var/lib/postsrsd/postsrsd.secret"; default = "/var/lib/postsrsd/postsrsd.secret";
description = "Secret keys used for signing and verification"; 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 { forwardPort = mkOption {
type = types.int; type = types.int;
default = 10001; default = 10001;
@ -43,6 +55,18 @@ in {
description = "Port for the reverse SRS lookup"; 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 { user = mkOption {
type = types.str; type = types.str;
default = "postsrsd"; default = "postsrsd";
@ -86,7 +110,7 @@ in {
path = [ pkgs.coreutils ]; path = [ pkgs.coreutils ];
serviceConfig = { 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; User = cfg.user;
Group = cfg.group; Group = cfg.group;
PermissionsStartOnly = true; PermissionsStartOnly = true;