From 4ee6ae395e67dfec141ae86352e755766e1159b9 Mon Sep 17 00:00:00 2001 From: azerttyu Date: Fri, 22 Jun 2018 17:59:29 +0200 Subject: [PATCH] [enh] Update template files * When a dommain type has an ssl support, template have as suffixhttps,http, both* On each case we support each port with(out) redirect*By default we support acme-challenge protocol --- etc/alternc/templates/apache2/panel-ssl.conf | 42 ------------------- etc/alternc/templates/apache2/panel.conf | 22 +++++++++- .../{roundcube-ssl.conf => roundcube.conf} | 11 ++--- ...quirrelmail-ssl.conf => squirrelmail.conf} | 11 ++--- etc/alternc/templates/apache2/url-ssl.conf | 27 ------------ etc/alternc/templates/apache2/url.conf | 26 +++++++++--- .../{vhost-mixssl.conf => vhost-both.conf} | 0 .../apache2/{vhost.conf => vhost-http.conf} | 18 +++++++- .../{vhost-ssl.conf => vhost-https.conf} | 11 ++--- 9 files changed, 75 insertions(+), 93 deletions(-) delete mode 100644 etc/alternc/templates/apache2/panel-ssl.conf rename etc/alternc/templates/apache2/{roundcube-ssl.conf => roundcube.conf} (87%) rename etc/alternc/templates/apache2/{squirrelmail-ssl.conf => squirrelmail.conf} (80%) delete mode 100644 etc/alternc/templates/apache2/url-ssl.conf rename etc/alternc/templates/apache2/{vhost-mixssl.conf => vhost-both.conf} (100%) rename etc/alternc/templates/apache2/{vhost.conf => vhost-http.conf} (68%) rename etc/alternc/templates/apache2/{vhost-ssl.conf => vhost-https.conf} (79%) diff --git a/etc/alternc/templates/apache2/panel-ssl.conf b/etc/alternc/templates/apache2/panel-ssl.conf deleted file mode 100644 index 78d7236e..00000000 --- a/etc/alternc/templates/apache2/panel-ssl.conf +++ /dev/null @@ -1,42 +0,0 @@ - - ServerName %%fqdn%% - AssignUserId #%%UID%% #%%GID%% - SetEnv LOGIN "%%UID%%-%%LOGIN%%" - - KeepAlive Off - - RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ - RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L] - - - - DocumentRoot /usr/share/alternc/panel/admin - AssignUserId alterncpanel alterncpanel - SetEnv LOGIN "%%UID%%-%%LOGIN%%" - ServerName %%fqdn%% - RewriteEngine on - RewriteRule ^/admin/(.*) /$1 - - alias /alternc-sql /usr/share/phpmyadmin - - RewriteEngine On - RewriteRule ^webmail /webmail-redirect.php [L] - - # Mail autoconfig - RewriteRule ^mail/mailautoconfig.xml$ /mailautoconfig_thunderbird.php [L] - RewriteRule ^mail/config-v1.1.xml$ /mailautoconfig_thunderbird.php [L] - RewriteRule ^autodiscover/autodiscover.xml$ /mailautoconfig_outlook.php [L] - RewriteRule ^Autodiscover/Autodiscover.xml$ /mailautoconfig_outlook.php [L] - RewriteRule ^Autodiscover.xml$ mailautoconfig_outlook.php [L] - RewriteRule ^autodiscover.xml$ mailautoconfig_outlook.php [L] - - # will be used to define aliases such as /javascript /squirrelmail ... - Include /etc/alternc/apache-panel.d/*.conf - - SSLEngine On - SSLCertificateFile %%CRT%% - SSLCertificateKeyFile %%KEY%% - %%CHAINLINE%% - - diff --git a/etc/alternc/templates/apache2/panel.conf b/etc/alternc/templates/apache2/panel.conf index f3eda7d7..f2225296 100644 --- a/etc/alternc/templates/apache2/panel.conf +++ b/etc/alternc/templates/apache2/panel.conf @@ -1,11 +1,24 @@ - + + ServerName %%fqdn%% + AssignUserId #%%UID%% #%%GID%% + SetEnv LOGIN "%%UID%%-%%LOGIN%%" + + KeepAlive Off + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ + RewriteCond %{REQUEST_FILENAME} !/.well-known/acme-challenge/ + RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L] + + + DocumentRoot /usr/share/alternc/panel/admin AssignUserId alterncpanel alterncpanel SetEnv LOGIN "%%UID%%-%%LOGIN%%" ServerName %%fqdn%% RewriteEngine on RewriteRule ^/admin/(.*) /$1 - + alias /alternc-sql /usr/share/phpmyadmin RewriteEngine On @@ -22,4 +35,9 @@ # will be used to define aliases such as /javascript /squirrelmail ... Include /etc/alternc/apache-panel.d/*.conf + SSLEngine On + SSLCertificateFile %%CRT%% + SSLCertificateKeyFile %%KEY%% + %%CHAINLINE%% + diff --git a/etc/alternc/templates/apache2/roundcube-ssl.conf b/etc/alternc/templates/apache2/roundcube.conf similarity index 87% rename from etc/alternc/templates/apache2/roundcube-ssl.conf rename to etc/alternc/templates/apache2/roundcube.conf index 659eaeca..cfa83db1 100644 --- a/etc/alternc/templates/apache2/roundcube-ssl.conf +++ b/etc/alternc/templates/apache2/roundcube.conf @@ -1,13 +1,14 @@ - + ServerName %%fqdn%% - AssignUserId #%%UID%% #%%GID%% + AssignUserId #%%UID%% #%%GID%% SetEnv LOGIN "%%UID%%-%%LOGIN%%" - KeepAlive Off + KeepAlive Off - RewriteEngine On + RewriteEngine On RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ - RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L] + RewriteCond %{REQUEST_FILENAME} !/.well-known/acme-challenge/ + RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L] diff --git a/etc/alternc/templates/apache2/squirrelmail-ssl.conf b/etc/alternc/templates/apache2/squirrelmail.conf similarity index 80% rename from etc/alternc/templates/apache2/squirrelmail-ssl.conf rename to etc/alternc/templates/apache2/squirrelmail.conf index f5132599..ca96d57c 100644 --- a/etc/alternc/templates/apache2/squirrelmail-ssl.conf +++ b/etc/alternc/templates/apache2/squirrelmail.conf @@ -1,13 +1,14 @@ - + ServerName %%fqdn%% - AssignUserId #%%UID%% #%%GID%% + AssignUserId #%%UID%% #%%GID%% SetEnv LOGIN "%%UID%%-%%LOGIN%%" - KeepAlive Off + KeepAlive Off - RewriteEngine On + RewriteEngine On RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ - RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L] + RewriteCond %{REQUEST_FILENAME} !/.well-known/acme-challenge/ + RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L] diff --git a/etc/alternc/templates/apache2/url-ssl.conf b/etc/alternc/templates/apache2/url-ssl.conf deleted file mode 100644 index 0a6adae2..00000000 --- a/etc/alternc/templates/apache2/url-ssl.conf +++ /dev/null @@ -1,27 +0,0 @@ - - ServerName %%fqdn%% - AssignUserId #%%UID%% #%%GID%% - SetEnv LOGIN "%%UID%%-%%LOGIN%%" - - KeepAlive Off - - RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ - RewriteRule ^/(.*)$ %%redirect%%/$1 [R=301,L] - - - - ServerName %%fqdn%% - AssignUserId #%%UID%% #%%GID%% - SetEnv LOGIN "%%UID%%-%%LOGIN%%" - - SSLEngine On - SSLCertificateFile %%CRT%% - SSLCertificateKeyFile %%KEY%% - %%CHAINLINE%% - - RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ - RewriteRule ^/(.*)$ %%redirect%%/$1 [R=301,L] - - diff --git a/etc/alternc/templates/apache2/url.conf b/etc/alternc/templates/apache2/url.conf index 67f293f0..236624d5 100644 --- a/etc/alternc/templates/apache2/url.conf +++ b/etc/alternc/templates/apache2/url.conf @@ -1,12 +1,28 @@ - + ServerName %%fqdn%% - AssignUserId #%%UID%% #%%GID%% + AssignUserId #%%UID%% #%%GID%% SetEnv LOGIN "%%UID%%-%%LOGIN%%" - KeepAlive Off + KeepAlive Off - RewriteEngine On + RewriteEngine On RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ - RewriteRule ^/(.*)$ %%redirect%%/$1 [R=301,L] + RewriteCond %{REQUEST_FILENAME} !/.well-known/acme-challenge/ + RewriteRule ^/(.*)$ %%redirect%%/$1 [R=301,L] + + ServerName %%fqdn%% + AssignUserId #%%UID%% #%%GID%% + SetEnv LOGIN "%%UID%%-%%LOGIN%%" + + SSLEngine On + SSLCertificateFile %%CRT%% + SSLCertificateKeyFile %%KEY%% + %%CHAINLINE%% + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ + RewriteRule ^/(.*)$ %%redirect%%/$1 [R=301,L] + + \ No newline at end of file diff --git a/etc/alternc/templates/apache2/vhost-mixssl.conf b/etc/alternc/templates/apache2/vhost-both.conf similarity index 100% rename from etc/alternc/templates/apache2/vhost-mixssl.conf rename to etc/alternc/templates/apache2/vhost-both.conf diff --git a/etc/alternc/templates/apache2/vhost.conf b/etc/alternc/templates/apache2/vhost-http.conf similarity index 68% rename from etc/alternc/templates/apache2/vhost.conf rename to etc/alternc/templates/apache2/vhost-http.conf index 8b4f304f..c163bc86 100644 --- a/etc/alternc/templates/apache2/vhost.conf +++ b/etc/alternc/templates/apache2/vhost-http.conf @@ -1,3 +1,17 @@ + + ServerName %%fqdn%% + AssignUserId #%%UID%% #%%GID%% + SetEnv LOGIN "%%UID%%-%%LOGIN%%" + + KeepAlive Off + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ + RewriteCond %{REQUEST_FILENAME} !/.well-known/acme-challenge/ + RewriteRule ^/(.*)$ http://%%fqdn%%/$1 [R=301,L] + + + ServerName %%fqdn%% DocumentRoot "%%document_root%%" @@ -16,8 +30,8 @@ Require all granted -# If you want to log the errors also in /var/log/alternc/sites/ -# WARNING: this WILL FORK a vlogger for EACH VHOST havingg this !!! the load on the machine may be high +# If you want to log the errors also in /var/log/alternc/sites/ +# WARNING: this WILL FORK a vlogger for EACH VHOST havingg this !!! the load on the machine may be high # on hosting with many vhosts. as a consequence, this is disabled by default # ErrorLog "|| /usr/sbin/vlogger -e -u alterncpanel -g alterncpanel -s error.log -t \"error-%Y%m%d.log\" /var/log/alternc/sites/%%UID%%-%%LOGIN%%/" diff --git a/etc/alternc/templates/apache2/vhost-ssl.conf b/etc/alternc/templates/apache2/vhost-https.conf similarity index 79% rename from etc/alternc/templates/apache2/vhost-ssl.conf rename to etc/alternc/templates/apache2/vhost-https.conf index 190f2000..29b80df6 100644 --- a/etc/alternc/templates/apache2/vhost-ssl.conf +++ b/etc/alternc/templates/apache2/vhost-https.conf @@ -1,13 +1,14 @@ - + ServerName %%fqdn%% - AssignUserId #%%UID%% #%%GID%% + AssignUserId #%%UID%% #%%GID%% SetEnv LOGIN "%%UID%%-%%LOGIN%%" - KeepAlive Off + KeepAlive Off - RewriteEngine On + RewriteEngine On RewriteCond %{REQUEST_FILENAME} !/cgi-bin/ - RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L] + RewriteCond %{REQUEST_FILENAME} !/.well-known/acme-challenge/ + RewriteRule ^/(.*)$ https://%%fqdn%%/$1 [R=301,L]