envole/docker/volume/openldap/envole/init.sh
2023-11-09 15:45:50 +01:00

30 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
if [[ "${MASTERIDENTITY}" == "SQL" ]]
then
# Modification compte cn=admin pour changer son password si besoin
# slappasswd -h {SHA} -s ${LDAP_PASSWORD} > /tmp/cnpwd.txt
# haspassword=`cat /tmp/cnpwd.txt`
# echo "dn: ${LDAP_USER}" > /tmp/cnadmin.ldif
# echo "changetype: modify" >> /tmp/cnadmin.ldif
# echo "replace: userPassword" >> /tmp/cnadmin.ldif
# echo "userPassword: ${haspassword}" >> /tmp/cnadmin.ldif
# ldapmodify -Y EXTERNAL -H ldapi:/// -f '/tmp/cnadmin.ldif'
# Modification compte uid=admin pour changer son password si besoin
# slappasswd -h {SHA} -s ${ADMIN_PASSWORD} > /tmp/uidpwd.txt
# haspassword=`cat /tmp/uidpwd.txt`
# echo "dn: uid=${ADMIN_USER},${LDAP_BASEUSER}" > /tmp/uidpwd.ldif
# echo "changetype: modify" >> /tmp/uidpwd.ldif
# echo "replace: userPassword" >> /tmp/uidpwd.ldif
# echo "userPassword: ${haspassword}" >> /tmp/uidpwd.ldif
# ldapmodify -Y EXTERNAL -H ldapi:/// -f '/tmp/uidpwd.ldif'
# Suppression de l'entrée users généré automatiquement par l'image docker bitnami/openldap
ldapdelete ou=users,${LDAP_BASEDN} -r -H ldap://${LDAP_HOST}:${LDAP_PORT} -D ${LDAP_USER} -w ${LDAP_PASSWORD} 2>/dev/null
# Integration du ldif de base
ldapadd -H ldap://${LDAP_HOST}:${LDAP_PORT} -D ${LDAP_USER} -w ${LDAP_PASSWORD} -f '/envole/ldif/cadoles.ldif' 2>/dev/null
fi