diff --git a/CMS/Backend/apache-conf.sh b/CMS/Backend/apache-conf.sh new file mode 100644 index 0000000..1e97fa2 --- /dev/null +++ b/CMS/Backend/apache-conf.sh @@ -0,0 +1,4 @@ +wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/Backend/apache-siteBackend-unconfigured -O /tmp/apache-siteconf +sed -i -e 's/PHPver/'$phpver'/' -e 's/DOMAINname/'$hostname'/' /tmp/apache-siteconf +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' /etc/apache2/sites-available/Backend_"$site_ext".conf +systemctl reload apache2 \ No newline at end of file diff --git a/CMS/Backend/apache-siteBackend-unconfigured b/CMS/Backend/apache-siteBackend-unconfigured new file mode 100644 index 0000000..435201a --- /dev/null +++ b/CMS/Backend/apache-siteBackend-unconfigured @@ -0,0 +1,23 @@ +#beginConf + +ErrorLog ${APACHE_LOG_DIR}/Backend_error.log +#CustomLog ${APACHE_LOG_DIR}/Backend_custom.log combined + +DirectoryIndex index.php index.html index.htm +DocumentRoot /var/www/html + +Alias /backend/database /usr/share/phpmyadmin + + + #enables/disables PHPMyadmin + deny from all + Require all granted + Options FollowSymLinks + DirectoryIndex index.php + + SetHandler "proxy:unix:/var/run/php/phpPHPver-fpm-Backend.sock|fcgi://localhost" + + + + +#endConf diff --git a/CMS/nextcloud/Apache-unconfigured b/CMS/nextcloud/Apache-unconfigured new file mode 100644 index 0000000..53f1d02 --- /dev/null +++ b/CMS/nextcloud/Apache-unconfigured @@ -0,0 +1,31 @@ +#beginConf + +ErrorLog ${APACHE_LOG_DIR}/SITEname_error.log +#CustomLog ${APACHE_LOG_DIR}/SITEname_custom.log combined + +DirectoryIndex index.php index.html index.htm +DocumentRoot /var/www/DOMAINname/html + +Redirect 301 /.well-known/carddav /remote.php/dav +Redirect 301 /.well-known/caldav /remote.php/dav + + + Require all granted + AllowOverride All + Options FollowSymLinks MultiViews + Satisfy Any + + Dav off + + + + + + Require all denied + + + + SetHandler "proxy:unix:/var/run/php/phpPHPver-fpm-SITEname.sock|fcgi://localhost" + + +#endConf \ No newline at end of file diff --git a/CMS/nextcloud/apache-conf.sh b/CMS/nextcloud/apache-conf.sh new file mode 100644 index 0000000..5a15506 --- /dev/null +++ b/CMS/nextcloud/apache-conf.sh @@ -0,0 +1,11 @@ +#Apache +wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/Apache-unconfigured -O /tmp/apache-siteconf +sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' -e 's/SITEname/'$sitename'/' /tmp/apache-siteconf +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' /etc/apache2/sites-available/"$sitename"_"$site_ext".conf +chown "$sitename":"$sitename" -R /var/www/"$domain"/html + +#PHP +sed -i -e '/cgi.fix_pathinfo/c\php_admin_value[cgi.fix_pathinfo] = 1' /etc/php/"$phpver"/fpm/pool.d/$sitename.conf +sed -i -e '/security.limit_extensions/c\php_admin_value[security.limit_extensions] = .php' /etc/php/"$phpver"/fpm/pool.d/$sitename.conf + +systemctl reload apache2 php$phpver-fpm \ No newline at end of file diff --git a/CMS/nextcloud/apt.list b/CMS/nextcloud/apt.list index 2ef3460..ec3571c 100644 --- a/CMS/nextcloud/apt.list +++ b/CMS/nextcloud/apt.list @@ -1 +1 @@ -libmagickcore-6.q16-3-extra libxml2 openssl zlib1g libpng-dev \ No newline at end of file +libmagickcore-6.q16-3-extra libxml2 openssl zlib1g libpng-dev phpPHPver-apcu phpPHPver-bcmath phpPHPver-gmp \ No newline at end of file diff --git a/CMS/nextcloud/conf.sh b/CMS/nextcloud/conf.sh index 9a6cabd..89e34cf 100644 --- a/CMS/nextcloud/conf.sh +++ b/CMS/nextcloud/conf.sh @@ -3,6 +3,47 @@ wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/Fpm-Pool.conf-unconfigure sed -i -e 's/PHPver/'$phpver'/' -e 's/SITEname/'$sitename'/' -e 's/DOMAINname/'$domain'/' /etc/php/"$phpver"/fpm/pool.d/$sitename.conf groupadd "$sitename" useradd -g "$sitename" "$sitename" +mkdir -p /var/www/"$domain"/html/data + +#Getting Nextcloud +wget -t7 http://mirror.nxdi.nl/resources/nextcloud/latest.tar.bz2 -O /tmp/nextcloud.tar.bz2 +tar jxf /tmp/nextcloud.tar.bz2 -C /tmp +cp -a /tmp/nextcloud/. /var/www/"$domain"/html +touch /var/www/"$domain"/html/data/nextcloud.log + +#Creating DB +db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1` +db_name="nextcloud_$db_suffix" +db_user="nextcloud_$db_suffix" +db_pass=$(date +%s|sha256sum|base64|head -c 32) +mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" > $OUTPUT 2>&1 +mysql -u root -p"$password" -e "CREATE USER '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" > $OUTPUT 2>&1 +mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost';" > $OUTPUT 2>&1 +mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1 + +#Configuring Nextcloud +cat < /var/www/$domain/html/config/autoconfig.php + "mysql", + "dbname" => "${db_name}", + "dbuser" => "${db_user}", + "dbpass" => "${db_pass}", + "dbhost" => "localhost", + "dbtableprefix" => "", + "simpleSignUpLink.shown" => false, + "directory" => "/var/www/$domain/html/data", +); +EOF + +chown "$sitename":"$sitename" -R /var/www/"$domain"/html + +#Makeing nextcloud Finalize script and setting login Notice +wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/nextcloud-init.sh -O ~/nextcloud-init.sh +sed -i -e 's/DOMAINname/'$domain'/' -e 's/SITEname/'$sitename'/' ~/nextcloud-init.sh +wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/MotdNextCloud -O /etc/update-motd.d/51-nextnotice +chmod +x /etc/update-motd.d/51-nextnotice + #Nextcloud logging location mkdir /var/log/nextcloud diff --git a/CMS/nextcloud/nginx-apt.list b/CMS/nextcloud/nginx-apt.list deleted file mode 100644 index 38c753d..0000000 --- a/CMS/nextcloud/nginx-apt.list +++ /dev/null @@ -1 +0,0 @@ -phpPHPver-apcu phpPHPver-bcmath phpPHPver-gmp \ No newline at end of file diff --git a/CMS/nextcloud/nginx-conf.sh b/CMS/nextcloud/nginx-conf.sh index 92c2a70..c6e88d2 100644 --- a/CMS/nextcloud/nginx-conf.sh +++ b/CMS/nextcloud/nginx-conf.sh @@ -7,46 +7,9 @@ sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/ng if [ $sslenable = 0 ]; then sed -i -e '/fastcgi_param HTTPS/c\# fastcgi_param HTTPS' /etc/nginx/sites-available/"$sitename"_nossl fi -mkdir -p /var/www/"$domain"/html/data + systemctl reload nginx -#Getting Nextcloud -wget -t7 http://mirror.nxdi.nl/resources/nextcloud/latest.tar.bz2 -O /tmp/nextcloud.tar.bz2 -tar jxf /tmp/nextcloud.tar.bz2 -C /tmp -cp -a /tmp/nextcloud/. /var/www/"$domain"/html -touch /var/www/"$domain"/html/data/nextcloud.log -#Creating DB -db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1` -db_name="nextcloud_$db_suffix" -db_user="nextcloud_$db_suffix" -db_pass=$(date +%s|sha256sum|base64|head -c 32) -mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" > $OUTPUT 2>&1 -mysql -u root -p"$password" -e "CREATE USER '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" > $OUTPUT 2>&1 -mysql -u root -p"$password" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost';" > $OUTPUT 2>&1 -mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1 - -#Configuring Nextcloud -cat < /var/www/$domain/html/config/autoconfig.php - "mysql", - "dbname" => "${db_name}", - "dbuser" => "${db_user}", - "dbpass" => "${db_pass}", - "dbhost" => "localhost", - "dbtableprefix" => "", - "simpleSignUpLink.shown" => false, - "directory" => "/var/www/$domain/html/data", -); -EOF - -chown "$sitename":"$sitename" -R /var/www/"$domain"/html - -#Makeing nextcloud Finalize script and setting login Notice -wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/nextcloud-init.sh -O ~/nextcloud-init.sh -sed -i -e 's/DOMAINname/'$domain'/' -e 's/SITEname/'$sitename'/' ~/nextcloud-init.sh -wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/nextcloud/MotdNextCloud -O /etc/update-motd.d/51-nextnotice -chmod +x /etc/update-motd.d/51-nextnotice diff --git a/CMS/none/Apache-unconfigured b/CMS/none/Apache-unconfigured new file mode 100644 index 0000000..86dce03 --- /dev/null +++ b/CMS/none/Apache-unconfigured @@ -0,0 +1,21 @@ +#beginConf + +ErrorLog ${APACHE_LOG_DIR}/SITEname_error.log +#CustomLog ${APACHE_LOG_DIR}/SITEname_custom.log combined + +DirectoryIndex index.php index.html index.htm +DocumentRoot /var/www/DOMAINname/html + + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all + + + + SetHandler "proxy:unix:/var/run/php/phpPHPver-fpm-SITEname.sock|fcgi://localhost" + + +#endConf \ No newline at end of file diff --git a/CMS/none/apache-conf.sh b/CMS/none/apache-conf.sh new file mode 100644 index 0000000..f9793ec --- /dev/null +++ b/CMS/none/apache-conf.sh @@ -0,0 +1,9 @@ +wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/none/Apache-unconfigured -O /tmp/apache-siteconf +sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' -e 's/SITEname/'$sitename'/' /tmp/apache-siteconf +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' /etc/apache2/sites-available/"$sitename"_"$site_ext".conf +mkdir -p /var/www/"$domain"/html + +echo "$webserv has been succsefully installed by the Wizard" > /var/www/$domain/html/index.html + +chown "$sitename":"$sitename" -R /var/www/"$domain"/html +systemctl reload apache2 \ No newline at end of file diff --git a/CMS/wordpress/Apache-unconfigured b/CMS/wordpress/Apache-unconfigured new file mode 100644 index 0000000..feb2c84 --- /dev/null +++ b/CMS/wordpress/Apache-unconfigured @@ -0,0 +1,36 @@ +#beginConf + +ErrorLog ${APACHE_LOG_DIR}/SITEname_error.log +#CustomLog ${APACHE_LOG_DIR}/SITEname_custom.log combined + +DirectoryIndex index.php index.html index.htm +DocumentRoot /var/www/DOMAINname/html + + + + Options FollowSymLinks + AllowOverride Limit Options FileInfo + DirectoryIndex index.php + Order allow,deny + Allow from all + + RewriteEngine On + RewriteBase / + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule . /index.php [L] + + + + + Options FollowSymLinks + Order allow,deny + Allow from all + + + + + SetHandler "proxy:unix:/var/run/php/phpPHPver-fpm-SITEname.sock|fcgi://localhost" + + +#endConf \ No newline at end of file diff --git a/CMS/wordpress/apache-conf.sh b/CMS/wordpress/apache-conf.sh new file mode 100644 index 0000000..5145bbb --- /dev/null +++ b/CMS/wordpress/apache-conf.sh @@ -0,0 +1,6 @@ +wget -q -t7 "$repo"/raw/branch/"$branch"/CMS/wordpress/Apache-unconfigured -O /tmp/apache-siteconf +sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/' -e 's/SITEname/'$sitename'/' /tmp/apache-siteconf +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' /etc/apache2/sites-available/"$sitename"_"$site_ext".conf + +chown "$sitename":"$sitename" -R /var/www/"$domain"/html +systemctl reload apache2 php$phpver-fpm \ No newline at end of file diff --git a/CoreModules/apache/appendCMS-conf.sh b/CoreModules/apache/appendCMS-conf.sh new file mode 100644 index 0000000..6851d69 --- /dev/null +++ b/CoreModules/apache/appendCMS-conf.sh @@ -0,0 +1,22 @@ +############## +# Apache # +############## + +if [ $domainwww = 1 ]; then + #non-ssl + wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site-wwwredir >> /etc/apache2/sites-available/"$sitename"_nossl.conf + echo "" >> /etc/apache2/sites-available/"$sitename"_nossl.conf + #ssl + wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site_ssl-wwwredir >> /etc/apache2/sites-available/"$sitename"_ssl.conf + echo "" >> /etc/apache2/sites-available/"$sitename"_ssl.conf +fi + +#non-ssl +wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> /etc/apache2/sites-available/"$sitename"_nossl.conf +sed -i -e 's/DOMAINname/'$domain'/' /etc/apache2/sites-available/"$sitename"_nossl.conf +ln -s /etc/apache2/sites-available/"$sitename"_nossl.conf /etc/apache2/sites-enabled/010-"$sitename".conf +#ssl +wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> /etc/apache2/sites-available/"$sitename"_ssl.conf +sed -i -e 's/DOMAINname/'$domain'/' /etc/apache2/sites-available/"$sitename"_ssl.conf + +systemctl reload apache2 \ No newline at end of file diff --git a/CoreModules/apache/apt.list b/CoreModules/apache/apt.list index 2cc4251..c05a90a 100644 --- a/CoreModules/apache/apt.list +++ b/CoreModules/apache/apt.list @@ -1 +1 @@ -apache2 php-pear libapache2-mod-php phpPHPver-mysql phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-xmlrpc phpPHPver-zip python-certbot-apache \ No newline at end of file +apache2 libapache2-mod-fcgid python-certbot-apache \ No newline at end of file diff --git a/CoreModules/apache/conf.sh b/CoreModules/apache/conf.sh new file mode 100644 index 0000000..f61ac82 --- /dev/null +++ b/CoreModules/apache/conf.sh @@ -0,0 +1,52 @@ +systemctl stop apache2 + +############## +# Apache # +############## + +a2dissite 000-default +a2dismod mpm_prefork +a2enmod actions fcgid alias proxy_fcgi ssl headers http2 setenvif socache_shmcb + +mkdir -p /etc/apache2/snippets/ +wget -q -t7 "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/snippets-ssl.conf -O /etc/apache2/snippets/apa-ssl.conf +wget -q -t7 "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/conf-custom.conf -O /etc/apache2/conf-enabled/zzz-custom.conf + +#Catch all (ip and unconfigured domains) +wget - -t7 "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site_CatchAll -O /etc/apache2/sites-available/CatchAll.conf +ln -s /etc/apache2/sites-available/CatchAll.conf /etc/apache2/sites-enabled/999-CatchAll.conf + + +if [ $domainwww = 1 ]; then + #non-ssl + wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site-wwwredir >> /etc/apache2/sites-available/"$sitename"_nossl.conf + echo "" >> /etc/apache2/sites-available/"$sitename"_nossl.conf + #ssl + wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site_ssl-wwwredir >> /etc/apache2/sites-available/"$sitename"_ssl.conf + echo "" >> /etc/apache2/sites-available/"$sitename"_ssl.conf +fi +#non-ssl +wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> /etc/apache2/sites-available/"$sitename"_nossl.conf +sed -i -e 's/DOMAINname/'$domain'/' /etc/apache2/sites-available/"$sitename"_nossl.conf +ln -s /etc/apache2/sites-available/"$sitename"_nossl.conf /etc/apache2/sites-enabled/010-"$sitename".conf +#ssl +wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> /etc/apache2/sites-available/"$sitename"_ssl.conf +sed -i -e 's/DOMAINname/'$domain'/' /etc/apache2/sites-available/"$sitename"_ssl.conf + +#non-ssl-Backend +wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> /etc/apache2/sites-available/Backend_nossl.conf +sed -i -e 's/DOMAINname/'$hostname'/' /etc/apache2/sites-available/Backend_nossl.conf +ln -s /etc/apache2/sites-available/Backend_nossl.conf /etc/apache2/sites-enabled/010-Backend.conf +#ssl-Backend +wget -q -t7 -O - "$repo"/raw/branch/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> /etc/apache2/sites-available/Backend_ssl.conf +sed -i -e 's/DOMAINname/'$hostname'/' /etc/apache2/sites-available/Backend_ssl.conf + + +mkdir -p /opt/toggle +wget -q -t7 "$repo"/raw/branch/"$branch"/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh -O /opt/toggle/toggle-PhpMyAdmin.sh + + +# custom Welcome page +echo "$webserv is functioning normally" > /var/www/html/index.html + +systemctl start apache2 \ No newline at end of file diff --git a/CoreModules/apache/config/apache2/conf-custom.conf b/CoreModules/apache/config/apache2/conf-custom.conf new file mode 100644 index 0000000..de264b3 --- /dev/null +++ b/CoreModules/apache/config/apache2/conf-custom.conf @@ -0,0 +1,3 @@ +SSLStaplingCache "shmcb:logs/ssl_stapling(32768)" +ServerTokens Prod +ServerSignature Off \ No newline at end of file diff --git a/CoreModules/apache/config/apache2/site-unconfigured b/CoreModules/apache/config/apache2/site-unconfigured new file mode 100644 index 0000000..fcdf18c --- /dev/null +++ b/CoreModules/apache/config/apache2/site-unconfigured @@ -0,0 +1,6 @@ + + ServerName DOMAINname + +#ConfHere + + diff --git a/CoreModules/apache/config/apache2/site-wwwredir b/CoreModules/apache/config/apache2/site-wwwredir new file mode 100644 index 0000000..03ecf2c --- /dev/null +++ b/CoreModules/apache/config/apache2/site-wwwredir @@ -0,0 +1,4 @@ + + ServerName www.DOMAINname + Redirect permanent / http://DOMAINname/ + diff --git a/CoreModules/apache/config/apache2/site_CatchAll b/CoreModules/apache/config/apache2/site_CatchAll new file mode 100644 index 0000000..eb855a3 --- /dev/null +++ b/CoreModules/apache/config/apache2/site_CatchAll @@ -0,0 +1,8 @@ + + DocumentRoot /var/www/html + ServerName localhost + ServerAlias "*" + ErrorLog /dev/null + CustomLog /dev/null common + + diff --git a/CoreModules/apache/config/apache2/site_ssl-unconfigured b/CoreModules/apache/config/apache2/site_ssl-unconfigured new file mode 100644 index 0000000..fe060cd --- /dev/null +++ b/CoreModules/apache/config/apache2/site_ssl-unconfigured @@ -0,0 +1,16 @@ + + ServerName DOMAINname + Redirect permanent / https://DOMAINname/ + + + + ServerName DOMAINname + SSLEngine on + SSLCertificateFile /etc/letsencrypt/live/DOMAINname/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/DOMAINname/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/DOMAINname/chain.pem + Include snippets/apa-ssl.conf + +#ConfHere + + \ No newline at end of file diff --git a/CoreModules/apache/config/apache2/site_ssl-wwwredir b/CoreModules/apache/config/apache2/site_ssl-wwwredir new file mode 100644 index 0000000..1b6fd32 --- /dev/null +++ b/CoreModules/apache/config/apache2/site_ssl-wwwredir @@ -0,0 +1,14 @@ + + ServerName www.DOMAINname + Redirect permanent / https://DOMAINname/ + + + + ServerName www.DOMAINname + SSLEngine on + SSLCertificateFile /etc/letsencrypt/live/DOMAINname/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/DOMAINname/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/DOMAINname/chain.pem + Include snippets/apa-ssl.conf + Redirect permanent / https://DOMAINname/ + \ No newline at end of file diff --git a/CoreModules/apache/config/apache2/snippets-ssl.conf b/CoreModules/apache/config/apache2/snippets-ssl.conf new file mode 100644 index 0000000..16708e4 --- /dev/null +++ b/CoreModules/apache/config/apache2/snippets-ssl.conf @@ -0,0 +1,7 @@ +Protocols h2 http/1.1 +Header always set Strict-Transport-Security "max-age=63072000" +SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1 +SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 +SSLHonorCipherOrder on +SSLSessionTickets off +SSLUseStapling On diff --git a/CoreModules/apache/preconf.sh b/CoreModules/apache/preconf.sh new file mode 100644 index 0000000..b6ac760 --- /dev/null +++ b/CoreModules/apache/preconf.sh @@ -0,0 +1 @@ +$PKGA ppa:ondrej/apache2 -y -n > $OUTPUT 2>&1 \ No newline at end of file diff --git a/CoreModules/apache/reqmodules.sh b/CoreModules/apache/reqmodules.sh new file mode 100644 index 0000000..ae87c0f --- /dev/null +++ b/CoreModules/apache/reqmodules.sh @@ -0,0 +1 @@ +aonoption="$aonoption php-fpm" \ No newline at end of file diff --git a/CoreModules/apache/ssl-handler.sh b/CoreModules/apache/ssl-handler.sh new file mode 100644 index 0000000..7a84086 --- /dev/null +++ b/CoreModules/apache/ssl-handler.sh @@ -0,0 +1,9 @@ +rm /etc/apache2/sites-enabled/010-"$sitename".conf +ln -s /etc/apache2/sites-available/"$sitename"_ssl.conf /etc/apache2/sites-enabled/010-"$sitename".conf + +if [ -n "$sslfr" ]; then +rm /etc/apache2/sites-enabled/010-Backend.conf +ln -s /etc/apache2/sites-available/Backend_ssl.conf /etc/apache2/sites-enabled/010-Backend.conf +fi + +systemctl reload apache2 diff --git a/CoreModules/nginx/apt.list b/CoreModules/nginx/apt.list index ce4eb81..23ff8c5 100644 --- a/CoreModules/nginx/apt.list +++ b/CoreModules/nginx/apt.list @@ -1 +1 @@ -nginx apache2-utils phpPHPver-imagick php-pear phpPHPver-cli phpPHPver-fpm phpPHPver-mysql phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-xmlrpc phpPHPver-zip python-certbot-nginx \ No newline at end of file +nginx apache2-utils python-certbot-nginx \ No newline at end of file diff --git a/CoreModules/nginx/conf.sh b/CoreModules/nginx/conf.sh index b947233..d451a17 100644 --- a/CoreModules/nginx/conf.sh +++ b/CoreModules/nginx/conf.sh @@ -1,4 +1,4 @@ -systemctl stop php${phpver}-fpm nginx +systemctl stop nginx ############# # Nginx # @@ -42,22 +42,4 @@ wget -q -t7 "$repo"/raw/branch/"$branch"/Scripts/toggles/toggle-PhpMyAdmin_NGINX # custom Welcome page echo "$webserv is functioning normally" > /var/www/html/index.html - -############### -# PHP-FPM # -############### - -sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/"$phpver"/fpm/php.ini -sed -i 's/;opcache.memory_consumption=128/opcache.memory_consumption=256/g' /etc/php/"$phpver"/fpm/php.ini -sed -i 's/;opcache.enable=1/opcache.enable=1/g' /etc/php/"$phpver"/fpm/php.ini -sed -i 's/;opcache.interned_strings_buffer=8/opcache.interned_strings_buffer=8/g' /etc/php/"$phpver"/fpm/php.ini -sed -i 's/;opcache.max_accelerated_files=10000/opcache.max_accelerated_files=50000/g' /etc/php/"$phpver"/fpm/php.ini -sed -i 's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g' /etc/php/"$phpver"/fpm/php.ini -sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=0/g' /etc/php/"$phpver"/fpm/php.ini -sed -i 's/; max_input_vars = 1000/max_input_vars = 10000/g' /etc/php/"$phpver"/fpm/php.ini -sed -i 's/upload_max_filesize = 2/upload_max_filesize = 128/g' /etc/php/"$phpver"/fpm/php.ini -sed -i 's/post_max_size = 8/post_max_size = 64/g' /etc/php/"$phpver"/fpm/php.ini -wget -q -t7 "$repo"/raw/branch/"$branch"/CoreModules/nginx/config/PHP-FPM/www.confg -O /etc/php/"$phpver"/fpm/pool.d/www.conf -sed -i 's/'rtag'/'"${phpver}"'/g' /etc/php/"$phpver"/fpm/pool.d/www.conf - -systemctl start php${phpver}-fpm nginx \ No newline at end of file +systemctl start nginx \ No newline at end of file diff --git a/CoreModules/nginx/config/PHP-FPM/www.confg b/CoreModules/nginx/config/PHP-FPM/www.confg deleted file mode 100644 index 9ee2430..0000000 --- a/CoreModules/nginx/config/PHP-FPM/www.confg +++ /dev/null @@ -1,423 +0,0 @@ -; Start a new pool named 'www'. -; the variable $pool can be used in any directive and will be replaced by the -; pool name ('www' here) -[www] - -; Per pool prefix -; It only applies on the following directives: -; - 'access.log' -; - 'slowlog' -; - 'listen' (unixsocket) -; - 'chroot' -; - 'chdir' -; - 'php_values' -; - 'php_admin_values' -; When not set, the global prefix (or /usr) applies instead. -; Note: This directive can also be relative to the global prefix. -; Default Value: none -;prefix = /path/to/pools/$pool - -; Unix user/group of processes -; Note: The user is mandatory. If the group is not set, the default user's group -; will be used. -user = www-data -group = www-data - -; The address on which to accept FastCGI requests. -; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on -; a specific port; -; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on -; a specific port; -; 'port' - to listen on a TCP socket to all addresses -; (IPv6 and IPv4-mapped) on a specific port; -; '/path/to/unix/socket' - to listen on a unix socket. -; Note: This value is mandatory. -listen = /run/php/phprtag-fpm.sock - -; Set listen(2) backlog. -; Default Value: 511 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 511 - -; Set permissions for unix socket, if one is used. In Linux, read/write -; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. -; Default Values: user and group are set as the running user -; mode is set to 0660 -listen.owner = www-data -listen.group = www-data -;listen.mode = 0660 -; When POSIX Access Control Lists are supported you can set them using -; these options, value is a comma separated list of user/group names. -; When set, listen.owner and listen.group are ignored -;listen.acl_users = -;listen.acl_groups = - -; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. -; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original -; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address -; must be separated by a comma. If this value is left blank, connections will be -; accepted from any ip address. -; Default Value: any -;listen.allowed_clients = 127.0.0.1 - -; Specify the nice(2) priority to apply to the pool processes (only if set) -; The value can vary from -19 (highest priority) to 20 (lower priority) -; Note: - It will only work if the FPM master process is launched as root -; - The pool processes will inherit the master process priority -; unless it specified otherwise -; Default Value: no set -; process.priority = -19 - -; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user -; or group is differrent than the master process user. It allows to create process -; core dump and ptrace the process for the pool user. -; Default Value: no -; process.dumpable = yes - -; Choose how the process manager will control the number of child processes. -; Possible Values: -; static - a fixed number (pm.max_children) of child processes; -; dynamic - the number of child processes are set dynamically based on the -; following directives. With this process management, there will be -; always at least 1 children. -; pm.max_children - the maximum number of children that can -; be alive at the same time. -; pm.start_servers - the number of children created on startup. -; pm.min_spare_servers - the minimum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is less than this -; number then some children will be created. -; pm.max_spare_servers - the maximum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is greater than this -; number then some children will be killed. -; ondemand - no children are created at startup. Children will be forked when -; new requests will connect. The following parameter are used: -; pm.max_children - the maximum number of children that -; can be alive at the same time. -; pm.process_idle_timeout - The number of seconds after which -; an idle process will be killed. -; Note: This value is mandatory. -pm = dynamic - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; This value sets the limit on the number of simultaneous requests that will be -; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. -; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = 5 - -; The number of child processes created on startup. -; Note: Used only when pm is set to 'dynamic' -; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -pm.start_servers = 2 - -; The desired minimum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = 1 - -; The desired maximum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = 3 - -; The number of seconds after which an idle process will be killed. -; Note: Used only when pm is set to 'ondemand' -; Default Value: 10s -;pm.process_idle_timeout = 10s; - -; The number of requests each child process should execute before respawning. -; This can be useful to work around memory leaks in 3rd party libraries. For -; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. -; Default Value: 0 -;pm.max_requests = 500 - -; The URI to view the FPM status page. If this value is not set, no URI will be -; recognized as a status page. It shows the following informations: -; pool - the name of the pool; -; process manager - static, dynamic or ondemand; -; start time - the date and time FPM has started; -; start since - number of seconds since FPM has started; -; accepted conn - the number of request accepted by the pool; -; listen queue - the number of request in the queue of pending -; connections (see backlog in listen(2)); -; max listen queue - the maximum number of requests in the queue -; of pending connections since FPM has started; -; listen queue len - the size of the socket queue of pending connections; -; idle processes - the number of idle processes; -; active processes - the number of active processes; -; total processes - the number of idle + active processes; -; max active processes - the maximum number of active processes since FPM -; has started; -; max children reached - number of times, the process limit has been reached, -; when pm tries to start more children (works only for -; pm 'dynamic' and 'ondemand'); -; Value are updated in real time. -; Example output: -; pool: www -; process manager: static -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 62636 -; accepted conn: 190460 -; listen queue: 0 -; max listen queue: 1 -; listen queue len: 42 -; idle processes: 4 -; active processes: 11 -; total processes: 15 -; max active processes: 12 -; max children reached: 0 -; -; By default the status page output is formatted as text/plain. Passing either -; 'html', 'xml' or 'json' in the query string will return the corresponding -; output syntax. Example: -; http://www.foo.bar/status -; http://www.foo.bar/status?json -; http://www.foo.bar/status?html -; http://www.foo.bar/status?xml -; -; By default the status page only outputs short status. Passing 'full' in the -; query string will also return status for each pool process. -; Example: -; http://www.foo.bar/status?full -; http://www.foo.bar/status?json&full -; http://www.foo.bar/status?html&full -; http://www.foo.bar/status?xml&full -; The Full status returns for each process: -; pid - the PID of the process; -; state - the state of the process (Idle, Running, ...); -; start time - the date and time the process has started; -; start since - the number of seconds since the process has started; -; requests - the number of requests the process has served; -; request duration - the duration in µs of the requests; -; request method - the request method (GET, POST, ...); -; request URI - the request URI with the query string; -; content length - the content length of the request (only with POST); -; user - the user (PHP_AUTH_USER) (or '-' if not set); -; script - the main script called (or '-' if not set); -; last request cpu - the %cpu the last request consumed -; it's always 0 if the process is not in Idle state -; because CPU calculation is done when the request -; processing has terminated; -; last request memory - the max amount of memory the last request consumed -; it's always 0 if the process is not in Idle state -; because memory calculation is done when the request -; processing has terminated; -; If the process is in Idle state, then informations are related to the -; last request the process has served. Otherwise informations are related to -; the current request being served. -; Example output: -; ************************ -; pid: 31330 -; state: Running -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 63087 -; requests: 12808 -; request duration: 1250261 -; request method: GET -; request URI: /test_mem.php?N=10000 -; content length: 0 -; user: - -; script: /home/fat/web/docs/php/test_mem.php -; last request cpu: 0.00 -; last request memory: 0 -; -; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: /usr/share/php/rtag/fpm/status.html -; -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;pm.status_path = /status - -; The ping URI to call the monitoring page of FPM. If this value is not set, no -; URI will be recognized as a ping page. This could be used to test from outside -; that FPM is alive and responding, or to -; - create a graph of FPM availability (rrd or such); -; - remove a server from a group if it is not responding (load balancing); -; - trigger alerts for the operating team (24/7). -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;ping.path = /ping - -; This directive may be used to customize the response of a ping request. The -; response is formatted as text/plain with a 200 response code. -; Default Value: pong -;ping.response = pong - -; The access log file -; Default: not set -;access.log = log/$pool.access.log - -; The access log format. -; The following syntax is allowed -; %%: the '%' character -; %C: %CPU used by the request -; it can accept the following format: -; - %{user}C for user CPU only -; - %{system}C for system CPU only -; - %{total}C for user + system CPU (default) -; %d: time taken to serve the request -; it can accept the following format: -; - %{seconds}d (default) -; - %{miliseconds}d -; - %{mili}d -; - %{microseconds}d -; - %{micro}d -; %e: an environment variable (same as $_ENV or $_SERVER) -; it must be associated with embraces to specify the name of the env -; variable. Some exemples: -; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e -; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e -; %f: script filename -; %l: content-length of the request (for POST request only) -; %m: request method -; %M: peak of memory allocated by PHP -; it can accept the following format: -; - %{bytes}M (default) -; - %{kilobytes}M -; - %{kilo}M -; - %{megabytes}M -; - %{mega}M -; %n: pool name -; %o: output header -; it must be associated with embraces to specify the name of the header: -; - %{Content-Type}o -; - %{X-Powered-By}o -; - %{Transfert-Encoding}o -; - .... -; %p: PID of the child that serviced the request -; %P: PID of the parent of the child that serviced the request -; %q: the query string -; %Q: the '?' character if query string exists -; %r: the request URI (without the query string, see %q and %Q) -; %R: remote IP address -; %s: status (response code) -; %t: server time the request was received -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t -; %T: time the log has been written (the request has finished) -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t -; %u: remote user -; -; Default: "%R - %u %t \"%m %r\" %s" -;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - -; The log file for slow requests -; Default Value: not set -; Note: slowlog is mandatory if request_slowlog_timeout is set -;slowlog = log/$pool.log.slow - -; The timeout for serving a single request after which a PHP backtrace will be -; dumped to the 'slowlog' file. A value of '0s' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_slowlog_timeout = 0 - -; Depth of slow log stack trace. -; Default Value: 20 -;request_slowlog_trace_depth = 20 - -; The timeout for serving a single request after which the worker process will -; be killed. This option should be used when the 'max_execution_time' ini option -; does not stop script execution for some reason. A value of '0' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_terminate_timeout = 0 - -; Set open file descriptor rlimit. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Chroot to this directory at the start. This value must be defined as an -; absolute path. When this value is not set, chroot is not used. -; Note: you can prefix with '$prefix' to chroot to the pool prefix or one -; of its subdirectories. If the pool prefix is not set, the global prefix -; will be used instead. -; Note: chrooting is a great security feature and should be used whenever -; possible. However, all PHP paths will be relative to the chroot -; (error_log, sessions.save_path, ...). -; Default Value: not set -;chroot = - -; Chdir to this directory at the start. -; Note: relative path can be used. -; Default Value: current directory or / when chroot -;chdir = /var/www - -; Redirect worker stdout and stderr into main error log. If not set, stdout and -; stderr will be redirected to /dev/null according to FastCGI specs. -; Note: on highloaded environement, this can cause some delay in the page -; process time (several ms). -; Default Value: no -;catch_workers_output = yes - -; Clear environment in FPM workers -; Prevents arbitrary environment variables from reaching FPM worker processes -; by clearing the environment in workers before env vars specified in this -; pool configuration are added. -; Setting to "no" will make all environment variables available to PHP code -; via getenv(), $_ENV and $_SERVER. -; Default Value: yes -;clear_env = no - -; Limits the extensions of the main script FPM will allow to parse. This can -; prevent configuration mistakes on the web server side. You should only limit -; FPM to .php extensions to prevent malicious users to use other extensions to -; execute php code. -; Note: set an empty value to allow all extensions. -; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 .php7 - -; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from -; the current environment. -; Default Value: clean env -env[HOSTNAME] = $HOSTNAME -env[PATH] = /usr/local/bin:/usr/bin:/bin -env[TMP] = /tmp -env[TMPDIR] = /tmp -env[TEMP] = /tmp - -; Additional php.ini defines, specific to this pool of workers. These settings -; overwrite the values previously defined in the php.ini. The directives are the -; same as the PHP SAPI: -; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. -; php_admin_value/php_admin_flag - these directives won't be overwritten by -; PHP call 'ini_set' -; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. - -; Defining 'extension' will load the corresponding shared extension from -; extension_dir. Defining 'disable_functions' or 'disable_classes' will not -; overwrite previously defined php.ini values, but will append the new value -; instead. - -; Note: path INI options can be relative and will be expanded with the prefix -; (pool, global or /usr) - -; Default Value: nothing is defined by default except the values in php.ini and -; specified at startup with the -d argument -;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com -;php_flag[display_errors] = off -;php_admin_value[error_log] = /var/log/fpm-php.www.log -;php_admin_flag[log_errors] = on -;php_admin_value[memory_limit] = 32M diff --git a/CoreModules/nginx/reqmodules.sh b/CoreModules/nginx/reqmodules.sh new file mode 100644 index 0000000..ae87c0f --- /dev/null +++ b/CoreModules/nginx/reqmodules.sh @@ -0,0 +1 @@ +aonoption="$aonoption php-fpm" \ No newline at end of file diff --git a/CoreModules/nginx/ssl-handler.sh b/CoreModules/nginx/ssl-handler.sh index aeab63d..a625763 100644 --- a/CoreModules/nginx/ssl-handler.sh +++ b/CoreModules/nginx/ssl-handler.sh @@ -1,5 +1,9 @@ rm /etc/nginx/sites-enabled/"$sitename" ln -s /etc/nginx/sites-available/"$sitename"_ssl /etc/nginx/sites-enabled/"$sitename" + +if [ -n "$sslfr" ]; then rm /etc/nginx/sites-enabled/Backend ln -s /etc/nginx/sites-available/Backend_ssl /etc/nginx/sites-enabled/Backend +fi + systemctl reload nginx \ No newline at end of file diff --git a/ModulesMenu.list b/ModulesMenu.list index b9c882d..a73bfdc 100644 --- a/ModulesMenu.list +++ b/ModulesMenu.list @@ -19,6 +19,7 @@ nginxOptions=("Redis:" "Redis caching" OFF) #CMSList apacheCMSL=("None:" "A plain webserver will be setup." OFF) apacheCMSL+=("Wordpress:" "WordPress is a content management system based on PHP." OFF) +apacheCMSL+=("Nextcloud:" "Nextcloud is a suite of client-server software for creating and using file hosting services." OFF) #Options apacheOptions=("Redis:" "Redis caching" OFF) fi @@ -27,14 +28,14 @@ if [ $IMODE = l ]; then webservers=("Nginx" "Apache" "Quit") ##Nginx #CMSList -nginxCMSL=("Wordpress" "Nextcloud" "None") +nginxCMSL=("None" "Wordpress" "Nextcloud") #Options nginxOptions=("Redis:") ##Apache #CMSList -apacheCMSL=("Wordpress" "Nextcloud" "None") +apacheCMSL=("None" "Wordpress" "Nextcloud") #Options apacheOptions=("Redis:") fi \ No newline at end of file diff --git a/Scripts/EnableSSL.sh b/Scripts/EnableSSL.sh index b2f611b..8f7b2cf 100644 --- a/Scripts/EnableSSL.sh +++ b/Scripts/EnableSSL.sh @@ -1,5 +1,7 @@ +#loading install vars +source /etc/ICTM/mainvar.list #Setting Vars -confname=CONFname +sitename=CONFname domain=DOMAINname domainwww=DomainWWW email=Email @@ -9,11 +11,12 @@ webservice=WebServer #Correcting service name for Apache if [ $webservice = apache ]; then webservice=apache2 + ext=.conf fi #Backing-up and removing current config -sed -n '/#beginConf/,/#endConf/p' /etc/"$webservice"/sites-available/"$confname"_nossl > /tmp/"$confname"-config -sed -n -i '/#beginConf/{:a;N;/#endConf/!ba;N;s/.*\n/#ConfHere\n/};p' /etc/"$webservice"/sites-available/"$confname"_nossl +sed -n '/#beginConf/,/#endConf/p' /etc/"$webservice"/sites-available/"$sitename"_nossl"$ext" > /tmp/"$sitename"-config +sed -n -i '/#beginConf/{:a;N;/#endConf/!ba;N;s/.*\n/#ConfHere\n/};p' /etc/"$webservice"/sites-available/"$sitename"_nossl"$ext" systemctl reload $webservice #Enabling SSL @@ -24,7 +27,5 @@ elif [ $domainwww = 0 ]; then fi #Restoring config -sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e "/#ConfHere1/ r /tmp/"$confname"-config" -e '/#ConfHere/c\' /etc/"$webservice"/sites-available/"$confname"_ssl -rm /etc/"$webservice"/sites-enabled/"$confname" -ln -s /etc/"$webservice"/sites-available/"$confname"_ssl /etc/"$webservice"/sites-enabled/"$confname" -systemctl reload $webservice \ No newline at end of file +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e "/#ConfHere1/ r /tmp/"$sitename"-config" -e '/#ConfHere/c\' /etc/"$webservice"/sites-available/"$sitename"_ssl"$ext" +source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/ssl-handler.sh) diff --git a/Scripts/toggles/toggle-Netdata_NGINX.sh b/Scripts/toggles/toggle-Netdata_NGINX.sh index 44b8264..86a4c84 100644 --- a/Scripts/toggles/toggle-Netdata_NGINX.sh +++ b/Scripts/toggles/toggle-Netdata_NGINX.sh @@ -20,14 +20,14 @@ if [ -n "$1" ]; then if [[ "$1" = "-d" && "$NetDa" != 0 ]]; then echo "Disable Netdata" sed -i '/NetDa=/c\NetDa=0' /etc/ICTM/toggle.conf - sed -i '/deny all; #enables\/disables Netdata/c\ deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend + sed -i --follow-symlinks '/deny all; #enables\/disables Netdata/c\ deny all; #enables\/disables Netdata' /etc/nginx/sites-enabled/Backend systemctl stop netdata systemctl disable netdata > /dev/null 2>&1 systemctl reload nginx elif [[ "$1" = "-e" && "$NetDa" != 1 ]]; then echo "Enable Netdata" sed -i '/NetDa=/c\NetDa=1' /etc/ICTM/toggle.conf - sed -i '/deny all; #enables\/disables Netdata/c\ #deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend + sed -i --follow-symlinks '/deny all; #enables\/disables Netdata/c\ #deny all; #enables\/disables Netdata' /etc/nginx/sites-enabled/Backend systemctl start netdata systemctl enable netdata > /dev/null 2>&1 systemctl reload nginx diff --git a/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh b/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh new file mode 100644 index 0000000..88f8fbc --- /dev/null +++ b/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh @@ -0,0 +1,37 @@ +function usage { + echo "Usage: $0 [option...]" >&2 + echo + echo " -e, Enable PhpMyadmin" + echo " -d, Disable PhpMyadmin" + echo " -h, Shows this information" + echo +} +if [ -n "$1" ]; then + if [[ ! -f /etc/ICTM/toggle.conf ]]; then + echo "Creating File" + touch /etc/ICTM/toggle.conf + fi + source /etc/ICTM/toggle.conf + if [ -z "$PhpMA" ]; then + echo "Creating Var" + echo "PhpMA=3" >> /etc/ICTM/toggle.conf + PhpMA=3 + fi + if [[ "$1" = "-d" && "$PhpMA" != 0 ]]; then + echo "Disable PhpMyadmin" + sed -i '/PhpMA=/c\PhpMA=0' /etc/ICTM/toggle.conf + sed -i --follow-symlinks '/#enables\/disables PHPMyadmin/!b;n;cdeny from all' /etc/apache2/sites-enabled/010-Backend.conf + systemctl reload apache2 + elif [[ "$1" = "-e" && "$PhpMA" != 1 ]]; then + echo "Enable PhpMyadmin" + sed -i '/PhpMA=/c\PhpMA=1' /etc/ICTM/toggle.conf + sed -i --follow-symlinks '/#enables\/disables PHPMyadmin/!b;n;c#deny from all' /etc/apache2/sites-enabled/010-Backend.conf + systemctl reload apache2 + elif [[ "$1" = "-h" ]]; then + usage + else + echo "Oopsie!" + fi +else + usage +fi \ No newline at end of file diff --git a/Scripts/toggles/toggle-PhpMyAdmin_NGINX.sh b/Scripts/toggles/toggle-PhpMyAdmin_NGINX.sh index e7171b9..b5403a0 100644 --- a/Scripts/toggles/toggle-PhpMyAdmin_NGINX.sh +++ b/Scripts/toggles/toggle-PhpMyAdmin_NGINX.sh @@ -20,12 +20,12 @@ if [ -n "$1" ]; then if [[ "$1" = "-d" && "$PhpMA" != 0 ]]; then echo "Disable PhpMyadmin" sed -i '/PhpMA=/c\PhpMA=0' /etc/ICTM/toggle.conf - sed -i '/deny all; #enables\/disables PHPMyadmin/c\ deny all; #enables\/disables PHPMyadmin' /etc/nginx/sites-available/Backend + sed -i --follow-symlinks '/deny all; #enables\/disables PHPMyadmin/c\ deny all; #enables\/disables PHPMyadmin' /etc/nginx/sites-enabled/Backend systemctl reload nginx elif [[ "$1" = "-e" && "$PhpMA" != 1 ]]; then echo "Enable PhpMyadmin" sed -i '/PhpMA=/c\PhpMA=1' /etc/ICTM/toggle.conf - sed -i '/deny all; #enables\/disables PHPMyadmin/c\ #deny all; #enables\/disables PHPMyadmin' /etc/nginx/sites-available/Backend + sed -i --follow-symlinks '/deny all; #enables\/disables PHPMyadmin/c\ #deny all; #enables\/disables PHPMyadmin' /etc/nginx/sites-enabled/Backend systemctl reload nginx elif [[ "$1" = "-h" ]]; then usage diff --git a/SubModules/php-fpm/apt.list b/SubModules/php-fpm/apt.list new file mode 100644 index 0000000..74b5f70 --- /dev/null +++ b/SubModules/php-fpm/apt.list @@ -0,0 +1 @@ +phpPHPver-imagick php-pear phpPHPver-cli phpPHPver-fpm phpPHPver-mysql phpPHPver-cgi phpPHPver-common phpPHPver-mbstring phpPHPver-curl phpPHPver-gd phpPHPver-intl phpPHPver-soap phpPHPver-xml phpPHPver-xmlrpc phpPHPver-zip \ No newline at end of file diff --git a/SubModules/php-fpm/conf.sh b/SubModules/php-fpm/conf.sh new file mode 100644 index 0000000..3661f28 --- /dev/null +++ b/SubModules/php-fpm/conf.sh @@ -0,0 +1,17 @@ +systemctl stop php${phpver}-fpm +############### +# PHP-FPM # +############### + +sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/"$phpver"/fpm/php.ini +sed -i 's/;opcache.memory_consumption=128/opcache.memory_consumption=256/g' /etc/php/"$phpver"/fpm/php.ini +sed -i 's/;opcache.enable=1/opcache.enable=1/g' /etc/php/"$phpver"/fpm/php.ini +sed -i 's/;opcache.interned_strings_buffer=8/opcache.interned_strings_buffer=8/g' /etc/php/"$phpver"/fpm/php.ini +sed -i 's/;opcache.max_accelerated_files=10000/opcache.max_accelerated_files=50000/g' /etc/php/"$phpver"/fpm/php.ini +sed -i 's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g' /etc/php/"$phpver"/fpm/php.ini +sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=0/g' /etc/php/"$phpver"/fpm/php.ini +sed -i 's/; max_input_vars = 1000/max_input_vars = 10000/g' /etc/php/"$phpver"/fpm/php.ini +sed -i 's/upload_max_filesize = 2/upload_max_filesize = 128/g' /etc/php/"$phpver"/fpm/php.ini +sed -i 's/post_max_size = 8/post_max_size = 64/g' /etc/php/"$phpver"/fpm/php.ini + +systemctl start php${phpver}-fpm \ No newline at end of file diff --git a/installer.sh b/installer.sh index 94ba695..62208a7 100644 --- a/installer.sh +++ b/installer.sh @@ -23,7 +23,7 @@ fi ##---------------## #Git-repo -repo=https://git.ictmaatwerk.com/bprieshof/UBU-Web-V2 +repo=https://git.bprieshof.nl/Work/UBU-Web-V2_PHPSPLIT branch=master #Installer-config phpver=7.4 @@ -370,6 +370,12 @@ echo 'SelectedOptions=('$option')' > /etc/ICTM/selopts.list #Cleaning options from menu option="${option,,}" && option="${option// /}" && option="${option//:/ }" && option="${option//'"'}" + +#enableing modules wanted by webserver +if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/conf.sh; then + source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/reqmodules.sh) +fi + #Combining selected option with always-on options option="$option""$aonoption" @@ -544,7 +550,7 @@ if [ $sslenable = 1 ]; then fi certbot --"$webserv" certonly -n -d "$hostname" -m "$email" --hsts --redirect --no-eff-email --agree-tos if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/ssl-handler.sh; then - source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/ssl-handler.sh) + sslfr=1 source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/ssl-handler.sh) fi elif [ $sslenable = 0 ]; then site_ext=nossl