From 95f2a19422c3feae82a35192c13c70293526f0ef Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Wed, 9 Dec 2020 15:13:23 +0100 Subject: [PATCH] Updated apache module to use vars --- AppendCMS.sh | 1 + CMS/Backend/apache-conf.sh | 4 +- CMS/nextcloud/apache-conf.sh | 4 +- CMS/none/apache-conf.sh | 4 +- CMS/wordpress/apache-conf.sh | 4 +- CMS/wordpress/conf.sh | 3 + CoreModules/apache/appendCMS-conf.sh | 20 +++--- .../apache/{generic.pkg.list => apt.pkg.list} | 0 CoreModules/apache/conf.sh | 61 +++++++++++-------- CoreModules/apache/dnf.pkg.list | 1 + CoreModules/apache/preconf.sh | 16 +++++ CoreModules/apache/ssl-handler.sh | 10 +-- CoreModules/generic/conf.sh | 5 -- Scripts/EnableSSL.sh | 5 +- Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh | 8 +-- 15 files changed, 88 insertions(+), 58 deletions(-) rename CoreModules/apache/{generic.pkg.list => apt.pkg.list} (100%) create mode 100644 CoreModules/apache/dnf.pkg.list diff --git a/AppendCMS.sh b/AppendCMS.sh index 176aab6..33745cd 100644 --- a/AppendCMS.sh +++ b/AppendCMS.sh @@ -8,6 +8,7 @@ if [ ! -f "/etc/ICTM/phpvar.list" ] ; then echo 'Php var list missing,Please run source /etc/ICTM/selopts.list source /etc/ICTM/mainvar.list source /etc/ICTM/phpvar.list +if [ ! -f "/etc/ICTM/apachevar.list" ] ; then source /etc/ICTM/apachevar.list; fi rm /tmp/pkg.list > $OUTPUT 2>&1 source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list) diff --git a/CMS/Backend/apache-conf.sh b/CMS/Backend/apache-conf.sh index f458397..fa9a2a6 100644 --- a/CMS/Backend/apache-conf.sh +++ b/CMS/Backend/apache-conf.sh @@ -1,4 +1,4 @@ curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/Backend/apache-siteBackend-unconfigured -o /tmp/apache-siteconf sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$hostname'/g' /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_"$siteBackend_ext".conf -systemctl reload apache2 \ No newline at end of file +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' "$apacheConfDir"/sites-available/Backend_"$siteBackend_ext".conf +systemctl reload $apacheService \ No newline at end of file diff --git a/CMS/nextcloud/apache-conf.sh b/CMS/nextcloud/apache-conf.sh index d4d2f53..71b7636 100644 --- a/CMS/nextcloud/apache-conf.sh +++ b/CMS/nextcloud/apache-conf.sh @@ -1,11 +1,11 @@ #Apache curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/nextcloud/Apache-unconfigured -o /tmp/apache-siteconf sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /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 +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' "$apacheConfDir"/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' "$phpPoolDir"/$sitename.conf sed -i -e '/security.limit_extensions/c\php_admin_value[security.limit_extensions] = .php' "$phpPoolDir"/$sitename.conf -systemctl reload apache2 php$phpver-fpm \ No newline at end of file +systemctl reload $apacheService $phpFPMService \ No newline at end of file diff --git a/CMS/none/apache-conf.sh b/CMS/none/apache-conf.sh index 989bd96..13a4a09 100644 --- a/CMS/none/apache-conf.sh +++ b/CMS/none/apache-conf.sh @@ -1,5 +1,5 @@ curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/none/Apache-unconfigured -o /tmp/apache-siteconf sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /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 +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' "$apacheConfDir"/sites-available/"$sitename"_"$site_ext".conf -systemctl reload apache2 \ No newline at end of file +systemctl reload $apacheService \ No newline at end of file diff --git a/CMS/wordpress/apache-conf.sh b/CMS/wordpress/apache-conf.sh index a24ea1f..9b254da 100644 --- a/CMS/wordpress/apache-conf.sh +++ b/CMS/wordpress/apache-conf.sh @@ -1,6 +1,6 @@ curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CMS/wordpress/Apache-unconfigured -o /tmp/apache-siteconf sed -i -e 's/PHPver/'$phpver'/g' -e 's/DOMAINname/'$domain'/g' -e 's/SITEname/'$sitename'/g' /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 +sed -i -e "0,/^#ConfHere/s/\(^#Conf.*\)/#ConfHere1 /" -e '/#ConfHere1/ r /tmp/apache-siteconf' -e '/#ConfHere/c\' "$apacheConfDir"/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 +systemctl reload $apacheService $phpFPMService \ No newline at end of file diff --git a/CMS/wordpress/conf.sh b/CMS/wordpress/conf.sh index 4e49c1b..de03905 100644 --- a/CMS/wordpress/conf.sh +++ b/CMS/wordpress/conf.sh @@ -43,6 +43,9 @@ systemctl reload $phpFPMService #fail2ban if [ ! -f /etc/fail2ban/jail.d/wordpress-syslog.local ]; then curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Jails/wordpress-syslog.jail -o /etc/fail2ban/jail.d/wordpress-syslog.local + if [ "$shortdist" = "el8" ]; then + sed -i '/logpath/c\logpath = /var/log/secure' /etc/fail2ban/jail.d/wordpress-syslog.local + fi fi #Setting Permsissions diff --git a/CoreModules/apache/appendCMS-conf.sh b/CoreModules/apache/appendCMS-conf.sh index 0931e53..79ddbe7 100644 --- a/CoreModules/apache/appendCMS-conf.sh +++ b/CoreModules/apache/appendCMS-conf.sh @@ -4,19 +4,19 @@ if [ $domainwww = 1 ]; then #non-ssl - curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-wwwredir >> /etc/apache2/sites-available/"$sitename"_nossl.conf - echo "" >> /etc/apache2/sites-available/"$sitename"_nossl.conf + curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-wwwredir >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf + echo "" >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf #ssl - curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-wwwredir >> /etc/apache2/sites-available/"$sitename"_ssl.conf - echo "" >> /etc/apache2/sites-available/"$sitename"_ssl.conf + curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-wwwredir >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf + echo "" >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf fi #non-ssl -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> /etc/apache2/sites-available/"$sitename"_nossl.conf -sed -i -e 's/DOMAINname/'$domain'/g' /etc/apache2/sites-available/"$sitename"_nossl.conf -ln -s /etc/apache2/sites-available/"$sitename"_nossl.conf /etc/apache2/sites-enabled/010-"$sitename".conf +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf +sed -i -e 's/DOMAINname/'$domain'/g' "$apacheConfDir"/sites-available/"$sitename"_nossl.conf +ln -s "$apacheConfDir"/sites-available/"$sitename"_nossl.conf "$apacheConfDir"/sites-enabled/010-"$sitename".conf #ssl -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> /etc/apache2/sites-available/"$sitename"_ssl.conf -sed -i -e 's/DOMAINname/'$domain'/g' /etc/apache2/sites-available/"$sitename"_ssl.conf +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf +sed -i -e 's/DOMAINname/'$domain'/g' "$apacheConfDir"/sites-available/"$sitename"_ssl.conf -systemctl reload apache2 \ No newline at end of file +systemctl reload $apacheService \ No newline at end of file diff --git a/CoreModules/apache/generic.pkg.list b/CoreModules/apache/apt.pkg.list similarity index 100% rename from CoreModules/apache/generic.pkg.list rename to CoreModules/apache/apt.pkg.list diff --git a/CoreModules/apache/conf.sh b/CoreModules/apache/conf.sh index 11c7016..33dea76 100644 --- a/CoreModules/apache/conf.sh +++ b/CoreModules/apache/conf.sh @@ -1,55 +1,68 @@ -systemctl stop apache2 > $OUTPUT 2>&1 +systemctl stop $apacheService > $OUTPUT 2>&1 ############## # Apache # ############## +#Centos +if [ "$shortdist" = "el8" ]; then + echo 'IncludeOptional conf-enabled/*.conf'/etc/httpd/conf/httpd.conf + echo 'IncludeOptional sites-enabled/*.conf'/etc/httpd/conf/httpd.conf + sed -i -e '/User apache/c\User www-data' -e '/Group apache/c\Group www-data' /etc/httpd/conf/httpd.conf + sed -i 's/^/#/g' /etc/httpd/conf.d/welcome.conf + #Creating directories + mkdir -p /etc/httpd/{sites-available,sites-enabled,conf-enabled,conf-available,} +fi + a2dissite 000-default > $OUTPUT 2>&1 a2dismod mpm_prefork > $OUTPUT 2>&1 a2enmod actions fcgid alias proxy_fcgi ssl headers http2 setenvif socache_shmcb > $OUTPUT 2>&1 -mkdir -p /etc/apache2/snippets/ -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/snippets-ssl.conf -o /etc/apache2/snippets/apa-ssl.conf -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/snippets-backendredir.conf -o /etc/apache2/snippets/apa-backendredir.conf -sed -i -e 's/HOSTname/'$hostname'/' /etc/apache2/snippets/apa-backendredir.conf -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/conf-custom.conf -o /etc/apache2/conf-enabled/zzz-custom.conf +mkdir -p "$apacheConfDir"/snippets/ +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/snippets-ssl.conf -o "$apacheConfDir"/snippets/apa-ssl.conf +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/snippets-backendredir.conf -o "$apacheConfDir"/snippets/apa-backendredir.conf +sed -i -e 's/HOSTname/'$hostname'/' "$apacheConfDir"/snippets/apa-backendredir.conf +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/conf-custom.conf -o "$apacheConfDir"/conf-enabled/zzz-custom.conf #Catch all (ip and unconfigured domains) -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$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 +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_CatchAll -o "$apacheConfDir"/sites-available/CatchAll.conf +ln -s "$apacheConfDir"/sites-available/CatchAll.conf "$apacheConfDir"/sites-enabled/999-CatchAll.conf if [ $domainwww = 1 ]; then #non-ssl - curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-wwwredir >> /etc/apache2/sites-available/"$sitename"_nossl.conf - echo "" >> /etc/apache2/sites-available/"$sitename"_nossl.conf + curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-wwwredir >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf + echo "" >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf #ssl - curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-wwwredir >> /etc/apache2/sites-available/"$sitename"_ssl.conf - echo "" >> /etc/apache2/sites-available/"$sitename"_ssl.conf + curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-wwwredir >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf + echo "" >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf fi #non-ssl -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> /etc/apache2/sites-available/"$sitename"_nossl.conf -sed -i -e 's/DOMAINname/'$domain'/g' /etc/apache2/sites-available/"$sitename"_nossl.conf -ln -s /etc/apache2/sites-available/"$sitename"_nossl.conf /etc/apache2/sites-enabled/010-"$sitename".conf +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> "$apacheConfDir"/sites-available/"$sitename"_nossl.conf +sed -i -e 's/DOMAINname/'$domain'/g' "$apacheConfDir"/sites-available/"$sitename"_nossl.conf +ln -s "$apacheConfDir"/sites-available/"$sitename"_nossl.conf "$apacheConfDir"/sites-enabled/010-"$sitename".conf #ssl -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> /etc/apache2/sites-available/"$sitename"_ssl.conf -sed -i -e 's/DOMAINname/'$domain'/g' /etc/apache2/sites-available/"$sitename"_ssl.conf +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> "$apacheConfDir"/sites-available/"$sitename"_ssl.conf +sed -i -e 's/DOMAINname/'$domain'/g' "$apacheConfDir"/sites-available/"$sitename"_ssl.conf #non-ssl-Backend -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> /etc/apache2/sites-available/Backend_nossl.conf -sed -i -e 's/DOMAINname/'$hostname'/g' /etc/apache2/sites-available/Backend_nossl.conf -ln -s /etc/apache2/sites-available/Backend_nossl.conf /etc/apache2/sites-enabled/010-Backend.conf +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site-unconfigured >> "$apacheConfDir"/sites-available/Backend_nossl.conf +sed -i -e 's/DOMAINname/'$hostname'/g' "$apacheConfDir"/sites-available/Backend_nossl.conf +ln -s "$apacheConfDir"/sites-available/Backend_nossl.conf "$apacheConfDir"/sites-enabled/010-Backend.conf #ssl-Backend -curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> /etc/apache2/sites-available/Backend_ssl.conf -sed -i -e 's/DOMAINname/'$hostname'/g' /etc/apache2/sites-available/Backend_ssl.conf +curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/apache/config/apache2/site_ssl-unconfigured >> "$apacheConfDir"/sites-available/Backend_ssl.conf +sed -i -e 's/DOMAINname/'$hostname'/g' "$apacheConfDir"/sites-available/Backend_ssl.conf mkdir -p /opt/toggle curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh -o /opt/toggle/toggle-PhpMyAdmin.sh +sed -i -e 's/APASRV/'$apacheService'/' -e 's/APADIR/'$apacheConfDir'/' /opt/toggle/toggle-PhpMyAdmin.sh + + # custom Welcome page echo "$webserv is functioning normally" > /var/www/html/index.html -systemctl start apache2 > $OUTPUT 2>&1 -systemctl enable apache2 > $OUTPUT 2>&1 \ No newline at end of file +systemctl start $apacheService > $OUTPUT 2>&1 +systemctl enable $apacheService > $OUTPUT 2>&1 \ No newline at end of file diff --git a/CoreModules/apache/dnf.pkg.list b/CoreModules/apache/dnf.pkg.list new file mode 100644 index 0000000..789a318 --- /dev/null +++ b/CoreModules/apache/dnf.pkg.list @@ -0,0 +1 @@ +httpd mod_fcgid \ No newline at end of file diff --git a/CoreModules/apache/preconf.sh b/CoreModules/apache/preconf.sh index a4bbb1b..fac1fcf 100644 --- a/CoreModules/apache/preconf.sh +++ b/CoreModules/apache/preconf.sh @@ -1 +1,17 @@ +if [ "$shortdist" = "ubu1804" ] || [ "$osrel" = "ubu2004" ] || [ "$osrel" = "deb10" ] ; then +# Debian/Ubunbtu apache variables + apacheConfDir=/etc/apache2 + apacheService=apche2 + +elif [ "$shortdist" = "el8" ]; then +# Centos Php variable + apacheConfDir=/etc/httpd + apacheService=httpd +fi + +#Storing vars to config +for storeme in apacheService apacheConfDir; do + declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/apachevar.list +done + curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=apache osrel=$shortdist bash > $OUTPUT 2>&1 > $OUTPUT 2>&1 \ No newline at end of file diff --git a/CoreModules/apache/ssl-handler.sh b/CoreModules/apache/ssl-handler.sh index 523d267..f6c0886 100644 --- a/CoreModules/apache/ssl-handler.sh +++ b/CoreModules/apache/ssl-handler.sh @@ -1,9 +1,9 @@ -rm /etc/apache2/sites-enabled/010-"$sitename".conf -ln -s /etc/apache2/sites-available/"$sitename"_"$site_ext".conf /etc/apache2/sites-enabled/010-"$sitename".conf +rm "$apacheConfDir"/sites-enabled/010-"$sitename".conf +ln -s "$apacheConfDir"/sites-available/"$sitename"_"$site_ext".conf "$apacheConfDir"/sites-enabled/010-"$sitename".conf if [ -n "$sslfr" ]; then -rm /etc/apache2/sites-enabled/010-Backend.conf -ln -s /etc/apache2/sites-available/Backend_"$siteBackend_ext".conf /etc/apache2/sites-enabled/010-Backend.conf +rm "$apacheConfDir"/sites-enabled/010-Backend.conf +ln -s "$apacheConfDir"/sites-available/Backend_"$siteBackend_ext".conf "$apacheConfDir"/sites-enabled/010-Backend.conf fi -systemctl reload apache2 +systemctl reload $apacheService diff --git a/CoreModules/generic/conf.sh b/CoreModules/generic/conf.sh index a29d275..d4205b6 100644 --- a/CoreModules/generic/conf.sh +++ b/CoreModules/generic/conf.sh @@ -42,11 +42,6 @@ curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fai curl --retry 7 --retry-delay 5 -s https://plugins.svn.wordpress.org/wp-fail2ban/trunk/filters.d/wordpress-hard.conf -o /etc/fail2ban/filter.d/wordpress-hard.local curl --retry 7 --retry-delay 5 -s https://plugins.svn.wordpress.org/wp-fail2ban/trunk/filters.d/wordpress-soft.conf -o /etc/fail2ban/filter.d/wordpress-soft.local -if [ "$shortdist" = "el8" ]; then - curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/config/fail2ban/Filters/action.d/ufw.conf -o /etc/fail2ban/action.d/ufw.conf - ln -s /var/log/secure /var/log/auth.log -fi - #Start fail2ban service systemctl start fail2ban systemctl enable fail2ban diff --git a/Scripts/EnableSSL.sh b/Scripts/EnableSSL.sh index 5c64b6e..098b300 100644 --- a/Scripts/EnableSSL.sh +++ b/Scripts/EnableSSL.sh @@ -8,8 +8,9 @@ webserv=WebServer webservice=WebServer #Correcting service name for Apache -if [ $webservice = apache ]; then - webservice=apache2 +if [ $webservice = apache ]; then\ + source /etc/ICTM/apachevar.list + webservice="$apacheService" ext=.conf fi diff --git a/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh b/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh index 88f8fbc..9a14209 100644 --- a/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh +++ b/Scripts/toggles/toggle-PhpMyAdmin_APACHE.sh @@ -20,13 +20,13 @@ 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 --follow-symlinks '/#enables\/disables PHPMyadmin/!b;n;cdeny from all' /etc/apache2/sites-enabled/010-Backend.conf - systemctl reload apache2 + sed -i --follow-symlinks '/#enables\/disables PHPMyadmin/!b;n;cdeny from all' /APADIR/sites-enabled/010-Backend.conf + systemctl reload APASRV 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 + sed -i --follow-symlinks '/#enables\/disables PHPMyadmin/!b;n;c#deny from all' /APADIR/sites-enabled/010-Backend.conf + systemctl reload APASRV elif [[ "$1" = "-h" ]]; then usage else