diff --git a/roles/mail/templates/dovecot-backend/conf.d/10-mail.conf b/roles/mail/templates/dovecot-backend/conf.d/10-mail.conf index 392d92b59f792a9fd35348c46b20fd7ba62bdc16..fbea5a74f52a0a2a11074e428454ea50cd2483cd 100644 --- a/roles/mail/templates/dovecot-backend/conf.d/10-mail.conf +++ b/roles/mail/templates/dovecot-backend/conf.d/10-mail.conf @@ -212,7 +212,7 @@ first_valid_uid = 100 # Space separated list of plugins to load for all services. Plugins specific to # IMAP, LDA, etc. are added to this list in their own .conf files. -mail_plugins = mail_crypt zlib +mail_plugins = mail_crypt quota zlib plugin { # Disable encryption by default, dovecot-keylookupd will then set @@ -226,7 +226,7 @@ plugin { # Mailbox list indexes can be used to optimize IMAP STATUS commands. They are # also required for IMAP NOTIFY extension to be enabled. -#mailbox_list_index = no +mailbox_list_index = yes # The minimum number of mails in a mailbox before updates are done to cache # file. This allows optimizing Dovecot's behavior to do less disk writes at diff --git a/roles/mail/templates/dovecot/conf.d/20-imap.conf b/roles/mail/templates/dovecot/conf.d/20-imap.conf index eca1bdf5538f5784a23d26d29408e89f5bb45e72..325e85c4fee9054214f95357054475c71bbb1ddd 100644 --- a/roles/mail/templates/dovecot/conf.d/20-imap.conf +++ b/roles/mail/templates/dovecot/conf.d/20-imap.conf @@ -67,7 +67,7 @@ imap_client_workarounds = delay-newmail tb-extra-mailbox-sep tb-lsub-flags protocol imap { # Space separated list of plugins to load (default is global mail_plugins). - mail_plugins = $mail_plugins imap_sieve imap_zlib + mail_plugins = $mail_plugins imap_quota imap_sieve imap_zlib # Maximum number of IMAP connections allowed for a user from each IP address. # NOTE: The username is compared case-sensitively. diff --git a/roles/mail/templates/dovecot/conf.d/90-quota.conf b/roles/mail/templates/dovecot/conf.d/90-quota.conf index db1f718815d6cf8d93b574f2581c778139b48f62..dfaa5940a7f270f26b78912f3ad6ebf00fdaade7 100644 --- a/roles/mail/templates/dovecot/conf.d/90-quota.conf +++ b/roles/mail/templates/dovecot/conf.d/90-quota.conf @@ -9,72 +9,20 @@ ## Quota limits ## -# Quota limits are set using "quota_rule" parameters. To get per-user quota -# limits, you can set/override them by returning "quota_rule" extra field -# from userdb. It's also possible to give mailbox-specific limits, for example -# to give additional 100 MB when saving to Trash: - -plugin { - #quota_rule = *:storage=1G - #quota_rule2 = Trash:storage=+100M - - # LDA/LMTP allows saving the last mail to bring user from under quota to - # over quota, if the quota doesn't grow too high. Default is to allow as - # long as quota will stay under 10% above the limit. Also allowed e.g. 10M. - #quota_grace = 10%% +# Avoid spending excessive time waiting for the quota calculation to finish +# when mails' vsizes aren't already cached. If this many mails are opened, +# finish the quota calculation on background in indexer-worker process. Mail +# deliveries will be assumed to succeed, and explicit quota lookups will +# return internal error. (v2.2.28+) +protocol !indexer-worker { + mail_vsize_bg_after_count = 100 } -## -## Quota warnings -## - -# You can execute a given command when user exceeds a specified quota limit. -# Each quota root has separate limits. Only the command for the first -# exceeded limit is excecuted, so put the highest limit first. -# The commands are executed via script service by connecting to the named -# UNIX socket (quota-warning below). -# Note that % needs to be escaped as %%, otherwise "% " expands to empty. - +# Without a quota_rule we can use the quota system to report usage to users. plugin { - #quota_warning = storage=95%% quota-warning 95 %u - #quota_warning2 = storage=80%% quota-warning 80 %u -} - -# Example quota-warning service. The unix listener's permissions should be -# set in a way that mail processes can connect to it. Below example assumes -# that mail processes run as vmail user. If you use mode=0666, all system users -# can generate quota warnings to anyone. -#service quota-warning { -# executable = script /usr/local/bin/quota-warning.sh -# user = dovecot -# unix_listener quota-warning { -# user = vmail -# } -#} - -## -## Quota backends -## - -# Multiple backends are supported: -# dirsize: Find and sum all the files found from mail directory. -# Extremely SLOW with Maildir. It'll eat your CPU and disk I/O. -# dict: Keep quota stored in dictionary (eg. SQL) -# maildir: Maildir++ quota -# fs: Read-only support for filesystem quota + #quota_rule = *:storage=1G -plugin { - #quota = dirsize:User quota - #quota = maildir:User quota - #quota = dict:User quota::proxy::quota - #quota = fs:User quota + quota = count:User quota + quota_vsizes = yes } -# Multiple quota roots are also possible, for example this gives each user -# their own 100MB quota and one shared 1GB quota within the domain: -plugin { - #quota = dict:user::proxy::quota - #quota2 = dict:domain:%d:proxy::quota_domain - #quota_rule = *:storage=102400 - #quota2_rule = *:storage=1048576 -}