diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-11-17 14:47:35 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-11-17 14:47:35 +0100 |
commit | 98f8f4de86129f52b5c983d8f16ee310bd3b5b24 (patch) | |
tree | c0f4411e69211bba7ab35c3044eaa2ef1013c375 | |
parent | 2a61e9daed5d5a378cee46a60597692804e4b70c (diff) | |
download | Nix-98f8f4de86129f52b5c983d8f16ee310bd3b5b24.tar.gz Nix-98f8f4de86129f52b5c983d8f16ee310bd3b5b24.tar.zst Nix-98f8f4de86129f52b5c983d8f16ee310bd3b5b24.zip |
Add cleanup cron job for dovecot
-rw-r--r-- | modules/private/mail/dovecot.nix | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/modules/private/mail/dovecot.nix b/modules/private/mail/dovecot.nix index 6220da2..6c3b4b8 100644 --- a/modules/private/mail/dovecot.nix +++ b/modules/private/mail/dovecot.nix | |||
@@ -37,11 +37,13 @@ in | |||
37 | base = ${myconfig.env.mail.dovecot.ldap.base} | 37 | base = ${myconfig.env.mail.dovecot.ldap.base} |
38 | scope = subtree | 38 | scope = subtree |
39 | 39 | ||
40 | user_filter = ${myconfig.env.mail.dovecot.ldap.filter} | ||
41 | pass_filter = ${myconfig.env.mail.dovecot.ldap.filter} | 40 | pass_filter = ${myconfig.env.mail.dovecot.ldap.filter} |
41 | pass_attrs = ${myconfig.env.mail.dovecot.ldap.pass_attrs} | ||
42 | 42 | ||
43 | user_attrs = ${myconfig.env.mail.dovecot.ldap.user_attrs} | 43 | user_attrs = ${myconfig.env.mail.dovecot.ldap.user_attrs} |
44 | pass_attrs = ${myconfig.env.mail.dovecot.ldap.pass_attrs} | 44 | user_filter = ${myconfig.env.mail.dovecot.ldap.filter} |
45 | iterate_attrs = ${myconfig.env.mail.dovecot.ldap.iterate_attrs} | ||
46 | iterate_filter = ${myconfig.env.mail.dovecot.ldap.iterate_filter} | ||
45 | ''; | 47 | ''; |
46 | } | 48 | } |
47 | ]; | 49 | ]; |
@@ -185,8 +187,8 @@ in | |||
185 | args = ${config.secrets.fullPaths."dovecot/ldap"} | 187 | args = ${config.secrets.fullPaths."dovecot/ldap"} |
186 | } | 188 | } |
187 | userdb { | 189 | userdb { |
188 | driver = static | 190 | driver = ldap |
189 | args = user=%u uid=vhost gid=vhost home=/var/lib/vhost/%d/%n/ mail=mbox:~/Mail:INBOX=~/Mail/Inbox:INDEX=~/.imap | 191 | args = ${config.secrets.fullPaths."dovecot/ldap"} |
190 | } | 192 | } |
191 | '' | 193 | '' |
192 | 194 | ||
@@ -239,6 +241,16 @@ in | |||
239 | ''; | 241 | ''; |
240 | }; | 242 | }; |
241 | 243 | ||
244 | services.cron.systemCronJobs = let | ||
245 | cron_script = pkgs.writeScriptBin "cleanup-imap-folders" '' | ||
246 | ${pkgs.dovecot}/bin/doveadm expunge -A MAILBOX "Backup/*" NOT UID 1:256 | ||
247 | ${pkgs.dovecot}/bin/doveadm expunge -A MAILBOX Junk SEEN NOT FLAGGED BEFORE 4w | ||
248 | ${pkgs.dovecot}/bin/doveadm search -A MAILBOX Trash NOT FLAGGED BEFORE 4w | ||
249 | ''; | ||
250 | in | ||
251 | [ | ||
252 | "0 2 * * * root ${cron_script}/bin/cleanup-imap-folders" | ||
253 | ]; | ||
242 | security.acme.certs."mail" = { | 254 | security.acme.certs."mail" = { |
243 | postRun = '' | 255 | postRun = '' |
244 | systemctl restart dovecot2.service | 256 | systemctl restart dovecot2.service |