Skip to content

Commit

Permalink
Make the ht password shorter (#990)
Browse files Browse the repository at this point in the history
Current size 125 is not accespted by ocm create idp ... --pasword=too...long...password

Signed-off-by: Andrej Podhradsky <apodhrad@redhat.com>
  • Loading branch information
apodhrad authored Oct 27, 2023
1 parent 8d5bb5b commit 9f2e6f7
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions ods_ci/build/install_idp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,8 @@ perform_ocm_login(){
}

function generate_rand_string(){
# sleep 2
# date +%s | sha256sum | base64 | head -c 64
p_array=()
for i in {a..z} {A..Z} {0..9};
do
p_array[$RANDOM]=$i
done
first=${p_array[-1]}
chars='@#$%_+='
for el in ${p_array[@]}
do
p_array[$RANDOM]=${chars:$((RANDOM % ${#chars})):1}
done
p_array[0]=$first
printf %s ${p_array[@]}
local length="${1:-64}"
cat /dev/urandom | tr -dc "0-9a-zA-Z@#$%_+=" | head -c "${length}"
}

function generate_rand_user_base_suffix(){
Expand Down Expand Up @@ -101,7 +88,7 @@ function generate_users_creds(){
pw=$(echo $idp | jq -r '.pw')
if [[ "$pw" = "<GEN_RAMDOM_PW>" ]]
then
pw=$(generate_rand_string)
pw=$(generate_rand_string "64")
if [ "${RETURN_PW}" -eq 1 ]
then
echo Random $1 pasword: $pw
Expand Down

0 comments on commit 9f2e6f7

Please sign in to comment.