{ urlList ? [ "ldap:///" ], }: { pkgs, config, ... }: let create_ldap_user = pkgs.writeShellScriptBin "create_ldap_user" '' # Base DN for LDAP directory BASE_DN="dc=net,dc=dn" # Organizational Unit (OU) where users are stored OU="people" # Prompt for username read -p "Please enter the username: " USERNAME # Prompt for password (hidden input) read -s -p "Please enter the password: " USER_PASSWORD echo # Prompt for password confirmation (hidden input) read -s -p "Please confirm the password: " USER_PASSWORD_CONFIRM echo # Check if the entered passwords match if [ "$USER_PASSWORD" != "$USER_PASSWORD_CONFIRM" ]; then echo "❌ Passwords do not match. Please run the script again." exit 1 fi # Hash the password using slappasswd PASSWORD_HASH=$(slappasswd -s "$USER_PASSWORD") # Construct the Distinguished Name (DN) for the user USER_DN="uid=$USERNAME,ou=$OU,$BASE_DN" # Check if the base DN (dc=net,dc=dn) exists, if not, create it ldapsearch -x -b "$BASE_DN" > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "⚠️ $BASE_DN does not exist. Creating it now..." cat < /dev/null 2>&1 if [ $? -ne 0 ]; then echo "⚠️ OU=$OU does not exist. Creating it now..." cat <