mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-06-23 17:29:08 +02:00
fix!: use dovecot's LDAP uris option instead of hosts (#1901)
* Use dovecot's LDAP uris option instead of hosts (fixes #1510) * Clean up variables & environment documentation for #1901 Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com> Co-authored-by: Georg Lauterbach <44545919+aendeavor@users.noreply.github.com>
This commit is contained in:
parent
8313d9753b
commit
94b5ac49c1
4 changed files with 24 additions and 15 deletions
|
@ -437,20 +437,26 @@ function _setup_ldap
|
|||
|
||||
_notify 'inf' "Configuring dovecot LDAP"
|
||||
|
||||
declare -A _dovecot_ldap_mapping
|
||||
declare -A DOVECOT_LDAP_MAPPING
|
||||
|
||||
_dovecot_ldap_mapping["DOVECOT_BASE"]="${DOVECOT_BASE:="${LDAP_SEARCH_BASE}"}"
|
||||
_dovecot_ldap_mapping["DOVECOT_DN"]="${DOVECOT_DN:="${LDAP_BIND_DN}"}"
|
||||
_dovecot_ldap_mapping["DOVECOT_DNPASS"]="${DOVECOT_DNPASS:="${LDAP_BIND_PW}"}"
|
||||
_dovecot_ldap_mapping["DOVECOT_HOSTS"]="${DOVECOT_HOSTS:="${LDAP_SERVER_HOST}"}"
|
||||
DOVECOT_LDAP_MAPPING["DOVECOT_BASE"]="${DOVECOT_BASE:="${LDAP_SEARCH_BASE}"}"
|
||||
DOVECOT_LDAP_MAPPING["DOVECOT_DN"]="${DOVECOT_DN:="${LDAP_BIND_DN}"}"
|
||||
DOVECOT_LDAP_MAPPING["DOVECOT_DNPASS"]="${DOVECOT_DNPASS:="${LDAP_BIND_PW}"}"
|
||||
DOVECOT_LDAP_MAPPING["DOVECOT_URIS"]="${DOVECOT_URIS:="${DOVECOT_HOSTS:="${LDAP_SERVER_HOST}"}"}"
|
||||
|
||||
# Not sure whether this can be the same or not
|
||||
# _dovecot_ldap_mapping["DOVECOT_PASS_FILTER"]="${DOVECOT_PASS_FILTER:="${LDAP_QUERY_FILTER_USER}"}"
|
||||
# _dovecot_ldap_mapping["DOVECOT_USER_FILTER"]="${DOVECOT_USER_FILTER:="${LDAP_QUERY_FILTER_USER}"}"
|
||||
# Add protocol to DOVECOT_URIS so that we can use dovecot's "uris" option:
|
||||
# https://doc.dovecot.org/configuration_manual/authentication/ldap/
|
||||
if [[ "${DOVECOT_LDAP_MAPPING["DOVECOT_URIS"]}" != *'://'* ]]
|
||||
then
|
||||
DOVECOT_LDAP_MAPPING["DOVECOT_URIS"]="ldap://${DOVECOT_LDAP_MAPPING["DOVECOT_URIS"]}"
|
||||
fi
|
||||
|
||||
for VAR in "${!_dovecot_ldap_mapping[@]}"
|
||||
# Default DOVECOT_PASS_FILTER to the same value as DOVECOT_USER_FILTER
|
||||
DOVECOT_LDAP_MAPPING["DOVECOT_PASS_FILTER"]="${DOVECOT_PASS_FILTER:="${DOVECOT_USER_FILTER}"}"
|
||||
|
||||
for VAR in "${!DOVECOT_LDAP_MAPPING[@]}"
|
||||
do
|
||||
export "${VAR}=${_dovecot_ldap_mapping[${VAR}]}"
|
||||
export "${VAR}=${DOVECOT_LDAP_MAPPING[${VAR}]}"
|
||||
done
|
||||
|
||||
configomat.sh "DOVECOT_" "/etc/dovecot/dovecot-ldap.conf.ext"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue