Skip to content

Instantly share code, notes, and snippets.

@jlamoree
Last active July 19, 2021 01:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlamoree/6c1fc89ca3b8ce2581eb76dadeb1ee53 to your computer and use it in GitHub Desktop.
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.*
#!/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