2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2011-10-27 19:43:20 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.dovecot2;
|
2016-04-22 15:21:17 +00:00
|
|
|
dovecotPkg = pkgs.dovecot;
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
baseDir = "/run/dovecot2";
|
|
|
|
stateDir = "/var/lib/dovecot";
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
dovecotConf = concatStrings [
|
2011-10-27 19:43:20 +00:00
|
|
|
''
|
2015-12-09 09:27:44 +00:00
|
|
|
base_dir = ${baseDir}
|
2016-01-10 03:54:07 +00:00
|
|
|
protocols = ${concatStringsSep " " cfg.protocols}
|
2017-01-29 10:11:01 +00:00
|
|
|
sendmail_path = /run/wrappers/bin/sendmail
|
2011-10-27 19:43:20 +00:00
|
|
|
''
|
2015-12-09 09:27:44 +00:00
|
|
|
|
2019-04-24 03:48:22 +00:00
|
|
|
(if cfg.sslServerCert == null then ''
|
2015-12-09 09:27:44 +00:00
|
|
|
ssl = no
|
|
|
|
disable_plaintext_auth = no
|
|
|
|
'' else ''
|
2012-09-21 10:28:49 +00:00
|
|
|
ssl_cert = <${cfg.sslServerCert}
|
|
|
|
ssl_key = <${cfg.sslServerKey}
|
2019-04-24 03:48:22 +00:00
|
|
|
${optionalString (cfg.sslCACert != null) ("ssl_ca = <" + cfg.sslCACert)}
|
2018-05-10 06:29:29 +00:00
|
|
|
ssl_dh = <${config.security.dhparams.params.dovecot2.path}
|
2012-09-21 10:26:53 +00:00
|
|
|
disable_plaintext_auth = yes
|
2011-10-27 19:43:20 +00:00
|
|
|
'')
|
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
''
|
2011-10-27 19:43:20 +00:00
|
|
|
default_internal_user = ${cfg.user}
|
2018-03-28 17:16:41 +00:00
|
|
|
default_internal_group = ${cfg.group}
|
2016-01-10 04:07:26 +00:00
|
|
|
${optionalString (cfg.mailUser != null) "mail_uid = ${cfg.mailUser}"}
|
|
|
|
${optionalString (cfg.mailGroup != null) "mail_gid = ${cfg.mailGroup}"}
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2012-06-10 15:07:25 +00:00
|
|
|
mail_location = ${cfg.mailLocation}
|
2011-10-27 19:43:20 +00:00
|
|
|
|
|
|
|
maildir_copy_with_hardlinks = yes
|
2015-12-09 09:27:44 +00:00
|
|
|
pop3_uidl_format = %08Xv%08Xu
|
2011-10-27 19:43:20 +00:00
|
|
|
|
|
|
|
auth_mechanisms = plain login
|
2015-12-09 09:27:44 +00:00
|
|
|
|
2011-10-27 19:43:20 +00:00
|
|
|
service auth {
|
|
|
|
user = root
|
|
|
|
}
|
2015-12-09 09:27:44 +00:00
|
|
|
''
|
|
|
|
|
|
|
|
(optionalString cfg.enablePAM ''
|
2011-10-27 19:43:20 +00:00
|
|
|
userdb {
|
2011-10-27 22:04:08 +00:00
|
|
|
driver = passwd
|
2011-10-27 19:43:20 +00:00
|
|
|
}
|
2015-12-09 09:27:44 +00:00
|
|
|
|
2011-10-27 19:43:20 +00:00
|
|
|
passdb {
|
2011-10-27 22:04:08 +00:00
|
|
|
driver = pam
|
2013-03-30 21:25:19 +00:00
|
|
|
args = ${optionalString cfg.showPAMFailure "failure_show_msg=yes"} dovecot2
|
2011-10-27 19:43:20 +00:00
|
|
|
}
|
2015-12-09 09:27:44 +00:00
|
|
|
'')
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2016-01-10 04:05:12 +00:00
|
|
|
(optionalString (cfg.sieveScripts != {}) ''
|
|
|
|
plugin {
|
|
|
|
${concatStringsSep "\n" (mapAttrsToList (to: from: "sieve_${to} = ${stateDir}/sieve/${to}") cfg.sieveScripts)}
|
|
|
|
}
|
|
|
|
'')
|
|
|
|
|
2017-11-14 15:49:00 +00:00
|
|
|
(optionalString (cfg.mailboxes != []) ''
|
2017-08-15 10:14:29 +00:00
|
|
|
protocol imap {
|
|
|
|
namespace inbox {
|
|
|
|
inbox=yes
|
|
|
|
${concatStringsSep "\n" (map mailboxConfig cfg.mailboxes)}
|
|
|
|
}
|
|
|
|
}
|
2017-11-14 15:49:00 +00:00
|
|
|
'')
|
2017-08-15 10:14:29 +00:00
|
|
|
|
|
|
|
(optionalString cfg.enableQuota ''
|
|
|
|
mail_plugins = $mail_plugins quota
|
|
|
|
service quota-status {
|
|
|
|
executable = ${dovecotPkg}/libexec/dovecot/quota-status -p postfix
|
|
|
|
inet_listener {
|
|
|
|
port = ${cfg.quotaPort}
|
|
|
|
}
|
|
|
|
client_limit = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
protocol imap {
|
|
|
|
mail_plugins = $mail_plugins imap_quota
|
|
|
|
}
|
|
|
|
|
|
|
|
plugin {
|
|
|
|
quota_rule = *:storage=${cfg.quotaGlobalPerUser}
|
|
|
|
quota = maildir:User quota # per virtual mail user quota # BUG/FIXME broken, we couldn't get this working
|
|
|
|
quota_status_success = DUNNO
|
|
|
|
quota_status_nouser = DUNNO
|
|
|
|
quota_status_overquota = "552 5.2.2 Mailbox is full"
|
|
|
|
quota_grace = 10%%
|
|
|
|
}
|
|
|
|
'')
|
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
cfg.extraConfig
|
|
|
|
];
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2016-04-26 12:10:42 +00:00
|
|
|
modulesDir = pkgs.symlinkJoin {
|
|
|
|
name = "dovecot-modules";
|
|
|
|
paths = map (pkg: "${pkg}/lib/dovecot") ([ dovecotPkg ] ++ map (module: module.override { dovecot = dovecotPkg; }) cfg.modules);
|
|
|
|
};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2017-08-15 10:14:29 +00:00
|
|
|
mailboxConfig = mailbox: ''
|
2018-02-05 16:06:49 +00:00
|
|
|
mailbox "${mailbox.name}" {
|
2017-08-15 10:14:29 +00:00
|
|
|
auto = ${toString mailbox.auto}
|
|
|
|
'' + optionalString (mailbox.specialUse != null) ''
|
|
|
|
special_use = \${toString mailbox.specialUse}
|
|
|
|
'' + "}";
|
|
|
|
|
2018-07-20 20:56:59 +00:00
|
|
|
mailboxes = { ... }: {
|
2017-08-15 10:14:29 +00:00
|
|
|
options = {
|
|
|
|
name = mkOption {
|
2018-02-09 11:20:55 +00:00
|
|
|
type = types.strMatching ''[^"]+'';
|
2017-08-15 10:14:29 +00:00
|
|
|
example = "Spam";
|
|
|
|
description = "The name of the mailbox.";
|
|
|
|
};
|
|
|
|
auto = mkOption {
|
|
|
|
type = types.enum [ "no" "create" "subscribe" ];
|
|
|
|
default = "no";
|
|
|
|
example = "subscribe";
|
|
|
|
description = "Whether to automatically create or create and subscribe to the mailbox or not.";
|
|
|
|
};
|
|
|
|
specialUse = mkOption {
|
|
|
|
type = types.nullOr (types.enum [ "All" "Archive" "Drafts" "Flagged" "Junk" "Sent" "Trash" ]);
|
|
|
|
default = null;
|
|
|
|
example = "Junk";
|
|
|
|
description = "Null if no special use flag is set. Other than that every use flag mentioned in the RFC is valid.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2015-12-09 09:27:44 +00:00
|
|
|
in
|
2011-10-27 19:43:20 +00:00
|
|
|
{
|
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
options.services.dovecot2 = {
|
|
|
|
enable = mkEnableOption "Dovecot 2.x POP3/IMAP server";
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
enablePop3 = mkOption {
|
|
|
|
type = types.bool;
|
2017-08-15 10:14:29 +00:00
|
|
|
default = false;
|
2015-12-09 09:27:44 +00:00
|
|
|
description = "Start the POP3 listener (when Dovecot is enabled).";
|
|
|
|
};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
enableImap = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = "Start the IMAP listener (when Dovecot is enabled).";
|
|
|
|
};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
enableLmtp = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Start the LMTP listener (when Dovecot is enabled).";
|
|
|
|
};
|
2012-09-29 22:53:50 +00:00
|
|
|
|
2016-01-10 03:54:07 +00:00
|
|
|
protocols = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
|
|
|
description = "Additional listeners to start when Dovecot is enabled.";
|
|
|
|
};
|
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
user = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "dovecot2";
|
|
|
|
description = "Dovecot user name.";
|
|
|
|
};
|
2015-07-02 21:26:49 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
group = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "dovecot2";
|
|
|
|
description = "Dovecot group name.";
|
|
|
|
};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
extraConfig = mkOption {
|
2016-10-23 17:33:41 +00:00
|
|
|
type = types.lines;
|
2015-12-09 09:27:44 +00:00
|
|
|
default = "";
|
|
|
|
example = "mail_debug = yes";
|
|
|
|
description = "Additional entries to put verbatim into Dovecot's config file.";
|
|
|
|
};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
configFile = mkOption {
|
2019-10-04 07:57:06 +00:00
|
|
|
type = types.nullOr types.path;
|
2015-12-09 09:27:44 +00:00
|
|
|
default = null;
|
|
|
|
description = "Config file used for the whole dovecot configuration.";
|
|
|
|
apply = v: if v != null then v else pkgs.writeText "dovecot.conf" dovecotConf;
|
|
|
|
};
|
2012-09-21 14:04:46 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
mailLocation = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "maildir:/var/spool/mail/%u"; /* Same as inbox, as postfix */
|
|
|
|
example = "maildir:~/mail:INBOX=/var/spool/mail/%u";
|
|
|
|
description = ''
|
|
|
|
Location that dovecot will use for mail folders. Dovecot mail_location option.
|
|
|
|
'';
|
|
|
|
};
|
2015-01-19 09:45:20 +00:00
|
|
|
|
2016-01-10 04:07:26 +00:00
|
|
|
mailUser = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
description = "Default user to store mail for virtual users.";
|
|
|
|
};
|
|
|
|
|
|
|
|
mailGroup = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
description = "Default group to store mail for virtual users.";
|
|
|
|
};
|
|
|
|
|
2017-08-15 10:14:29 +00:00
|
|
|
createMailUser = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''Whether to automatically create the user
|
|
|
|
given in <option>services.dovecot.user</option> and the group
|
|
|
|
given in <option>services.dovecot.group</option>.'';
|
|
|
|
};
|
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
modules = mkOption {
|
|
|
|
type = types.listOf types.package;
|
|
|
|
default = [];
|
2016-01-17 18:34:55 +00:00
|
|
|
example = literalExample "[ pkgs.dovecot_pigeonhole ]";
|
2015-12-09 09:27:44 +00:00
|
|
|
description = ''
|
|
|
|
Symlinks the contents of lib/dovecot of every given package into
|
2016-01-10 04:00:34 +00:00
|
|
|
/etc/dovecot/modules. This will make the given modules available
|
2016-04-22 15:21:17 +00:00
|
|
|
if a dovecot package with the module_dir patch applied is being used.
|
2015-12-09 09:27:44 +00:00
|
|
|
'';
|
|
|
|
};
|
2012-06-10 15:07:25 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
sslCACert = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
description = "Path to the server's CA certificate key.";
|
|
|
|
};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
sslServerCert = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
description = "Path to the server's public key.";
|
|
|
|
};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
sslServerKey = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
description = "Path to the server's private key.";
|
|
|
|
};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
enablePAM = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2016-01-06 20:09:06 +00:00
|
|
|
description = "Whether to create a own Dovecot PAM service and configure PAM user logins.";
|
2011-10-27 19:43:20 +00:00
|
|
|
};
|
|
|
|
|
2016-01-10 04:05:12 +00:00
|
|
|
sieveScripts = mkOption {
|
|
|
|
type = types.attrsOf types.path;
|
|
|
|
default = {};
|
|
|
|
description = "Sieve scripts to be executed. Key is a sequence, e.g. 'before2', 'after' etc.";
|
|
|
|
};
|
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
showPAMFailure = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Show the PAM failure message on authentication error (useful for OTPW).";
|
|
|
|
};
|
2017-08-15 10:14:29 +00:00
|
|
|
|
|
|
|
mailboxes = mkOption {
|
|
|
|
type = types.listOf (types.submodule mailboxes);
|
|
|
|
default = [];
|
|
|
|
example = [ { name = "Spam"; specialUse = "Junk"; auto = "create"; } ];
|
|
|
|
description = "Configure mailboxes and auto create or subscribe them.";
|
|
|
|
};
|
|
|
|
|
|
|
|
enableQuota = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "Whether to enable the dovecot quota service.";
|
|
|
|
};
|
|
|
|
|
|
|
|
quotaPort = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "12340";
|
|
|
|
description = ''
|
|
|
|
The Port the dovecot quota service binds to.
|
|
|
|
If using postfix, add check_policy_service inet:localhost:12340 to your smtpd_recipient_restrictions in your postfix config.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
quotaGlobalPerUser = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "100G";
|
|
|
|
example = "10G";
|
|
|
|
description = "Quota limit for the user in bytes. Supports suffixes b, k, M, G, T and %.";
|
|
|
|
};
|
|
|
|
|
2011-10-27 19:43:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
security.pam.services.dovecot2 = mkIf cfg.enablePAM {};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2019-04-24 03:48:22 +00:00
|
|
|
security.dhparams = mkIf (cfg.sslServerCert != null) {
|
2018-04-25 21:18:26 +00:00
|
|
|
enable = true;
|
2018-05-10 06:29:29 +00:00
|
|
|
params.dovecot2 = {};
|
2018-04-25 21:18:26 +00:00
|
|
|
};
|
|
|
|
services.dovecot2.protocols =
|
2016-01-10 03:54:07 +00:00
|
|
|
optional cfg.enableImap "imap"
|
|
|
|
++ optional cfg.enablePop3 "pop3"
|
|
|
|
++ optional cfg.enableLmtp "lmtp";
|
|
|
|
|
2018-06-29 23:58:35 +00:00
|
|
|
users.users = [
|
2011-10-27 19:43:20 +00:00
|
|
|
{ name = "dovenull";
|
|
|
|
uid = config.ids.uids.dovenull2;
|
|
|
|
description = "Dovecot user for untrusted logins";
|
2018-10-22 17:57:32 +00:00
|
|
|
group = "dovenull";
|
2011-10-27 19:43:20 +00:00
|
|
|
}
|
2016-01-06 22:27:06 +00:00
|
|
|
] ++ optional (cfg.user == "dovecot2")
|
|
|
|
{ name = "dovecot2";
|
|
|
|
uid = config.ids.uids.dovecot2;
|
|
|
|
description = "Dovecot user";
|
|
|
|
group = cfg.group;
|
2017-08-15 10:14:29 +00:00
|
|
|
}
|
2017-09-17 01:11:01 +00:00
|
|
|
++ optional (cfg.createMailUser && cfg.mailUser != null)
|
|
|
|
({ name = cfg.mailUser;
|
|
|
|
description = "Virtual Mail User";
|
|
|
|
} // optionalAttrs (cfg.mailGroup != null) {
|
2017-08-15 10:14:29 +00:00
|
|
|
group = cfg.mailGroup;
|
2017-09-17 01:11:01 +00:00
|
|
|
});
|
2016-01-06 22:27:06 +00:00
|
|
|
|
2018-06-29 23:58:35 +00:00
|
|
|
users.groups = optional (cfg.group == "dovecot2")
|
2016-01-06 22:27:06 +00:00
|
|
|
{ name = "dovecot2";
|
|
|
|
gid = config.ids.gids.dovecot2;
|
2017-08-15 10:14:29 +00:00
|
|
|
}
|
2017-09-17 01:11:01 +00:00
|
|
|
++ optional (cfg.createMailUser && cfg.mailGroup != null)
|
2017-08-15 10:14:29 +00:00
|
|
|
{ name = cfg.mailGroup;
|
2018-10-22 17:57:32 +00:00
|
|
|
}
|
|
|
|
++ singleton
|
|
|
|
{ name = "dovenull";
|
|
|
|
gid = config.ids.gids.dovenull2;
|
2016-01-06 22:27:06 +00:00
|
|
|
};
|
2015-01-19 09:45:20 +00:00
|
|
|
|
2016-01-10 04:00:34 +00:00
|
|
|
environment.etc."dovecot/modules".source = modulesDir;
|
2016-01-10 04:02:24 +00:00
|
|
|
environment.etc."dovecot/dovecot.conf".source = cfg.configFile;
|
2016-01-10 04:00:34 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
systemd.services.dovecot2 = {
|
|
|
|
description = "Dovecot IMAP/POP3 server";
|
|
|
|
|
2019-08-24 14:52:17 +00:00
|
|
|
after = [ "network.target" ];
|
2015-12-09 09:27:44 +00:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2016-01-10 04:02:24 +00:00
|
|
|
restartTriggers = [ cfg.configFile ];
|
2015-12-09 09:27:44 +00:00
|
|
|
|
|
|
|
serviceConfig = {
|
2016-01-10 04:02:24 +00:00
|
|
|
ExecStart = "${dovecotPkg}/sbin/dovecot -F";
|
|
|
|
ExecReload = "${dovecotPkg}/sbin/doveadm reload";
|
2015-12-09 09:27:44 +00:00
|
|
|
Restart = "on-failure";
|
|
|
|
RestartSec = "1s";
|
|
|
|
StartLimitInterval = "1min";
|
2016-01-09 01:15:25 +00:00
|
|
|
RuntimeDirectory = [ "dovecot2" ];
|
2011-10-27 19:43:20 +00:00
|
|
|
};
|
2016-01-10 04:05:12 +00:00
|
|
|
|
2017-01-13 21:19:29 +00:00
|
|
|
# When copying sieve scripts preserve the original time stamp
|
|
|
|
# (should be 0) so that the compiled sieve script is newer than
|
|
|
|
# the source file and Dovecot won't try to compile it.
|
2016-01-10 04:05:12 +00:00
|
|
|
preStart = ''
|
|
|
|
rm -rf ${stateDir}/sieve
|
|
|
|
'' + optionalString (cfg.sieveScripts != {}) ''
|
|
|
|
mkdir -p ${stateDir}/sieve
|
|
|
|
${concatStringsSep "\n" (mapAttrsToList (to: from: ''
|
|
|
|
if [ -d '${from}' ]; then
|
|
|
|
mkdir '${stateDir}/sieve/${to}'
|
2017-01-13 21:19:29 +00:00
|
|
|
cp -p "${from}/"*.sieve '${stateDir}/sieve/${to}'
|
2016-01-10 04:05:12 +00:00
|
|
|
else
|
2017-01-13 21:19:29 +00:00
|
|
|
cp -p '${from}' '${stateDir}/sieve/${to}'
|
2016-01-10 04:05:12 +00:00
|
|
|
fi
|
2017-01-13 21:19:29 +00:00
|
|
|
${pkgs.dovecot_pigeonhole}/bin/sievec '${stateDir}/sieve/${to}'
|
2016-01-10 04:05:12 +00:00
|
|
|
'') cfg.sieveScripts)}
|
2016-01-10 04:07:26 +00:00
|
|
|
chown -R '${cfg.mailUser}:${cfg.mailGroup}' '${stateDir}/sieve'
|
2016-01-10 04:05:12 +00:00
|
|
|
'';
|
2015-12-09 09:27:44 +00:00
|
|
|
};
|
2011-10-27 19:43:20 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
environment.systemPackages = [ dovecotPkg ];
|
2011-10-27 22:04:08 +00:00
|
|
|
|
2015-12-09 09:27:44 +00:00
|
|
|
assertions = [
|
2016-01-10 03:54:07 +00:00
|
|
|
{ assertion = intersectLists cfg.protocols [ "pop3" "imap" ] != [];
|
2015-12-09 09:27:44 +00:00
|
|
|
message = "dovecot needs at least one of the IMAP or POP3 listeners enabled";
|
|
|
|
}
|
2019-04-24 03:48:22 +00:00
|
|
|
{ assertion = (cfg.sslServerCert == null) == (cfg.sslServerKey == null)
|
|
|
|
&& (cfg.sslCACert != null -> !(cfg.sslServerCert == null || cfg.sslServerKey == null));
|
2015-12-09 09:27:44 +00:00
|
|
|
message = "dovecot needs both sslServerCert and sslServerKey defined for working crypto";
|
|
|
|
}
|
|
|
|
{ assertion = cfg.showPAMFailure -> cfg.enablePAM;
|
|
|
|
message = "dovecot is configured with showPAMFailure while enablePAM is disabled";
|
|
|
|
}
|
2019-04-24 03:48:22 +00:00
|
|
|
{ assertion = cfg.sieveScripts != {} -> (cfg.mailUser != null && cfg.mailGroup != null);
|
2016-09-07 01:39:18 +00:00
|
|
|
message = "dovecot requires mailUser and mailGroup to be set when sieveScripts is set";
|
|
|
|
}
|
2015-12-09 09:27:44 +00:00
|
|
|
];
|
2012-09-29 22:53:50 +00:00
|
|
|
|
2011-10-27 19:43:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|