#!/bin/sh set -eu status () { echo "---> ${@}" >&2 } set -x : LDAP_ADMIN_PWD=${LDAP_ADMIN_PWD} : LDAP_DOMAIN=${LDAP_DOMAIN} : LDAP_ORGANISATION=${LDAP_ORGANISATION} ############ Base config ############ if [ ! -e /var/lib/ldap/docker_bootstrapped ]; then status "configuring slapd database" cat <> /etc/dhosts fi # Replication # todo :) # Other config files for f in $(find /etc/ldap/config -maxdepth 1 -name \*.ldif -type f); do status "Processing file ${f}" ldapmodify -Y EXTERNAL -H ldapi:/// -f $f -Q done kill -INT `cat /run/slapd/slapd.pid` touch /etc/ldap/config/docker_bootstrapped else status "found already-configured slapd" fi status "starting slapd on default port 389" set -x exec /usr/sbin/slapd -h "ldap:/// ldapi:///" -u openldap -g openldap -d -1