Skip to content

Commit

Permalink
Merge pull request #506 from MahnoorAsghar/read-htpasswd-m3-main
Browse files Browse the repository at this point in the history
🌱 Read Ironic htpasswd from file or environment variable
  • Loading branch information
metal3-io-bot authored Jun 4, 2024
2 parents 4964968 + d05e890 commit 164ad23
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions scripts/auth-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,11 @@ else
export IRONIC_EXPOSE_JSON_RPC="${IRONIC_EXPOSE_JSON_RPC:-false}"
fi

set +x
IRONIC_HTPASSWD_FILE=/etc/ironic/htpasswd
if [[ -f "/auth/ironic/username" ]]; then
IRONIC_HTPASSWD_USERNAME=$(</auth/ironic/username)
fi
IRONIC_HTPASSWD_USERNAME=${IRONIC_HTPASSWD_USERNAME:-}
if [[ -f "/auth/ironic/password" ]]; then
IRONIC_HTPASSWD_PASSWORD=$(</auth/ironic/password)
fi
IRONIC_HTPASSWD_PASSWORD=${IRONIC_HTPASSWD_PASSWORD:-}
if [[ -n "${IRONIC_HTPASSWD_USERNAME}" ]]; then
IRONIC_HTPASSWD="$(htpasswd -n -b -B "${IRONIC_HTPASSWD_USERNAME}" "${IRONIC_HTPASSWD_PASSWORD}")"
if [[ -f "/auth/ironic/htpasswd" ]]; then
IRONIC_HTPASSWD=$(</auth/ironic/htpasswd)
fi
export IRONIC_HTPASSWD=${IRONIC_HTPASSWD:-${HTTP_BASIC_HTPASSWD:-}}
set -x

configure_client_basic_auth()
{
Expand Down

0 comments on commit 164ad23

Please sign in to comment.