Enable admin service for dovecot
This commit is contained in:
parent
9bcfef6ab0
commit
3016e938ac
|
@ -188,6 +188,11 @@ in {
|
||||||
type = str;
|
type = str;
|
||||||
description = "Path to LDAP dovecot2 configuration.";
|
description = "Path to LDAP dovecot2 configuration.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
admin-conf = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "Path to admin dovecot2 configuration.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -343,7 +348,7 @@ in {
|
||||||
modules = with pkgs; [ dovecot_pigeonhole ];
|
modules = with pkgs; [ dovecot_pigeonhole ];
|
||||||
protocols = [ "sieve" ];
|
protocols = [ "sieve" ];
|
||||||
|
|
||||||
mailPlugins.globally.enable = [ "old_stats" ];
|
mailPlugins.globally.enable = [ "old_stats" "fts" "fts_solr" ];
|
||||||
|
|
||||||
sieveScripts = {
|
sieveScripts = {
|
||||||
after = builtins.toFile "spam.sieve" ''
|
after = builtins.toFile "spam.sieve" ''
|
||||||
|
@ -379,7 +384,7 @@ in {
|
||||||
in ''
|
in ''
|
||||||
## Extra Config
|
## Extra Config
|
||||||
|
|
||||||
mail_plugins = $mail_plugins fts fts_solr
|
!include ${cfg.admin-conf}
|
||||||
|
|
||||||
${lib.optionalString cfg.debug ''
|
${lib.optionalString cfg.debug ''
|
||||||
mail_debug = yes
|
mail_debug = yes
|
||||||
|
|
|
@ -6,6 +6,11 @@ let
|
||||||
hostname = config.instance.hostname;
|
hostname = config.instance.hostname;
|
||||||
hostSecrets = config.fudo.secrets.host-secrets."${hostname}";
|
hostSecrets = config.fudo.secrets.host-secrets."${hostname}";
|
||||||
metricsPort = 5034;
|
metricsPort = 5034;
|
||||||
|
dovecotAdminPasswd =
|
||||||
|
pkgs.lib.passwd.stablerandom-passwd-file "dovecot-admin-passwd"
|
||||||
|
config.instance.build-seed;
|
||||||
|
dovecotApiKey = pkgs.lib.passwd.stablerandom-passwd-file "dovecot-api-key"
|
||||||
|
config.instance.build-seed;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.fudo.mail = with types; {
|
options.fudo.mail = with types; {
|
||||||
|
@ -242,6 +247,14 @@ in {
|
||||||
]);
|
]);
|
||||||
target-file = "/run/dovecot-secrets/ldap.conf";
|
target-file = "/run/dovecot-secrets/ldap.conf";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dovecotAdminConfig = {
|
||||||
|
source-file = pkgs.writeText "dovecot-admin.conf" (concatStringsSep "\n"
|
||||||
|
[ "doveadm_password = ${readFile dovecotAdminPasswd}" ]
|
||||||
|
++ (optional (cfg.ports.dovecot-http-api != null)
|
||||||
|
"doveadm_api_key = ${readFile dovecotApiKey}"));
|
||||||
|
target-file = "/run/dovecot-secrets/admin.conf";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
|
@ -357,6 +370,7 @@ in {
|
||||||
volumes = [
|
volumes = [
|
||||||
"${cfg.state-directory}/dovecot:/state"
|
"${cfg.state-directory}/dovecot:/state"
|
||||||
"${hostSecrets.dovecotLdapConfig.target-file}:/run/dovecot2/conf.d/ldap.conf:ro"
|
"${hostSecrets.dovecotLdapConfig.target-file}:/run/dovecot2/conf.d/ldap.conf:ro"
|
||||||
|
"${hostSecrets.dovecotAdminConfig.target-file}:/run/dovecot2/conf.d/admin.conf:ro"
|
||||||
"${cfg.imap.ssl-directory}:/run/certs/imap:ro"
|
"${cfg.imap.ssl-directory}:/run/certs/imap:ro"
|
||||||
"${cfg.state-directory}/dovecot-dhparams:/var/lib/dhparams"
|
"${cfg.state-directory}/dovecot-dhparams:/var/lib/dhparams"
|
||||||
"${cfg.state-directory}/mail:/mail"
|
"${cfg.state-directory}/mail:/mail"
|
||||||
|
@ -395,6 +409,7 @@ in {
|
||||||
port = solrPort;
|
port = solrPort;
|
||||||
};
|
};
|
||||||
ldap-conf = "/run/dovecot2/conf.d/ldap.conf";
|
ldap-conf = "/run/dovecot2/conf.d/ldap.conf";
|
||||||
|
admin-conf = "/run/dovecot2/conf.d/admin.conf";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue