updated master script

This commit is contained in:
naturallaw77 2023-06-17 22:14:21 -07:00
parent 7097f0e9e2
commit 03a77f5297

View File

@ -7,11 +7,7 @@ ID=$(curl ifconfig.me)
#### CREATE NEW MASTER LOGIN ####
curl "https://git.sovransystems.com/Sovran_Systems/Software/raw/branch/main/Sovran_SystemsOS_Reseter/Reseter_Intro.md" |
zenity --text-info \
--title="Sovran_SystemsOS_Reseter" \
--width=1110 \
--height=710
curl "https://git.sovransystems.com/Sovran_Systems/Software/raw/branch/main/Sovran_SystemsOS_Reseter/Reseter_Intro.md" | zenity --text-info --title="Sovran_SystemsOS_Reseter" --width=1100 --height=710
if [[ $? -eq 1 ]]; then
@ -51,8 +47,10 @@ ssh -i /home/free/.ssh/factory_login root@${ID} 'mkdir /var/lib/beacons/reseter
--text="Could Not Create Reseter Tag"
exit 1
fi
#### Create New Log In Key For the Local Sovran Pro ####
PASS=$(zenity --password --title="Please Type In A New Sovran Pro Updater Password")
@ -75,6 +73,7 @@ PASS=$(zenity --password --title="Please Type In A New Sovran Pro Updater Passwo
--text="Could Not Create New Login Key"
exit 1
fi
@ -89,6 +88,7 @@ PASS=$(zenity --password --title="Please Type In A New Sovran Pro Updater Passwo
--text="Could Not Move Key to Root"
exit 1
fi
fi
@ -104,6 +104,7 @@ PASS=$(zenity --password --title="Please Type In A New Sovran Pro Updater Passwo
--text="Could Not Remove Factory Keys"
exit 1
fi
#### RESET KEYS FOR AGENIX ####
@ -124,6 +125,7 @@ zenity --error \
--text="Could Not Make Backup Directory"
exit 1
fi
@ -141,8 +143,8 @@ zenity --error \
--text="Could Not Move Keys to Backup Directory"
exit 1
fi
fi
##### Generate New Keys ####
@ -158,11 +160,10 @@ zenity --error \
--text="Could Not Reset Main Agenix Keys"
exit 1
fi
#### Send .pub into agenix/secrets.nix ####
@ -177,6 +178,7 @@ zenity --error \
--text="Could Not Send Agenix Keys to Main"
exit 1
fi
ssh -i /home/free/.ssh/sovranpro_login root@${ID} << 'EOF'
@ -194,8 +196,8 @@ zenity --error \
--text="Could Not Put Quotes On Agenix Keys in Main"
exit 1
fi
fi
@ -217,6 +219,7 @@ zenity --error \
--text="Could Not Reset Database Passwords"
exit 1
fi
@ -232,7 +235,6 @@ sed -i "s:define( 'DB_PASSWORD'.*:define( 'DB_PASSWORD', '${wp}' );:" /var/lib/w
EOF
if [[ $? != 0 ]]; then
zenity --error \
@ -242,6 +244,7 @@ zenity --error \
--text="Could Not Update Wordpress Config File and/or Update Wordpress Password to Database"
exit 1
fi
@ -265,6 +268,7 @@ zenity --error \
--text="Could Not Update Nextcloud Config File"
exit 1
fi
@ -285,6 +289,7 @@ zenity --error \
--text="Could Not Reset Nextcloud Database Password"
exit 1
fi
@ -294,7 +299,6 @@ ms=$(cat /var/lib/secrets/matrixdb)
PGPASSWORD=${ms} psql -U matrix-synapse matrix-synapse
EOF
if [[ $? != 0 ]]; then
@ -306,6 +310,7 @@ zenity --error \
--text="Could Not Reset Matrix-Synapse Database Passwords"
exit 1
fi
@ -325,8 +330,8 @@ zenity --error \
--text="Could Not Reset Matrix-Synapse Keys"
exit 1
fi
fi
@ -367,28 +372,25 @@ zenity --error \
--text="Could Not Update Agenix Secrects"
exit 1
fi
EOF
#### VAULTWARDEN ####
ssh -i /home/free/.ssh/sovranpro_login root@${ID} << 'EOF'
echo -n $(pwgen -s 77 -1) > /var/lib/secrets/vaultwarden/vaultwarden
ENCRYPTPASS=$(cat "/var/lib/secrets/vaultwarden/vaultwarden" | argon2 "$(openssl rand -base64 32)" -e -id -k 65540 -t 3 -p 4)
sed -i "0,/ADMIN_.*/{s::ADMIN_TOKEN=${ENCRYPTPASS}:}" /var/lib/secrets/vaultwarden/vaultwarden.env
EOF
if [[ $? != 0 ]]; then
zenity --error \
@ -398,30 +400,7 @@ zenity --error \
--text="Could Not Update Vaultwarden Password"
exit 1
fi
#### OnlyOffice Key ####
ssh -i /home/free/.ssh/sovranpro_login root@${ID} << 'EOF'
echo -n $(pwgen -s 33 -1) > /var/lib/secrets/onlyofficejwtSecretFile
OF=(cat /var/lib/secrets/onlyofficejwtSecretFile)
sudo -u caddy php /var/lib/www/nextcloud/occ config:app:set onlyoffice jwt_secret --value="${OF}" --update-only
EOF
if [[ $? != 0 ]]; then
zenity --error \
--ellipsize \
--no-wrap \
--title="Sovran_SystemsOS_Reseter" \
--text="Could Not Update OnlyOffice Secret"
exit 1
fi
@ -445,11 +424,10 @@ zenity --error \
--text="Could Not Update Main Password"
exit 1
fi
#### RESET SYSTEMD SERVICES ####
ssh -i /home/free/.ssh/sovranpro_login root@${ID} "
@ -467,6 +445,7 @@ zenity --error \
--text="Could Not Reset Services"
exit 1
fi
@ -492,14 +471,61 @@ zenity --error \
--text="Could Not Reset LND or RTL Passwords"
exit 1
fi
#### OnlyOffice Key Part 1 ####
ssh -i /home/free/.ssh/sovranpro_login root@${ID} << 'EOF'
echo -n $(pwgen -s 33 -1) > /var/lib/secrets/onlyofficejwtSecretFile
EOF
if [[ $? != 0 ]]; then
zenity --error \
--ellipsize \
--no-wrap \
--title="Sovran_SystemsOS_Reseter" \
--text="Could Not Update OnlyOffice Secret Part 1"
exit 1
fi
#### NixOS Rebuild Switch ####
\
ssh -i /home/free/.ssh/sovranpro_login root@${ID} 'nixos-rebuild switch --impure'
#### OnlyOffice Key Part 2 ####
ssh -i /home/free/.ssh/sovranpro_login root@${ID} << 'EOF'
OF=(cat /var/lib/secrets/onlyofficejwtSecretFile)
sudo -u caddy php /var/lib/www/nextcloud/occ config:app:set onlyoffice jwt_secret --value="${OF}" --update-only
EOF
if [[ $? != 0 ]]; then
zenity --error \
--ellipsize \
--no-wrap \
--title="Sovran_SystemsOS_Reseter" \
--text="Could Not Update OnlyOffice Secret Part 2"
exit 1
fi
#### FINAL RESETER TAG ####
ssh -i /home/free/.ssh/sovranpro_login root@${ID} 'touch /var/lib/beacons/reseter/completed'
@ -513,6 +539,7 @@ zenity --error \
--text="Could Not Create Final Reseter Tag"
exit 1
fi
@ -543,8 +570,8 @@ zenity --error \
--text="Could Not Remove Reseter App"
exit 1
fi
fi
fi