diff --git a/optfs/eduldap/lib/common b/optfs/eduldap/lib/common index b14a912..9bf1a3c 100644 --- a/optfs/eduldap/lib/common +++ b/optfs/eduldap/lib/common @@ -17,6 +17,12 @@ CONFIG_DIR=${OPENLDAP_ETC}/slapd.d DATABASE_FILE=${EDULDAP_HOME}/bootstrap/databases/${DATABASE}.ldif SEED_FILE=${EDULDAP_HOME}/bootstrap/seeds/${SEED}.ldif +ADMIN_SECRET_FILE=${ADMIN_SECRET_FILE:-"/dev/null"} + +if [[ -f $ADMIN_SECRET_FILE ]]; then + ADMIN_SECRET=`cat $ADMIN_SECRET_FILE | tr -d '\n'` +fi + ADMIN_SECRET=${ADMIN_SECRET:-`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`} DATABASE_SUFFIX=`grep olcSuffix $DATABASE_FILE | head -1 | cut -d':' -f 2 | sed 's/^ //'` ONA=$(dn_to_na $DATABASE_SUFFIX) @@ -31,4 +37,4 @@ NNA=$(dn_to_na $BASE_DN) #if [[ $EUID -ne 0 ]]; then # echo "This script must be run with root privileges (as root or via sudo)" 1>&2 # exit 1 -#fi \ No newline at end of file +#fi