Skip to content

Commit

Permalink
Allow to optionally set olcSuffix via LDAP_SUFFIX env var
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Brancaleoni <mbrancaleoni@gmail.com>
  • Loading branch information
xadhoom committed May 31, 2024
1 parent 636f196 commit 5265ad5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export LDAP_DAEMON_GROUP="slapd"
export LDAP_PORT_NUMBER="${LDAP_PORT_NUMBER:-1389}"
export LDAP_LDAPS_PORT_NUMBER="${LDAP_LDAPS_PORT_NUMBER:-1636}"
export LDAP_ROOT="${LDAP_ROOT:-dc=example,dc=org}"
export LDAP_SUFFIX="$(if [ -z ${LDAP_SUFFIX+x} ]; then echo ${LDAP_ROOT}; else echo ${LDAP_SUFFIX}; fi)"
export LDAP_ADMIN_USERNAME="${LDAP_ADMIN_USERNAME:-admin}"
export LDAP_ADMIN_DN="${LDAP_ADMIN_USERNAME/#/cn=},${LDAP_ROOT}"
export LDAP_ADMIN_PASSWORD="${LDAP_ADMIN_PASSWORD:-adminpassword}"
Expand Down Expand Up @@ -382,7 +383,7 @@ ldap_admin_credentials() {
dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: $LDAP_ROOT
olcSuffix: $LDAP_SUFFIX
dn: olcDatabase={2}mdb,cn=config
changetype: modify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export LDAP_DAEMON_GROUP="slapd"
export LDAP_PORT_NUMBER="${LDAP_PORT_NUMBER:-1389}"
export LDAP_LDAPS_PORT_NUMBER="${LDAP_LDAPS_PORT_NUMBER:-1636}"
export LDAP_ROOT="${LDAP_ROOT:-dc=example,dc=org}"
export LDAP_SUFFIX="$(if [ -z ${LDAP_SUFFIX+x} ]; then echo ${LDAP_ROOT}; else echo ${LDAP_SUFFIX}; fi)"
export LDAP_ADMIN_USERNAME="${LDAP_ADMIN_USERNAME:-admin}"
export LDAP_ADMIN_DN="${LDAP_ADMIN_USERNAME/#/cn=},${LDAP_ROOT}"
export LDAP_ADMIN_PASSWORD="${LDAP_ADMIN_PASSWORD:-adminpassword}"
Expand Down Expand Up @@ -382,7 +383,7 @@ ldap_admin_credentials() {
dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: $LDAP_ROOT
olcSuffix: $LDAP_SUFFIX
dn: olcDatabase={2}mdb,cn=config
changetype: modify
Expand Down
1 change: 1 addition & 0 deletions bitnami/openldap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ The Bitnami Docker OpenLDAP can be easily setup with the following environment v
* `LDAP_CONFIGURE_PPOLICY`: Enables the ppolicy module and creates an empty configuration. Default: **no**.
* `LDAP_PPOLICY_USE_LOCKOUT`: Whether bind attempts to locked accounts will always return an error. Will only be applied with `LDAP_CONFIGURE_PPOLICY` active. Default: **no**.
* `LDAP_PPOLICY_HASH_CLEARTEXT`: Whether plaintext passwords should be hashed automatically. Will only be applied with `LDAP_CONFIGURE_PPOLICY` active. Default: **no**.
* `LDAP_SUFFIX`: The DN suffix of queries that will be handled by the default database. Default: `LDAP_ROOT` value.

You can bootstrap the contents of your database by putting LDIF files in the directory `/ldifs` (or the one you define in `LDAP_CUSTOM_LDIF_DIR`). Those may only contain content underneath your base DN (set by `LDAP_ROOT`). You can **not** set configuration for e.g. `cn=config` in those files.

Expand Down

0 comments on commit 5265ad5

Please sign in to comment.