Skip to content

Commit d4a7f45

Browse files
committed
tools.sh: don't leak the kubeadmin password
1 parent 09ce341 commit d4a7f45

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,10 @@ function create_vm {
219219
function generate_htpasswd_file {
220220
local auth_file_dir=$1
221221
local pass_file=$2
222-
random_password=$(cat $1/auth/kubeadmin-password)
223-
${HTPASSWD} -c -B -b ${pass_file} developer developer
224-
${HTPASSWD} -B -b ${pass_file} kubeadmin ${random_password}
222+
(
223+
set +x # use a subshell to avoid leaking the password
224+
local random_password=$(cat $1/auth/kubeadmin-password)
225+
${HTPASSWD} -c -B -i "${pass_file}" developer <<<"developer"
226+
${HTPASSWD} -B -i "${pass_file}" kubeadmin <<<"${random_password}"
227+
)
225228
}

0 commit comments

Comments
 (0)