Paste P4372

new-es-password.sh
ActivePublic

Authored by bd808 on Nov 4 2016, 6:45 PM.
#!/usr/bin/env bash
# Ugly script to generate password data
# for the Tool Labs elasticsearch cluster
USER=${1}
PASS=$(openssl rand -base64 32)
TFILE="$(basename $0).$$.tmp"
echo user=$USER
echo password=\"$PASS\"
echo ---------------------------------
echo $PASS |
htpasswd -cmi $TFILE $USER &>/dev/null
cat $TFILE
rm $TFILE