diff --git a/bitnami/openldap/2.5/debian-10/rootfs/opt/bitnami/scripts/libopenldap.sh b/bitnami/openldap/2.5/debian-10/rootfs/opt/bitnami/scripts/libopenldap.sh index f78cf8530a8b..cb975abc2458 100644 --- a/bitnami/openldap/2.5/debian-10/rootfs/opt/bitnami/scripts/libopenldap.sh +++ b/bitnami/openldap/2.5/debian-10/rootfs/opt/bitnami/scripts/libopenldap.sh @@ -51,6 +51,11 @@ 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}" export LDAP_ENCRYPTED_ADMIN_PASSWORD="$(echo -n $LDAP_ADMIN_PASSWORD | slappasswd -n -T /dev/stdin)" +export LDAP_CONFIG_ADMIN_ENABLED="${LDAP_CONFIG_ADMIN_ENABLED:-no}" +export LDAP_CONFIG_ADMIN_USERNAME="${LDAP_CONFIG_ADMIN_USERNAME:-admin}" +export LDAP_CONFIG_ADMIN_DN="${LDAP_CONFIG_ADMIN_USERNAME/#/cn=},cn=config" +export LDAP_CONFIG_ADMIN_PASSWORD="${LDAP_CONFIG_ADMIN_PASSWORD:-configpassword}" +export LDAP_ENCRYPTED_CONFIG_ADMIN_PASSWORD="$(echo -n $LDAP_CONFIG_ADMIN_PASSWORD | slappasswd -n -T /dev/stdin)" export LDAP_EXTRA_SCHEMAS="${LDAP_EXTRA_SCHEMAS:-cosine,inetorgperson,nis}" export LDAP_SKIP_DEFAULT_TREE="${LDAP_SKIP_DEFAULT_TREE:-no}" export LDAP_USERS="${LDAP_USERS:-user01,user02}" @@ -254,7 +259,22 @@ dn: olcDatabase={1}monitor,cn=config changetype: modify replace: olcAccess olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external, cn=auth" read by dn.base="${LDAP_ADMIN_DN}" read by * none + EOF + + if is_boolean_yes "$LDAP_CONFIG_ADMIN_ENABLED"; then + cat >> "${LDAP_SHARE_DIR}/admin.ldif" << EOF +dn: olcDatabase={0}config,cn=config +changetype: modify +add: olcRootDN +olcRootDN: $LDAP_CONFIG_ADMIN_DN + +dn: olcDatabase={0}config,cn=config +changetype: modify +add: olcRootPW +olcRootPW: $LDAP_ENCRYPTED_CONFIG_ADMIN_PASSWORD +EOF + fi debug_execute ldapmodify -Y EXTERNAL -H "ldapi:///" -f "${LDAP_SHARE_DIR}/admin.ldif" }