Skip to content

Commit

Permalink
use uuidgen to generate random username/password
Browse files Browse the repository at this point in the history
Using /dev/urandom has entropy issue. It can run out especially in CI,
leaving jobs stuck. We have used uuidgen in BMO e2e for long time now
and it works great. These usernames/passwords just need to be anything
random to make sure nothing is hardcoded, so uuidgen works great for
that anyways.

Signed-off-by: Tuomo Tanskanen <[email protected]>
  • Loading branch information
tuminoid authored and metal3-io-bot committed Nov 20, 2024
1 parent ec5d0d0 commit e648478
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ mkdir -p "${IRONIC_AUTH_DIR}"
if [[ "${DEPLOY_BASIC_AUTH}" == "true" ]]; then
if [ -z "${IRONIC_USERNAME:-}" ]; then
if [ ! -f "${IRONIC_AUTH_DIR}ironic-username" ]; then
IRONIC_USERNAME="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 12 | head -n 1)"
IRONIC_USERNAME="$(uuidgen)"
echo "$IRONIC_USERNAME" > "${IRONIC_AUTH_DIR}ironic-username"
else
IRONIC_USERNAME="$(cat "${IRONIC_AUTH_DIR}ironic-username")"
fi
fi
if [ -z "${IRONIC_PASSWORD:-}" ]; then
if [ ! -f "${IRONIC_AUTH_DIR}ironic-password" ]; then
IRONIC_PASSWORD="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 12 | head -n 1)"
IRONIC_PASSWORD="$(uuidgen)"
echo "$IRONIC_PASSWORD" > "${IRONIC_AUTH_DIR}ironic-password"
else
IRONIC_PASSWORD="$(cat "${IRONIC_AUTH_DIR}ironic-password")"
Expand Down

0 comments on commit e648478

Please sign in to comment.