From 1618243ac86006c61f2d05e80a0510b598e342cd Mon Sep 17 00:00:00 2001 From: kakious Date: Fri, 21 Jul 2023 13:32:43 -0700 Subject: [PATCH] Update boop-keys/setup-boop.sh --- boop-keys/setup-boop.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/boop-keys/setup-boop.sh b/boop-keys/setup-boop.sh index 859d49b..8c7872a 100644 --- a/boop-keys/setup-boop.sh +++ b/boop-keys/setup-boop.sh @@ -4,6 +4,7 @@ echo "[BOOTSTRAP] Running initial setup for BOOP..." mysql -u root -e "CREATE DATABASE IF NOT EXISTS oauth_provider;" password=$(openssl rand -base64 32) +password=$(echo $password | sed 's/[^a-zA-Z0-9]//g') echo $password > /home/coder/oauth-provider/.dbpass mysqladmin -u root password $password mysql -u root -p$password -e "CREATE USER 'oauth_provider'@'%' IDENTIFIED BY '$password';" @@ -17,8 +18,17 @@ echo "[BOOTSTRAP] DB Configured, setting up .env file..." echo "[BOOTSTRAP] Generating Encryption Secret" -# generate encryption secret -encryption_secret=$(openssl rand -base64 32) +encryption_secret=$(openssl rand -base64 64) +encryption_secret=$(echo $encryption_secret | sed 's/[^a-zA-Z0-9]//g') + +while [ ${#encryption_secret} -lt 64 ] +do + encryption_secret_2=$(openssl rand -base64 64) + encryption_secret_2=$(echo $encryption_secret_2 | sed 's/[^a-zA-Z0-9]//g') + encryption_secret=$encryption_secret$encryption_secret_2 +done +encryption_secret=${encryption_secret:0:64} + WORKSPACE_ENV=$(cat /home/coder/.coder-env | grep WORKSPACE_ENV | cut -d '=' -f2) USERNAME_ENV=$(cat /home/coder/.coder-env | grep USERNAME_ENV | cut -d '=' -f2)