Last active
July 19, 2021 01:10
-
-
Save jlamoree/6c1fc89ca3b8ce2581eb76dadeb1ee53 to your computer and use it in GitHub Desktop.
A shell script to generate a Lucee Admin password hash using an input string and salt. Suitable for pasting into lucee-*.xml.*
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SHA_ALGORITHM=256 | |
SHA_COUNT=5 | |
LUCEE_PASSWORD=${1:-"_"} | |
LUCEE_SALT=${2:-"_"} | |
if [ $LUCEE_PASSWORD == "_" ]; then | |
LUCEE_PASSWORD=topsecret | |
fi | |
if [ $LUCEE_SALT == "_" ]; then | |
LUCEE_SALT=$(uuidgen | tr a-z A-Z) | |
fi | |
COUNT=1 | |
LUCEE_HASH=$(echo -n "${LUCEE_PASSWORD}:${LUCEE_SALT}" | shasum -a $SHA_ALGORITHM | cut -f1 -d' ') | |
while [ $COUNT -lt $SHA_COUNT ]; do | |
LUCEE_HASH=$(echo -n $LUCEE_HASH | shasum -a $SHA_ALGORITHM | cut -f1 -d' ') | |
COUNT=$((COUNT + 1)) | |
done | |
echo "Lucee Admin Values" | |
echo " hspw = $LUCEE_HASH" | |
echo " salt = $LUCEE_SALT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment