Created
April 28, 2017 15:28
-
-
Save komuw/eab245fec845c286626cd357d0507fb0 to your computer and use it in GitHub Desktop.
generate rabbitmq password has.
This file contains hidden or 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
#!/usr/bin/env bash | |
# copied from https://gist.github.com/lukebakken/7b4da46ed9abb7ed14f7a60b49f9e52e | |
# discussion from here: https://groups.google.com/forum/#!topic/rabbitmq-users/Brx3tSmNC_8 | |
set -o errexit | |
set -o nounset | |
declare -r passwd="${1:-newpassword}" | |
declare -r tmp0="$(mktemp)" | |
declare -r tmp1="$(mktemp)" | |
function onexit | |
{ | |
rm -f "$tmp0" | |
rm -f "$tmp1" | |
} | |
trap onexit EXIT | |
dd if=/dev/urandom of="$tmp0" count=4 bs=1 > /dev/null 2>&1 | |
cp -f "$tmp0" "$tmp1" | |
echo -n "$passwd" >> "$tmp0" | |
openssl dgst -binary -sha256 "$tmp0" >> "$tmp1" | |
openssl base64 -A -in "$tmp1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment