diff --git a/entrypoint.sh b/entrypoint.sh index a02a3ad..d50bf21 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -25,7 +25,6 @@ if [[ ! -d /etc/ldap/slapd.d || "$SLAPD_FORCE_RECONFIGURE" == "true" ]]; then exit 1 fi - SLAPD_PPOLICY_DN_PREFIX="${SLAPD_PPOLICY_DN_PREFIX:-cn=default,ou=policies}" SLAPD_ORGANIZATION="${SLAPD_ORGANIZATION:-${SLAPD_DOMAIN}}" cp -a /etc/ldap.dist/* /etc/ldap @@ -78,13 +77,15 @@ EOF IFS=","; declare -a modules=($SLAPD_ADDITIONAL_MODULES) for module in "${modules[@]}"; do - moduleFile="/etc/ldap/modules/${module}.ldif" + module_file="/etc/ldap/modules/${module}.ldif" if [ "$module" == 'ppolicy' ]; then - sed -i'' "s|\(olcPPolicyDefault: \)PPOLICY_DN|\1${SLAPD_PPOLICY_DN_PREFIX}$dc_string|" $moduleFile + SLAPD_PPOLICY_DN_PREFIX="${SLAPD_PPOLICY_DN_PREFIX:-cn=default,ou=policies}" + + sed -i "s/\(olcPPolicyDefault: \)PPOLICY_DN/\1${SLAPD_PPOLICY_DN_PREFIX}$dc_string/g" $module_file fi - slapadd -n0 -F /etc/ldap/slapd.d -l "$moduleFile" >/dev/null 2>&1 + slapadd -n0 -F /etc/ldap/slapd.d -l "$module_file" >/dev/null 2>&1 done fi