2023-11-16 22:41:38 +00:00
|
|
|
export BASE_DN=''
|
2024-01-16 22:44:37 +00:00
|
|
|
export ADMIN_ID=''
|
2024-01-18 04:50:09 +00:00
|
|
|
export ADMIN_EMAIL=''
|
2024-01-16 22:44:37 +00:00
|
|
|
export ADMIN_CN=''
|
|
|
|
export ADMIN_SN=''
|
|
|
|
export ADMIN_PASSWD=''
|
2023-11-16 22:41:38 +00:00
|
|
|
read -p "Base DN: " BASE_DN
|
2024-01-16 22:44:37 +00:00
|
|
|
read -p "Admin User ID: " ADMIN_ID
|
2024-01-18 04:50:09 +00:00
|
|
|
read -p "Admin User Email: " ADMIN_EMAIL
|
2024-01-16 22:44:37 +00:00
|
|
|
read -p "Admin User CN: " ADMIN_CN
|
|
|
|
read -p "Admin User SN: " ADMIN_SN
|
|
|
|
read -s -p "Admin Password: " ADMIN_PASSWD
|
2023-11-16 22:41:38 +00:00
|
|
|
|
|
|
|
envsubst '$BASE_DN' < auth.template.ldif > auth.ldif
|
|
|
|
envsubst '$BASE_DN' < pass.template.ldif > pass.ldif
|
2024-01-18 04:50:09 +00:00
|
|
|
envsubst '$BASE_DN:$ADMIN_ID:$ADMIN_EMAIL:$ADMIN_CN:$ADMIN_SN:$ADMIN_PASSWD' < init.template.ldif > init.ldif
|
2023-11-16 22:41:38 +00:00
|
|
|
|
|
|
|
sudo ldapmodify -H ldapi:/// -Y EXTERNAL -f auth.ldif
|
|
|
|
sudo ldapmodify -H ldapi:/// -Y EXTERNAL -f pass.ldif
|
|
|
|
sudo ldapadd -H ldapi:/// -Y EXTERNAL -c -f init.ldif
|
|
|
|
|
|
|
|
unset BASE_DN
|
2024-01-16 22:44:37 +00:00
|
|
|
unset ADMIN_ID
|
|
|
|
unset ADMIN_CN
|
|
|
|
unset ADMIN_SN
|
|
|
|
unset ADMIN_PASSWD
|
2023-11-16 22:41:38 +00:00
|
|
|
rm auth.ldif init.ldif pass.ldif
|