chore: `saslauthd.conf` generation - Use a base config for defaults

This avoids the ENV overriding user-provided settings due to the ENV having hard-coded fallback defaults when not explicitly set.
This commit is contained in:
polarathene 2023-09-03 16:52:52 +12:00
parent a699c03ba9
commit 54eebb9129
2 changed files with 3 additions and 2 deletions

View File

@ -0,0 +1,2 @@
ldap_filter: (&(uniqueIdentifier=%u)(mailEnabled=TRUE))
ldap_referrals: yes

View File

@ -31,13 +31,12 @@ function _create_config_saslauthd() {
local SASLAUTHD_LDAP_BIND_DN=${SASLAUTHD_LDAP_BIND_DN:=${LDAP_BIND_DN}}
local SASLAUTHD_LDAP_PASSWORD=${SASLAUTHD_LDAP_PASSWORD:=${LDAP_BIND_PW}}
local SASLAUTHD_LDAP_SEARCH_BASE=${SASLAUTHD_LDAP_SEARCH_BASE:=${LDAP_SEARCH_BASE}}
local SASLAUTHD_LDAP_FILTER=${SASLAUTHD_LDAP_FILTER:=(&(uniqueIdentifier=%u)(mailEnabled=TRUE))}
local SASLAUTHD_LDAP_REFERRALS=${SASLAUTHD_LDAP_REFERRALS:=yes}
# Generates a config from an ENV template while layering several other sources
# into a single temporary file, used as input into `_cleanse_config` which
# prepares the final output config.
_cleanse_config ':' <(cat 2>/dev/null \
/etc/dms/ldap/saslauthd.base \
/tmp/docker-mailserver/ldap/saslauthd.conf \
<(_template_with_env 'SASLAUTHD_' /etc/dms/ldap/saslauthd.tmpl) \
) > /etc/saslauthd.conf