Commit ddc52042 authored by Christian Luginbühl's avatar Christian Luginbühl
Browse files

Escaped characters in password hash, so sed doesn't crash anymore

parent 9d170851
......@@ -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
......
......@@ -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.
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment