From 647d535b57639db3f58f1f8360be43e0230a837e Mon Sep 17 00:00:00 2001 From: Steven Foerster Date: Fri, 12 Mar 2021 11:27:37 -0500 Subject: [PATCH 1/7] removing double quotes --- scripts/subinstallers/extra/guacamole.sh | 2 +- scripts/subinstallers/extra/nextcloud.sh | 2 +- scripts/subinstallers/extra/onlyoffice.sh | 2 +- scripts/subinstallers/extra/rocketchat.sh | 2 +- scripts/subinstallers/gen_prod_env.sh | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/subinstallers/extra/guacamole.sh b/scripts/subinstallers/extra/guacamole.sh index 8c76a89..8df9d00 100755 --- a/scripts/subinstallers/extra/guacamole.sh +++ b/scripts/subinstallers/extra/guacamole.sh @@ -10,4 +10,4 @@ echo "POSTGRES_DB=guacamole_db" >> $GUAC_PROD_FILE echo "POSTGRES_DATABASE=guacamole_db" >> $GUAC_PROD_FILE echo "POSTGRES_USER=guac_user" >> $GUAC_PROD_FILE echo "POSTGRES_PASSWORD=$GUAC_PASSWORD" >> $GUAC_PROD_FILE -echo "MISTBORN_DEFAULT_PASSWORD=\"$MISTBORN_DEFAULT_PASSWORD\"" >> $GUAC_PROD_FILE \ No newline at end of file +echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $GUAC_PROD_FILE \ No newline at end of file diff --git a/scripts/subinstallers/extra/nextcloud.sh b/scripts/subinstallers/extra/nextcloud.sh index 101f93c..b1568b7 100755 --- a/scripts/subinstallers/extra/nextcloud.sh +++ b/scripts/subinstallers/extra/nextcloud.sh @@ -5,5 +5,5 @@ NEXTCLOUD_PROD_FILE="$1" #NEXTCLOUD_PASSWORD=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(32)]))") NEXTCLOUD_PASSWORD="${MISTBORN_DEFAULT_PASSWORD}" echo "NEXTCLOUD_ADMIN_USER=mistborn" > $NEXTCLOUD_PROD_FILE -echo "NEXTCLOUD_ADMIN_PASSWORD=\"$NEXTCLOUD_PASSWORD\"" >> $NEXTCLOUD_PROD_FILE +echo "NEXTCLOUD_ADMIN_PASSWORD=$NEXTCLOUD_PASSWORD" >> $NEXTCLOUD_PROD_FILE echo "NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.mistborn" >> $NEXTCLOUD_PROD_FILE \ No newline at end of file diff --git a/scripts/subinstallers/extra/onlyoffice.sh b/scripts/subinstallers/extra/onlyoffice.sh index aa9f917..3fadeca 100755 --- a/scripts/subinstallers/extra/onlyoffice.sh +++ b/scripts/subinstallers/extra/onlyoffice.sh @@ -4,4 +4,4 @@ ONLYOFFICE_PROD_FILE="$1" JWT_SECRET="${MISTBORN_DEFAULT_PASSWORD}" echo "JWT_ENABLED=true" > $ONLYOFFICE_PROD_FILE -echo "JWT_SECRET=\"$JWT_SECRET\"" >> $ONLYOFFICE_PROD_FILE \ No newline at end of file +echo "JWT_SECRET=$JWT_SECRET" >> $ONLYOFFICE_PROD_FILE \ No newline at end of file diff --git a/scripts/subinstallers/extra/rocketchat.sh b/scripts/subinstallers/extra/rocketchat.sh index f446683..6da1e2d 100755 --- a/scripts/subinstallers/extra/rocketchat.sh +++ b/scripts/subinstallers/extra/rocketchat.sh @@ -7,7 +7,7 @@ ROCKETCHAT_PASSWORD="${MISTBORN_DEFAULT_PASSWORD}" echo "ROCKETCHAT_USER=bot" > $ROCKETCHAT_PROD_FILE echo "ROCKETCHAT_ROOM=GENERAL" >> $ROCKETCHAT_PROD_FILE echo "BOT_NAME=bot" >> $ROCKETCHAT_PROD_FILE -echo "ROCKETCHAT_PASSWORD=\"$ROCKETCHAT_PASSWORD\"" >> $ROCKETCHAT_PROD_FILE +echo "ROCKETCHAT_PASSWORD=$ROCKETCHAT_PASSWORD" >> $ROCKETCHAT_PROD_FILE # docker environment echo "MISTBORN_BIND_IP=${MISTBORN_BIND_IP}" >> $ROCKETCHAT_PROD_FILE \ No newline at end of file diff --git a/scripts/subinstallers/gen_prod_env.sh b/scripts/subinstallers/gen_prod_env.sh index 73028f2..d185c32 100755 --- a/scripts/subinstallers/gen_prod_env.sh +++ b/scripts/subinstallers/gen_prod_env.sh @@ -15,8 +15,8 @@ echo "DJANGO_ADMIN_URL=admin/" >> $DJANGO_PROD_FILE echo "USE_DOCKER=yes" >> $DJANGO_PROD_FILE echo "REDIS_URL=redis://redis:6379/0" >> $DJANGO_PROD_FILE echo "CELERY_FLOWER_USER=prod" >> $DJANGO_PROD_FILE -echo "CELERY_FLOWER_PASSWORD=\"$MISTBORN_DEFAULT_PASSWORD\"" >> $DJANGO_PROD_FILE -echo "MISTBORN_DEFAULT_PASSWORD=\"$MISTBORN_DEFAULT_PASSWORD\"" >> $DJANGO_PROD_FILE +echo "CELERY_FLOWER_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $DJANGO_PROD_FILE +echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $DJANGO_PROD_FILE echo "#MAILGUN_API_KEY=" >> $DJANGO_PROD_FILE echo "#MAILGUN_API_URL=" >> $DJANGO_PROD_FILE echo "#SENTRY_DNS=" >> $DJANGO_PROD_FILE @@ -41,5 +41,5 @@ PIHOLE_PROD_FILE="./.envs/.production/.pihole" #WEBPASSWORD=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(32)]))") WEBPASSWORD="$1" echo "TZ=\"America/New York\"" > $PIHOLE_PROD_FILE -echo "WEBPASSWORD=\"$WEBPASSWORD\"" >> $PIHOLE_PROD_FILE +echo "WEBPASSWORD=$WEBPASSWORD" >> $PIHOLE_PROD_FILE chmod 600 $PIHOLE_PROD_FILE From 995a785c17bc5a6ca18deb5e3be4512e20e822d6 Mon Sep 17 00:00:00 2001 From: Steven Foerster Date: Fri, 12 Mar 2021 11:48:12 -0500 Subject: [PATCH 2/7] passwd.sh --- scripts/install.sh | 8 +------- scripts/subinstallers/passwd.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) create mode 100755 scripts/subinstallers/passwd.sh diff --git a/scripts/install.sh b/scripts/install.sh index e79b838..6d86774 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -59,13 +59,7 @@ echo -e "| | | | \__ \ |_| |_) | (_) | | | | | |" echo -e "|_| |_|_|___/\__|_.__/ \___/|_| |_| |_|" echo -e "" -# INPUT default admin password -if [ -z "${MISTBORN_DEFAULT_PASSWORD}" ]; then - read -p "(Mistborn) Set default admin password: " -s MISTBORN_DEFAULT_PASSWORD - echo -else - echo "MISTBORN_DEFAULT_PASSWORD is already set" -fi +source ./scripts/subinstallers/passwd.sh # Install Cockpit? if [ -z "${MISTBORN_INSTALL_COCKPIT}" ]; then diff --git a/scripts/subinstallers/passwd.sh b/scripts/subinstallers/passwd.sh new file mode 100755 index 0000000..5d8685e --- /dev/null +++ b/scripts/subinstallers/passwd.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# INPUT default admin password +while [ -z "${MISTBORN_DEFAULT_PASSWORD}" ]; do + echo "(Mistborn) The default admin password may only container alphanumeric characters and _" + read -p "(Mistborn) Set default admin password: " -s MISTBORN_DEFAULT_PASSWORD + echo + + if [[ $s =~ ^[A-Za-z_]+$ ]]; then + # it matches + echo "(Mistborn) Password is accepted" + else + unset MISTBORN_DEFAULT_PASSWORD + echo "(Mistborn) Try again" + fi + +done + +echo "MISTBORN_DEFAULT_PASSWORD is set" From 07e7602713ac8b92bdd98ab0bbe09682d29fd525 Mon Sep 17 00:00:00 2001 From: Steven Foerster Date: Fri, 12 Mar 2021 11:52:30 -0500 Subject: [PATCH 3/7] order --- scripts/install.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 6d86774..a142ad9 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -59,6 +59,17 @@ echo -e "| | | | \__ \ |_| |_) | (_) | | | | | |" echo -e "|_| |_|_|___/\__|_.__/ \___/|_| |_| |_|" echo -e "" +sudo rm -rf /opt/mistborn 2>/dev/null || true + +# clone to /opt and change directory +echo "Cloning $GIT_BRANCH branch from mistborn repo" +sudo git clone https://gitlab.com/cyber5k/mistborn.git -b $GIT_BRANCH /opt/mistborn +sudo chown -R $USER:$USER /opt/mistborn +pushd . +cd /opt/mistborn +git submodule update --init --recursive + +# MISTBORN_DEFAULT_PASSWORD source ./scripts/subinstallers/passwd.sh # Install Cockpit? @@ -79,16 +90,6 @@ else echo "SSH key exists for $USER" fi -sudo rm -rf /opt/mistborn 2>/dev/null || true - -# clone to /opt and change directory -echo "Cloning $GIT_BRANCH branch from mistborn repo" -sudo git clone https://gitlab.com/cyber5k/mistborn.git -b $GIT_BRANCH /opt/mistborn -sudo chown -R $USER:$USER /opt/mistborn -pushd . -cd /opt/mistborn -git submodule update --init --recursive - # initial load update package list sudo apt-get update From ac96dfc50f98586308aca5dd33d94e7b0da2cc18 Mon Sep 17 00:00:00 2001 From: Steven Foerster Date: Fri, 12 Mar 2021 11:53:28 -0500 Subject: [PATCH 4/7] extra echo --- scripts/subinstallers/passwd.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/subinstallers/passwd.sh b/scripts/subinstallers/passwd.sh index 5d8685e..f110ffa 100755 --- a/scripts/subinstallers/passwd.sh +++ b/scripts/subinstallers/passwd.sh @@ -2,6 +2,7 @@ # INPUT default admin password while [ -z "${MISTBORN_DEFAULT_PASSWORD}" ]; do + echo echo "(Mistborn) The default admin password may only container alphanumeric characters and _" read -p "(Mistborn) Set default admin password: " -s MISTBORN_DEFAULT_PASSWORD echo From 1c7b9693d376b0edb3a9bfc8313157869c5c7cd0 Mon Sep 17 00:00:00 2001 From: Steven Foerster Date: Fri, 12 Mar 2021 11:54:44 -0500 Subject: [PATCH 5/7] typo --- scripts/subinstallers/passwd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/subinstallers/passwd.sh b/scripts/subinstallers/passwd.sh index f110ffa..505599f 100755 --- a/scripts/subinstallers/passwd.sh +++ b/scripts/subinstallers/passwd.sh @@ -7,7 +7,7 @@ while [ -z "${MISTBORN_DEFAULT_PASSWORD}" ]; do read -p "(Mistborn) Set default admin password: " -s MISTBORN_DEFAULT_PASSWORD echo - if [[ $s =~ ^[A-Za-z_]+$ ]]; then + if [[ ${MISTBORN_DEFAULT_PASSWORD} =~ ^[A-Za-z_]+$ ]]; then # it matches echo "(Mistborn) Password is accepted" else From 0a050b35df2986cc1d1664371d32cceb2e938d93 Mon Sep 17 00:00:00 2001 From: Steven Foerster Date: Fri, 12 Mar 2021 11:56:15 -0500 Subject: [PATCH 6/7] numbers --- scripts/subinstallers/passwd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/subinstallers/passwd.sh b/scripts/subinstallers/passwd.sh index 505599f..5d65e70 100755 --- a/scripts/subinstallers/passwd.sh +++ b/scripts/subinstallers/passwd.sh @@ -7,7 +7,7 @@ while [ -z "${MISTBORN_DEFAULT_PASSWORD}" ]; do read -p "(Mistborn) Set default admin password: " -s MISTBORN_DEFAULT_PASSWORD echo - if [[ ${MISTBORN_DEFAULT_PASSWORD} =~ ^[A-Za-z_]+$ ]]; then + if [[ ${MISTBORN_DEFAULT_PASSWORD} =~ ^[A-Za-z0-9_]+$ ]]; then # it matches echo "(Mistborn) Password is accepted" else From 433548e561433fa9f57297a80940437f78c8caac Mon Sep 17 00:00:00 2001 From: Steven Foerster Date: Fri, 12 Mar 2021 11:57:22 -0500 Subject: [PATCH 7/7] echoes --- scripts/subinstallers/passwd.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/subinstallers/passwd.sh b/scripts/subinstallers/passwd.sh index 5d65e70..417926b 100755 --- a/scripts/subinstallers/passwd.sh +++ b/scripts/subinstallers/passwd.sh @@ -17,4 +17,6 @@ while [ -z "${MISTBORN_DEFAULT_PASSWORD}" ]; do done +echo echo "MISTBORN_DEFAULT_PASSWORD is set" +echo