File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,23 @@ For more information about docker data volume, please refer to:
104104
105105Do not edit slapd.conf it's not used. To modify your server configuration use ldap utils: ** ldapmodify / ldapadd / ldapdelete**
106106
107+ #### Seed ldap database with ldif
108+
109+ This image can load ldif files at startup with either ` ldapadd ` or ` ldapmodify ` .
110+ Mount ` .ldif ` in ` /container/service/slapd/assets/config/bootstrap/ldif/ `
111+ directory. Files containing ` changeType: ` attributes will be loaded with ` ldapmodify ` .
112+
113+ The startup script provide some substitution in bootstrap ldif files: `{{
114+ LDAP_BASE_DN }}` and ` {{ LDAP_BACKEND }}` values are supported. Other ` {{ * }}`
115+ substitution are left as is.
116+
117+ Since startup script modifies ` ldif ` files, you ** must** add ` --copy-service `
118+ argument to entrypoint.
119+
120+ docker run \
121+ --volume ./bootstrap.ldif:/container/service/slapd/assets/config/bootstrap/ldif/50-bootstrap.ldif \
122+ osixia/openldap:1.1.9 --copy-service
123+
107124### Use an existing ldap database
108125
109126This can be achieved by mounting host directories as volume.
Original file line number Diff line number Diff line change 229229 log-helper debug " Processing file ${f} "
230230 sed -i " s|{{ LDAP_BASE_DN }}|${LDAP_BASE_DN} |g" $f
231231 sed -i " s|{{ LDAP_BACKEND }}|${LDAP_BACKEND} |g" $f
232- ldapmodify -Y EXTERNAL -Q -H ldapi:/// -f $f 2>&1 | log-helper debug || ldapmodify -h localhost -p 389 -D cn=admin,$LDAP_BASE_DN -w $LDAP_ADMIN_PASSWORD -f $f 2>&1 | log-helper debug
232+ if grep -iq changetype $f ; then
233+ ldapmodify -Y EXTERNAL -Q -H ldapi:/// -f $f 2>&1 | log-helper debug || ldapmodify -h localhost -p 389 -D cn=admin,$LDAP_BASE_DN -w $LDAP_ADMIN_PASSWORD -f $f 2>&1 | log-helper debug
234+ else
235+ ldapadd -Y EXTERNAL -Q -H ldapi:/// -f $f | & log-helper debug
236+ fi
233237 done
234238
235239 # read only user
You can’t perform that action at this time.
0 commit comments