From 702f83ed44c85167a3f8009c9351e3184a011eda Mon Sep 17 00:00:00 2001 From: cronekorkn Date: Tue, 18 Oct 2022 18:14:58 +0200 Subject: [PATCH] devocot optimize index --- bundles/dovecot/files/dovecot-sql.conf | 9 ++++++++- bundles/dovecot/files/dovecot.conf | 18 +++++++++--------- bundles/dovecot/metadata.py | 6 ++++++ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/bundles/dovecot/files/dovecot-sql.conf b/bundles/dovecot/files/dovecot-sql.conf index fd088e3..8f26825 100644 --- a/bundles/dovecot/files/dovecot-sql.conf +++ b/bundles/dovecot/files/dovecot-sql.conf @@ -2,7 +2,14 @@ connect = host=${host} dbname=${name} user=${user} password=${password} driver = pgsql default_pass_scheme = ARGON2ID -password_query = SELECT CONCAT(users.name, '@', domains.name) AS user, password\ +user_query = SELECT '/var/vmail/%u' AS home, 'vmail' AS uid, 'vmail' AS gid + +iterate_query = SELECT CONCAT(users.name, '@', domains.name) AS user \ + FROM users \ + LEFT JOIN domains ON users.domain_id = domains.id \ + WHERE redirect IS NULL + +password_query = SELECT CONCAT(users.name, '@', domains.name) AS user, password \ FROM users \ LEFT JOIN domains ON users.domain_id = domains.id \ WHERE redirect IS NULL \ diff --git a/bundles/dovecot/files/dovecot.conf b/bundles/dovecot/files/dovecot.conf index 2e110a9..5b76378 100644 --- a/bundles/dovecot/files/dovecot.conf +++ b/bundles/dovecot/files/dovecot.conf @@ -13,19 +13,19 @@ namespace inbox { inbox = yes separator = . mailbox Drafts { - auto = subscribe + auto = subscribe special_use = \Drafts } mailbox Junk { - auto = create + auto = create special_use = \Junk } mailbox Trash { - auto = subscribe + auto = subscribe special_use = \Trash } mailbox Sent { - auto = subscribe + auto = subscribe special_use = \Sent } } @@ -35,8 +35,8 @@ passdb { args = /etc/dovecot/dovecot-sql.conf } userdb { - driver = static - args = uid=vmail gid=vmail home=/var/vmail/%u + driver = sql + args = /etc/dovecot/dovecot-sql.conf } service auth { @@ -80,10 +80,10 @@ protocol imap { mail_plugins = $mail_plugins imap_sieve mail_max_userip_connections = 50 imap_idle_notify_interval = 29 mins -} +} protocol lmtp { mail_plugins = $mail_plugins sieve -} +} protocol sieve { plugin { sieve = /var/vmail/sieve/%u.sieve @@ -117,7 +117,7 @@ plugin { sieve_dir = /var/vmail/sieve/%u/ sieve = /var/vmail/sieve/%u.sieve sieve_pipe_bin_dir = /var/vmail/sieve/bin - sieve_extensions = +vnd.dovecot.pipe + sieve_extensions = +vnd.dovecot.pipe sieve_after = /var/vmail/sieve/global/spam-to-folder.sieve diff --git a/bundles/dovecot/metadata.py b/bundles/dovecot/metadata.py index 855aba2..65344e4 100644 --- a/bundles/dovecot/metadata.py +++ b/bundles/dovecot/metadata.py @@ -29,6 +29,12 @@ defaults = { 'tcp dport {143, 993, 4190} accept', }, }, + 'systemd-timers': { + 'dovecot-optimize-index': { + 'command': '/usr/bin/doveadm fts optimize -A', + 'when': 'daily', + }, + }, } @metadata_reactor.provides(