30 lines
1.4 KiB
Bash
Executable File
30 lines
1.4 KiB
Bash
Executable File
#!/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 |