Skip to content

Commit

Permalink
Fix input error on generating password and salt in install script (#3051
Browse files Browse the repository at this point in the history
)

* Fix potential input error on password generation

This happens on macOS systems when a different locale is
explicitly set.

* Don't use a masked variable name
  • Loading branch information
sharat87 committed Feb 16, 2021
1 parent 7e84c93 commit b26706c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions deploy/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,13 @@ urlencode() {
}

generate_password() {
# Picked up the following method of generation from : https://gist.github.com/earthgecko/3089509
LC_CTYPE=C tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 13 | head -n 1
local gen_string="$(/usr/bin/python -c 'import random, string; print("".join(random.choice(string.ascii_letters + string.digits) for _ in range(13)))' 2>/dev/null)"
if [[ -n $gen_string ]]; then
echo "$gen_string"
else
# Picked up the following method of generation from : https://gist.github.com/earthgecko/3089509
LC_ALL=C tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 13 | head -n 1
fi
}

confirm() {
Expand Down

0 comments on commit b26706c

Please sign in to comment.