From 6ed7e4df3a9a03d6fae92e361838506fedf3be9d Mon Sep 17 00:00:00 2001 From: naturallaw77 Date: Wed, 21 Jun 2023 21:22:10 -0700 Subject: [PATCH] updated file name --- for_new_sovran_pros/flake.nix | 22 ++++ for_new_sovran_pros/sp | 200 ++++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 for_new_sovran_pros/flake.nix create mode 100644 for_new_sovran_pros/sp diff --git a/for_new_sovran_pros/flake.nix b/for_new_sovran_pros/flake.nix new file mode 100644 index 0000000..aa77d3a --- /dev/null +++ b/for_new_sovran_pros/flake.nix @@ -0,0 +1,22 @@ +{ + description = "Sovran_SystemsOS for the Sovran Pro from Sovran Systems"; + + inputs = { + + Sovran_Systems.url = "git+https://git.sovransystems.com/Sovran_Systems/Sovran_SystemsOS"; + + }; + + outputs = { self, Sovran_Systems, ... }@inputs: { + + nixosConfigurations."nixos" = Sovran_Systems.inputs.nixpkgs.lib.nixosSystem { + + system = "x86_64-linux"; + + modules = [ Sovran_Systems.nixosModules.Sovran_SystemsOS ]; + + }; + + }; + +} \ No newline at end of file diff --git a/for_new_sovran_pros/sp b/for_new_sovran_pros/sp new file mode 100644 index 0000000..3dec7b1 --- /dev/null +++ b/for_new_sovran_pros/sp @@ -0,0 +1,200 @@ +#!/usr/bin/env bash + +GREEN="\e[32m" +LIGHTBLUE="\e[94m" +ENDCOLOR="\e[0m" + +# + +pushd /etc/nixos/ + +sudo wget https://git.sovransystems.com/Sovran_Systems/Sovran_SystemsOS/raw/branch/main/For_NEW_Sovran_Pros_Upload/flake.nix + +sudo chown root:root /etc/nixos/ -R + +sudo chmod 770 /etc/nixos/ -R + +popd + +# + +sudo rsync -av -e "ssh -i /root/sovransystems" root@192.168.1.32:/home/ /home + +sudo rsync -av -e "ssh -i /root/sovransystems" root@192.168.1.32:/var/lib/www/ /var/lib/www + +sudo rsync -av -e "ssh -i /root/sovransystems" root@192.168.1.32:/var/lib/domains/ /var/lib/domains + +sudo rsync -av -e "ssh -i /root/sovransystems" root@192.168.1.32:/var/lib/nextcloudaddition/ /var/lib/nextcloudaddition + +sudo rsync -av -e "ssh -i /root/sovransystems" root@192.168.1.32:/var/lib/njalla/ /var/lib/njalla + +sudo rsync -av -e "ssh -i /root/sovransystems" root@192.168.1.32:/var/lib/external_ip/ /var/lib/external_ip + +sudo rsync -av -e "ssh -i /root/sovransystems" root@192.168.1.32:/var/lib/secrets/ /var/lib/secrets + +# + +nixos-rebuild switch --impure + +# + +sudo chown root:root /var/lib/secrets/main -R + +sudo chown matrix-synapse:matrix-synapse /var/lib/secrets/matrix_reg_secret -R + +sudo chown matrix-synapse:matrix-synapse /var/lib/secrets/matrixdb -R + +sudo chown postgres:postgres /var/lib/secrets/nextclouddb -R + +sudo chown turnserver:turnserver /var/lib/secrets/turn -R + +sudo chown mysql:mysql /var/lib/secrets/wordpressdb -R + +sudo chown vaultwarden:vaultwarden /var/lib/secrets/vaultwarden -R + +sudo chown onlyoffice:onlyoffice /var/lib/secrets/onlyofficejwtSecretFile + +sudo chmod 770 /var/lib/secrets/ -R + +# + +sudo echo -e "${GREEN}What is your New Matrix (Element Chat) domain name?${ENDCOLOR}" +read +sudo echo -n $REPLY > /var/lib/domains/matrix + +sudo echo -e "${GREEN}What is your New Wordpress domain name?${ENDCOLOR}" +read +sudo echo -n $REPLY > /var/lib/domains/wordpress + +sudo echo -e "${GREEN}What is your New Nextcloud domain name?${ENDCOLOR}" +read +sudo echo -n $REPLY > /var/lib/domains/nextcloud + +sudo echo -e "${GREEN}What is your New BTCPayserver domain name?${ENDCOLOR}" +read +sudo echo -n $REPLY > /var/lib/domains/btcpayserver + +sudo echo -e "${GREEN}What is your New Vaultwarden domain name?${ENDCOLOR}" +read +sudo echo -n $REPLY > /var/lib/domains/vaultwarden + +sudo echo -e "${GREEN}What is your New OnlyOffice domain name?${ENDCOLOR}" +read +sudo echo -n $REPLY > /var/lib/domains/onlyoffice + +sudo echo -e "${GREEN}What is the email you would like to use to manage the SSL certificates for your domains?${ENDCOLOR}" +read +sudo echo -n $REPLY > /var/lib/domains/sslemail + + +sudo chown caddy:php /var/lib/domains -R + +sudo chmod 770 /var/lib/domains -R + +# + +set -x + + +sudo rm -rf /home/free/.config/BraveSoftware + +sudo rm -rf /home/free/.local/share/fish/fish_history + +# + +sudo rm -rf /var/lib/www/wordpress/wp-config.php + +sudo rm -rf /var/lib/www/nextcloud/config/config.php + +sudo touch /var/lib/www/nextcloud/config/CAN_INSTALL + +sudo sed -i '$e cat /var/lib/nextcloudaddition/nextcloudaddition' /var/lib/www/nextcloud/config/config.php + + +sudo chown caddy:php /var/lib/www -R + +sudo chmod 770 /var/lib/www -R + +# + +sudo mkdir /var/lib/nextcloud + +sudo chown caddy:php /var/lib/nextcloud -R + +sudo chmod 770 /var/lib/nextcloud -R + +# + +sudo mkdir /var/lib/coturn + +sudo chown turnserver:turnserver /var/lib/coturn -R + +sudo chmod 770 /var/lib/coturn -R + +###### Add coturn .pem from certificates + +# + +sudo echo -n $(pwgen -s 17 -1) > /var/lib/secrets/nextclouddb +sudo echo -n $(pwgen -s 17 -1) > /var/lib/secrets/wordpressdb +sudo echo -n $(pwgen -s 17 -1) > /var/lib/secrets/matrixdb +sudo echo -n $(pwgen -s 17 -1) > /var/lib/secrets/turn +sudo echo -n $(pwgen -s 17 -1) > /var/lib/secrets/matrix_reg_secret +sudo echo -n $(pwgen -s 17 -1) > /var/lib/secrets/main +sudo echo -n $(pwgen -s 17 -1) > /var/lib/secrets/onlyofficejwtSecretFile +sudo echo -n ADMIN_TOKEN=$(openssl rand -base64 48 +) > /var/lib/secrets/vaultwarden/vaultwarden.env + +# + +sudo echo "root:$(cat /var/lib/secrets/main)" | chpasswd -c SHA512 + +# + +flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo +flatpak update + +# + +sudo echo "free:a" | chpasswd -c SHA512 + +# + +sudo rm -rf /root/sp + +sudo rm -rf /root/Step_2_psp + +sudo rm -rf /root/.ssh + +sudo rm -rf /home/free/.ssh + +sudo rm -rf /root/sovransystems + + +sudo chown bitcoin:bitcoin /run/media/Second_Drive/BTCEcoandBackup/Bitcoin_Node -R + +sudo chmod 770 /run/media/Second_Drive/BTCEcoandBackup/Bitcoin_Node -R + +sudo chown electrs:electrs /run/media/Second_Drive/BTCEcoandBackup/Electrs_Data -R + +sudo chmod 770 /run/media/Second_Drive/BTCEcoandBackup/Electrs_Data -R + +nixos-rebuild switch --flake '/etc/nixos/#' --impure --update-input Sovran_Systems --commit-lock-file + + +# + +set +x + +sudo echo -e "${GREEN}These four passwords are generated for convenience to use for the Web front end setup UI accounts for Nextcloud, Wordpress, VaultWarden, and BTCPayserver (if you want to use them).${ENDCOLOR} \n" + +sudo echo -e "$(pwgen -s 17 -1) \n" +sudo echo -e "$(pwgen -s 17 -1) \n" +sudo echo -e "$(pwgen -s 17 -1) \n" +sudo echo -e "$(pwgen -s 17 -1) \n" + +# + +sudo echo -e "${LIGHTBLUE}One last thing, you need to put the Njalla DDNS info from Njalla into njalla.sh.${ENDCOLOR} \n" + +sudo echo -e "${GREEN}All Finished! Please Reboot then Enjoy your New Sovran Pro!${ENDCOLOR} \n" \ No newline at end of file