add password check to init.sh
This commit is contained in:
parent
64853b3b14
commit
e5f2f19a69
@ -10,18 +10,29 @@ read -p "Admin User Email: " ADMIN_EMAIL
|
|||||||
read -p "Admin User CN: " ADMIN_CN
|
read -p "Admin User CN: " ADMIN_CN
|
||||||
read -p "Admin User SN: " ADMIN_SN
|
read -p "Admin User SN: " ADMIN_SN
|
||||||
read -s -p "Admin Password: " ADMIN_PASSWD
|
read -s -p "Admin Password: " ADMIN_PASSWD
|
||||||
|
echo ""
|
||||||
|
read -s -p "Confirm Password: " CONFIRM_PASSWD
|
||||||
|
echo ""
|
||||||
|
|
||||||
envsubst '$BASE_DN' < auth.template.ldif > auth.ldif
|
if [ "$ADMIN_PASSWD" = "$CONFIRM_PASSWD" ]; then
|
||||||
envsubst '$BASE_DN' < pass.template.ldif > pass.ldif
|
|
||||||
envsubst '$BASE_DN:$ADMIN_ID:$ADMIN_EMAIL:$ADMIN_CN:$ADMIN_SN:$ADMIN_PASSWD' < init.template.ldif > init.ldif
|
|
||||||
|
|
||||||
sudo ldapmodify -H ldapi:/// -Y EXTERNAL -f auth.ldif
|
envsubst '$BASE_DN' < auth.template.ldif > auth.ldif
|
||||||
sudo ldapmodify -H ldapi:/// -Y EXTERNAL -f pass.ldif
|
envsubst '$BASE_DN' < pass.template.ldif > pass.ldif
|
||||||
sudo ldapadd -H ldapi:/// -Y EXTERNAL -c -f init.ldif
|
envsubst '$BASE_DN:$ADMIN_ID:$ADMIN_EMAIL:$ADMIN_CN:$ADMIN_SN:$ADMIN_PASSWD' < init.template.ldif > init.ldif
|
||||||
|
|
||||||
unset BASE_DN
|
sudo ldapmodify -H ldapi:/// -Y EXTERNAL -f auth.ldif
|
||||||
unset ADMIN_ID
|
sudo ldapmodify -H ldapi:/// -Y EXTERNAL -f pass.ldif
|
||||||
unset ADMIN_CN
|
sudo ldapadd -H ldapi:/// -Y EXTERNAL -c -f init.ldif
|
||||||
unset ADMIN_SN
|
|
||||||
unset ADMIN_PASSWD
|
unset BASE_DN
|
||||||
rm auth.ldif init.ldif pass.ldif
|
unset ADMIN_ID
|
||||||
|
unset ADMIN_CN
|
||||||
|
unset ADMIN_SN
|
||||||
|
unset ADMIN_PASSWD
|
||||||
|
rm auth.ldif init.ldif pass.ldif
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
echo "Error: Passwords do not match."
|
||||||
|
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user