From d3c83b80b142e3ba6dfaabb0f1bcc326cfc2bb67 Mon Sep 17 00:00:00 2001 From: Tuomo Tanskanen Date: Wed, 20 Nov 2024 08:11:41 +0200 Subject: [PATCH] use uuidgen to generate random username/password 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 --- tools/deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/deploy.sh b/tools/deploy.sh index 9306ac7f43..7e888128ea 100755 --- a/tools/deploy.sh +++ b/tools/deploy.sh @@ -127,7 +127,7 @@ 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")" @@ -135,7 +135,7 @@ if [[ "${DEPLOY_BASIC_AUTH}" == "true" ]]; then 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")"