mirror of
https://github.com/luzifer-docker/openldap.git
synced 2024-11-15 04:32:41 +00:00
Escaped characters in password hash, so sed doesn't crash anymore
This commit is contained in:
parent
9d1708513e
commit
ddc5204228
3 changed files with 5 additions and 5 deletions
|
@ -14,7 +14,7 @@ RUN apt-get update && \
|
||||||
|
|
||||||
EXPOSE 389
|
EXPOSE 389
|
||||||
|
|
||||||
VOLUME ["/var/lib/ldap"]
|
VOLUME ["/var/lib/ldap", "/etc/ldap"]
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ docker-openldap
|
||||||
===============
|
===============
|
||||||
|
|
||||||
A Docker image running OpenLDAP on Debian stable ("wheezy" at the moment). The
|
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
|
[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
|
before, running a stable Debian and be a little less verbose, but more complete
|
||||||
in the configuration.
|
in the configuration.
|
||||||
|
|
|
@ -22,8 +22,6 @@ if [[ ! -f /etc/ldap/docker-configured ]]; then
|
||||||
slapd slapd/no_configuration boolean false
|
slapd slapd/no_configuration boolean false
|
||||||
slapd slapd/password1 password $SLAPD_PASSWORD
|
slapd slapd/password1 password $SLAPD_PASSWORD
|
||||||
slapd slapd/password2 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 shared/organization string $SLAPD_ORGANIZATION
|
||||||
slapd slapd/domain string $SLAPD_DOMAIN
|
slapd slapd/domain string $SLAPD_DOMAIN
|
||||||
slapd slapd/backend select hdb
|
slapd slapd/backend select hdb
|
||||||
|
@ -49,8 +47,10 @@ EOF
|
||||||
if [[ -n "$SLAPD_CONFIG_PASSWORD" ]]; then
|
if [[ -n "$SLAPD_CONFIG_PASSWORD" ]]; then
|
||||||
password_hash=`slappasswd -s "${SLAPD_CONFIG_PASSWORD}"`
|
password_hash=`slappasswd -s "${SLAPD_CONFIG_PASSWORD}"`
|
||||||
|
|
||||||
|
sed_safe_password_hash=${password_hash/\//\\\/}
|
||||||
|
|
||||||
slapcat -n0 -F /etc/ldap/slapd.d -l /tmp/config.ldif
|
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/*
|
rm -rf /etc/ldap/slapd.d/*
|
||||||
slapadd -n0 -F /etc/ldap/slapd.d -l /tmp/config.ldif >/dev/null 2>&1
|
slapadd -n0 -F /etc/ldap/slapd.d -l /tmp/config.ldif >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue