diff --git a/Dockerfile b/Dockerfile index 1ecdf30..93d7196 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get update && \ EXPOSE 389 -VOLUME ["/var/lib/ldap"] +VOLUME ["/var/lib/ldap", "/etc/ldap"] COPY entrypoint.sh /entrypoint.sh diff --git a/README.md b/README.md index 53aa3b5..47a7a3d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ docker-openldap =============== A Docker image running OpenLDAP on Debian stable ("wheezy" at the moment). The -Dockerfile is inspired by the well written one from +Dockerfile is inspired by [cnry/openldap](https://registry.hub.docker.com/u/cnry/openldap/), but as said before, running a stable Debian and be a little less verbose, but more complete in the configuration. diff --git a/entrypoint.sh b/entrypoint.sh index 7abcc2c..dcee514 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,8 +22,6 @@ if [[ ! -f /etc/ldap/docker-configured ]]; then slapd slapd/no_configuration boolean false slapd slapd/password1 password $SLAPD_PASSWORD slapd slapd/password2 password $SLAPD_PASSWORD - slapd slapd/internal/adminpw string $SLAPD_PASSWORD - slapd slapd/internal/generated_adminpw password $SLAPD_PASSWORD slapd shared/organization string $SLAPD_ORGANIZATION slapd slapd/domain string $SLAPD_DOMAIN slapd slapd/backend select hdb @@ -49,8 +47,10 @@ EOF if [[ -n "$SLAPD_CONFIG_PASSWORD" ]]; then password_hash=`slappasswd -s "${SLAPD_CONFIG_PASSWORD}"` + sed_safe_password_hash=${password_hash/\//\\\/} + slapcat -n0 -F /etc/ldap/slapd.d -l /tmp/config.ldif - sed -i "s/\(olcRootDN: cn=admin,cn=config\)/\1\nolcRootPW: ${password_hash}/g" /tmp/config.ldif + sed -i "s/\(olcRootDN: cn=admin,cn=config\)/\1\nolcRootPW: ${sed_safe_password_hash}/g" /tmp/config.ldif rm -rf /etc/ldap/slapd.d/* slapadd -n0 -F /etc/ldap/slapd.d -l /tmp/config.ldif >/dev/null 2>&1 fi