Created
August 11, 2016 04:25
-
-
Save ivancorrales/e7eeee191c85199a733a3caae4b013fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
status () { | |
echo "---> ${@}" >&2 | |
} | |
echo "Running" | |
set -x | |
: LDAP_ROOTPASS=${LDAP_ROOTPASS} | |
: LDAP_DOMAIN=${LDAP_DOMAIN} | |
: LDAP_ORGANISATION=${LDAP_ORGANISATION} | |
if [ ! -e /var/lib/ldap/docker_bootstrapped ]; then | |
status "configuring slapd for first run" | |
cat <<EOF | debconf-set-selections | |
slapd slapd/internal/generated_adminpw password ${LDAP_ROOTPASS} | |
slapd slapd/internal/adminpw password ${LDAP_ROOTPASS} | |
slapd slapd/password2 password ${LDAP_ROOTPASS} | |
slapd slapd/password1 password ${LDAP_ROOTPASS} | |
slapd slapd/dump_database_destdir string /var/backups/slapd-VERSION | |
slapd slapd/domain string ${LDAP_DOMAIN} | |
slapd shared/organization string ${LDAP_ORGANISATION} | |
slapd slapd/backend string HDB | |
slapd slapd/purge_database boolean true | |
slapd slapd/move_old_database boolean true | |
slapd slapd/allow_ldap_v2 boolean false | |
slapd slapd/no_configuration boolean false | |
slapd slapd/dump_database select when needed | |
EOF | |
dpkg-reconfigure -f noninteractive slapd | |
touch /var/lib/ldap/docker_bootstrapped | |
else | |
status "found already-configured slapd" | |
fi | |
status "starting slapd" | |
set -x | |
/etc/init.d/saslauthd start & | |
status "saslauthd restarted" | |
exec /usr/sbin/slapd -h "ldap:///${HOSTNAME}" -u openldap -g openldap -d $LDAP_LOG_LEVEL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment