From d76edd80bf9ef683e8bbdaab5945322585d246eb Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Sun, 21 May 2023 17:36:53 +0200 Subject: [PATCH] Added even more snippits --- Linux/I-V2/FileContentList.sh | 91 ++++++++++++++++++++++++++ Linux/I-V2/ModuleInstaller-TEMPLATE.sh | 22 +++++++ Linux/Nginx-Core_CMS-Config | 69 +++++++++++++++++++ Linux/README.md | 2 + 4 files changed, 184 insertions(+) create mode 100644 Linux/I-V2/FileContentList.sh create mode 100644 Linux/I-V2/ModuleInstaller-TEMPLATE.sh create mode 100644 Linux/Nginx-Core_CMS-Config create mode 100644 Linux/README.md diff --git a/Linux/I-V2/FileContentList.sh b/Linux/I-V2/FileContentList.sh new file mode 100644 index 0000000..db1833e --- /dev/null +++ b/Linux/I-V2/FileContentList.sh @@ -0,0 +1,91 @@ +#### +preconf.sh +#### +mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL +mbranch=master +if [ -z ${password+x} ]; then echo 'Error $password is not set'; fi + +debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/repo-codename select bionic' +debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/repo-distro select ubuntu' +debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/repo-url string http://repo.mysql.com/apt/' +debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-preview select ' +debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-product select Ok' +debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-server select mysql-8.0' +debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-tools select ' +debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/unsupported-platform select abort' +debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password $password" +debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password $password" +debconf-set-selections <<< "mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)" + +$PKGM update +wget -q -t7 https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb -O /tmp/mysql-apt-conf.deb +dpkg -i /tmp/mysql-apt-conf.deb > $OUTPUT 2>&1 + + +#Running Spesific WebPReconf + +if curl --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/"$webserv"-preconf.sh; then + source <(curl -s "$repo"/raw/branch/"$branch"/"$webserv"-preconf.sh) +fi + +unset mrepo +unset mbranch + +#### +Apt.list +#### +mysql-server + + +##########Runing Apt install list + + +#### +conf.sh +#### + +###Fetch Config +mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL +mbranch=master +if [ -z ${PHPMyadmin+x} ]; then echo 'Error $PHPMyadmin is not set'; fi #check if Var is set +if [ -z ${phpmyadminver+x} ]; then echo 'Error $phpmyadminver is not set'; fi #check if Var is set + +wget -q -t7 "$repo"/raw/branch/"$branch"/config/MySQL/mysqld-V8.cnf + +systemctl restart mysql +systemctl enable mysql + + +if [ $PHPMyadmin = 1 ]; then + mkdir -p /usr/share/phpmyadmin/ + mkdir -p /etc/phpmyadmin + mkdir -p /var/lib/phpmyadmin/tmp/ + wget -q -t7 https://files.phpmyadmin.net/phpMyAdmin/$phpmyadminver/phpMyAdmin-$phpmyadminver-all-languages.tar.gz + tar xzf phpMyAdmin-$phpmyadminver-all-languages.tar.gz + mv phpMyAdmin-$phpmyadminver-all-languages/* /usr/share/phpmyadmin + + wget -q -t7 "$mrepo"/raw/branch/"$mbranch"/config/phpmyadmin/vendor_config.php -O /usr/share/phpmyadmin/libraries/vendor_config.php + wget -q -t7 "$mrepo"/raw/branch/"$mbranch"/config/phpmyadmin/config.footer.inc.php -O /etc/phpmyadmin/config.footer.inc.php + wget -q -t7 "$mrepo"/raw/branch/"$mbranch"/config/phpmyadmin/config.header.inc.php -O /etc/phpmyadmin/config.header.inc.php + wget -q -t7 "$mrepo"/raw/branch/"$mbranch"/config/phpmyadmin/config.inc.php -O /etc/phpmyadmin/config.inc.php + touch /var/lib/phpmyadmin/config.inc.php + touch /etc/phpmyadmin/config-db.php + + chown -R www-data:www-data /var/lib/phpmyadmin/ + + blowsec=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + echo -e "" >> /var/lib/phpmyadmin/blowfish_secret.inc.php + + mysql -u root --password="$password" < /usr/share/phpmyadmin/sql/create_tables.sql +fi + + +#Running Spesific WebPReconf +if curl --output /dev/null --silent --head --fail "$mrepo"/raw/branch/"$mbranch"/"$webserv"-conf.sh; then + source <(curl -s "$mrepo"/raw/branch/"$mbranch"/"$webserv"-conf.sh) +fi + + +unset mrepo +unset mbranch +##end \ No newline at end of file diff --git a/Linux/I-V2/ModuleInstaller-TEMPLATE.sh b/Linux/I-V2/ModuleInstaller-TEMPLATE.sh new file mode 100644 index 0000000..c1e51f2 --- /dev/null +++ b/Linux/I-V2/ModuleInstaller-TEMPLATE.sh @@ -0,0 +1,22 @@ +#ModuleInstaller +phpmyadminver=4.9.0.1 +OUTPUT='/dev/tty' + +PKGM="apt" +PKGI="${PKGM} install -y" + +PHPMyadmin=1 + +export DEBIAN_FRONTEND=noninteractive + +#Remove this when pushing to git +password=MyVerynicePa$$word1234 + +$PKGI gnupg curl + +source preconf.sh + +echo mysql-server >>/tmp/apt.list ##ForNow +cat /tmp/apt.list | xargs $PKGI + +source conf.sh \ No newline at end of file diff --git a/Linux/Nginx-Core_CMS-Config b/Linux/Nginx-Core_CMS-Config new file mode 100644 index 0000000..2ee941e --- /dev/null +++ b/Linux/Nginx-Core_CMS-Config @@ -0,0 +1,69 @@ +#Insert new config +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r CMS_Config.txt' -e '/#ConfHere/c\' Base_Nginx_Config.txt + +#Backup existing config +sed -n '/#beginConf/,/#endConf/p' Real-site > CMS_Config-Backup.txt + +#Remove existing config +sed -n -i '/#beginConf/{:a;N;/#endConf/!ba;N;s/.*\n/#ConfHere1\n/};p' Base_Nginx_Config.txt + +###################################### +Base_Nginx_Config.txt Content example +###################################### + +#generated by certbot from here +server { + listen 443 ssl; + listen [::]:443 ssl; + server_name www.DOMAINname; + return 301 http://DOMAINname$request_uri; +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + server_name DOMAINname; + + +#ConfHere + +} +#generated by certbot to here + + +server { + listen 80; + listen [::]:80; + server_name www.DOMAINname; + return 301 http://DOMAINname$request_uri; +} + +server { + listen 80; + listen [::]:80; + server_name DOMAINname; + + +#ConfHere + +} + +############################### +CMS_Config.txt Content example +############################### + +#beginConf + gzip on; + gzip_proxied any; + gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript image/svg image/svg+xml application/xml image/x-icon; + gzip_comp_level 2; + gzip_disable "msie6"; + gzip_buffers 16 8k; + + + location / { + #try_files $uri $uri/ =404; + try_files $uri $uri/ /index.php$is_args$args; + #try_files $uri $uri/ $uri.html $uri.php$is_args$query_string; + } +#endConf \ No newline at end of file diff --git a/Linux/README.md b/Linux/README.md new file mode 100644 index 0000000..3a71fbb --- /dev/null +++ b/Linux/README.md @@ -0,0 +1,2 @@ +# Priv-Snip +