Files
Georg Lauterbach 79b66c8b89 config(dovecot)!: ship a self-reliant configuration (#4861)
* breaking(dovecot): ship a self-reliant Dovecot configuration

DMS imported the config files of Debian's Dovecot package at build time
and patched them with `sed` at startup. For the Dovecot Community Edition
(CE) it even downloaded Debian's packages only to extract their config.
The result depended on whatever the packages shipped, and every feature
toggle was an `!include` line that a script had to comment or uncomment.

Provide the complete configuration in the repository instead:

- `target/dovecot/dovecot.conf` replaces the `10-*`, `15-*`, `20-*` and
  `90-*` files as well as the `*.inc` files. Everything that is not set
  there uses Dovecot's built-in defaults.
- `target/dovecot/features/` holds the optional parts (passwd-file, LDAP
  and OAuth2 authentication, quotas, Rspamd learning). Startup copies the
  ones that are enabled into the empty `/etc/dovecot/conf.d/`, which
  `dovecot.conf` includes before `local.conf` (`dovecot.cf`).
- The scripts only substitute ENV-derived values now; the include
  toggling and the second `sed` per feature are gone.
- Drop the Debian config import and the CE-only download from the build.

Breaking: files that users replaced, bind-mounted or patched in
`/etc/dovecot/conf.d/` no longer exist (see the changelog for the
mapping). Debian's deprecated ManageSieve listener on port 2000 and its
`fts_autoindex*` defaults are gone as well.

Add tests for the removed port 2000 and for a valid `doveconf -n` with the
protocols enabled according to ENV, and adjust the existing tests and
fixtures to the new file layout. Rewrite the Dovecot override docs.

Closes #4841

* fix(dovecot): load enabled features before user supplied config

Features that DMS enables were copied to `conf.d/`, so Dovecot read them
in file name order together with user drop-ins. A user file such as
`90-custom.conf` was read before `quota.conf` or `auth-ldap.conf`, and the
feature silently overrode the user's settings.

- copy enabled features to `/etc/dovecot/features.d/` instead, which
  `dovecot.conf` includes before `conf.d/*.conf`
- include the master user passdb before `conf.d/*.conf` as well, so a
  drop-in can override `auth_master_user_separator`
- create `features.d/auth-ldap.conf` with mode 640 (group `dovecot`), as
  it contains the LDAP bind password
- link the changelog entries to the PR, document the always-active master
  passdb, and adjust docs and tests to the new layout
- test that a `conf.d/` file overrides the quota feature, and that
  `auth-ldap.conf` is not world-readable
2026-11-18 17:59:30 +01:00

111 lines
2.8 KiB
Plaintext

# Quota configuration
#
# Copied to `features.d/` by `_setup_dovecot_quota` when quotas are enabled (`ENABLE_QUOTAS`).
#
# ref: https://doc.dovecot.org/main/core/plugins/quota.html
#
# ## Commands
#
# - debug quota: doveadm quota get -u <USER>@<DOMAIN>
# - recompute quota: doveadm quota recalc -u <USER>@<DOMAIN>
# Load the quota plugin, and allow IMAP clients to ask quota usage
mail_plugins {
quota = yes
}
protocol imap {
mail_plugins {
imap_quota = yes
}
}
# The quota driver to use
#
# ref: https://doc.dovecot.org/main/core/plugins/quota.html#driver-count
quota_driver = count
# The maximum message size to be saved
#
# Sync this setting with Postfix.
#
# ref: https://doc.dovecot.org/main/core/summaries/settings.html#quota_mail_size
quota_mail_size = 10000M
# Default quota per mailbox
#
# Sync this setting with Postfix.
#
# ref: https://doc.dovecot.org/main/core/plugins/quota.html#quota-limits
quota_storage_size = 128M
# Allow additional space when deleting messages
#
# ref: https://doc.dovecot.org/main/core/plugins/quota.html#quota_storage_extra
mailbox Trash {
quota_storage_extra = 50M
}
# Last delivery may exceed quota once by this amount (Dovecot 2.4 uses a size, not a
# percentage). 10M is ~10% of the default 128M mailbox (2.3 used quota_grace = 10%).
# Per-user quotas set userdb_quota_storage_grace to 10% of that quota in accounts.sh.
#
# ref: https://doc.dovecot.org/main/core/plugins/quota.html#quota-grace
quota_storage_grace = 10M
# Warnings
#
# ref: https://doc.dovecot.org/main/core/plugins/quota.html#quota-warning-scripts
quota user {
warning warn-80 {
quota_storage_percentage = 80
execute quota-warning {
args = 80 %{user}
}
}
warning warn-95 {
quota_storage_percentage = 95
execute quota-warning {
args = 95 %{user}
}
}
warning warn-under {
quota_storage_percentage = 100
# user is no longer over quota
threshold = under
execute quota-warning {
args = below %{user}
}
}
}
service quota-warning {
executable = script /usr/local/bin/quota-warning
# Mail processes run as `docker` (uid 5000) and must be able to connect.
user = docker
unix_listener quota-warning {
user = docker
group = docker
mode = 0600
}
}
# Allow postfix to query quota
#
# ref: https://doc.dovecot.org/main/core/plugins/quota.html#quota-service
service quota-status {
executable = quota-status -p postfix
inet_listener quota-status {
listen = 127.0.0.1
port = 65265
}
client_limit = 1
}
# Defer quota decisions for users unknown to Dovecot until Postfix expands aliases.
quota_status_success = DUNNO
quota_status_nouser = DUNNO
quota_status_overquota = "552 5.2.2 Mailbox is full"