mirror of
https://github.com/docker-mailserver/docker-mailserver
synced 2026-11-21 13:44:26 +01:00
* 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
51 lines
2.0 KiB
Plaintext
51 lines
2.0 KiB
Plaintext
# NOTE: This is effectively the same default LDAP config shipped by Dovecot
|
|
# The only difference is the addition of the passdb mechanisms field,
|
|
# which restricts what auth mechanisms are supported / expected.
|
|
# This prevents unnecessary auth failure logs triggering Fail2Ban when
|
|
# additional passdb are enabled (OAuth2).
|
|
|
|
# Values for these settings are replaced during container init from ENV values (via `scripts/startup/setup.d/ldap.sh`):
|
|
ldap_uris = ldap://mail.example.com
|
|
ldap_base = ou=people,dc=example,dc=com
|
|
ldap_auth_dn = cn=admin,dc=example,dc=com
|
|
ldap_auth_dn_password = secret
|
|
ldap_starttls = no
|
|
ldap_version = 3
|
|
passdb_default_password_scheme = SSHA
|
|
|
|
# TODO: Add breaking change after migration to Dovecot 2.4 is completed.
|
|
# The `filter` setting for both passdb + userdb config below should be changed (`uniqueIdentifier` => `userID`) to:
|
|
# (&(objectClass=PostfixBookMailAccount)(userID=%{user | username}))
|
|
#
|
|
# NOTE: Additionally requires changes:
|
|
# - Test `mail_with_ldap.bats`: This change removes the need for the modification of the filter(s) via ENV.
|
|
# - Docs: Update on pages related to LDAP config with content related to the changed filter value.
|
|
|
|
passdb ldap {
|
|
driver = ldap
|
|
|
|
fields {
|
|
# DOVECOT_PASSDB_FIELDS
|
|
user = %{ldap:uniqueIdentifier}
|
|
password = %{ldap:userPassword}
|
|
}
|
|
}
|
|
|
|
userdb ldap {
|
|
driver = ldap
|
|
|
|
fields {
|
|
# DOVECOT_USERDB_FIELDS
|
|
uid = %{ldap:mailUidNumber}
|
|
gid = %{ldap:mailGidNumber}
|
|
home = %{ldap:mailHomeDirectory}
|
|
mail_path = %{ldap:mailStorageDirectory}
|
|
}
|
|
}
|
|
|
|
# Set the `filter` field of the above passdb + userdb `ldap` blocks
|
|
# This long-form namespaced form for the settings are easier for DMS scripts (ldap.sh) to target for replacement support:
|
|
passdb_ldap_bind = no
|
|
passdb_ldap_filter = (&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%{user | username}))
|
|
userdb_ldap_filter = (&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%{user | username}))
|