mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] include aleks script to reset ldap password
This commit is contained in:
parent
198bc51128
commit
7bed005ac0
1 changed files with 29 additions and 0 deletions
29
bin/reset-ldap-password
Normal file
29
bin/reset-ldap-password
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# Generate new password hash
|
||||||
|
NEW_PASSWORD_HASH=`slappasswd -h {SSHA}`
|
||||||
|
|
||||||
|
# Stop slapd service...
|
||||||
|
service slapd stop
|
||||||
|
|
||||||
|
# Backup slapd.conf (to be restored at the end of script)
|
||||||
|
cp /etc/ldap/slapd.conf /root/slapd.conf.bkp
|
||||||
|
|
||||||
|
# Append lines to slapd.conf to manually define root password hash
|
||||||
|
echo 'rootdn "cn=admin,dc=yunohost,dc=org"' >> /etc/ldap/slapd.conf
|
||||||
|
echo "rootpw $NEW_PASSWORD_HASH" >> /etc/ldap/slapd.conf
|
||||||
|
|
||||||
|
# Test conf (might not be entirely necessary though :P)
|
||||||
|
slaptest -Q -u -f /etc/ldap/slapd.conf
|
||||||
|
|
||||||
|
# Regenerate slapd.d directory
|
||||||
|
rm -Rf /etc/ldap/slapd.d
|
||||||
|
mkdir /etc/ldap/slapd.d
|
||||||
|
slaptest -f /etc/ldap/slapd.conf -F /etc/ldap/slapd.d/ 2>&1
|
||||||
|
|
||||||
|
# Set permissions to slapd.d
|
||||||
|
chown -R openldap:openldap /etc/ldap/slapd.d/
|
||||||
|
|
||||||
|
# Restore slapd.conf
|
||||||
|
mv /root/slapd.conf.bkp /etc/ldap/slapd.conf
|
||||||
|
|
||||||
|
# Restart slapd service
|
||||||
|
service slapd start
|
Loading…
Add table
Reference in a new issue