Przeglądaj źródła

Remove global webmail configuration

Kristan Kenney 7 lat temu
rodzic
commit
fb0d96096b

+ 1 - 3
func/domain.sh

@@ -584,9 +584,7 @@ is_mail_new() {
     fi
 }
 
-
-
-# Add web config
+# Add webmail config
 add_webmail_config() {
     mkdir -p "$HOMEDIR/$user/conf/mail/$domain"
     conf="$HOMEDIR/$user/conf/mail/$domain/$1.conf"

+ 0 - 82
install/deb/nginx/webmail.conf

@@ -1,82 +0,0 @@
-server {
-    listen      %ip%:%proxy_port%;
-    server_name %webmail_alias%.*;
-
-    location / {
-        proxy_pass      http://%ip%:%web_port%;
-        location ~* ^.+\.(jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm)$ {
-            alias          /var/lib/roundcube/;
-            expires        15m;
-            try_files      $uri @fallback;
-        }
-    }
-
-    location /error/ {
-        alias   /var/www/document_errors/;
-    }
-
-    location ~ /(config|temp|logs) {
-        return 404;
-    }
-
-    location ~ ^/(.*\.php)$ {
-        alias /var/lib/roundcube/$1;
-        fastcgi_pass 127.0.0.1:9000;
-        fastcgi_index index.php;
-        include fastcgi_params;
-        fastcgi_param SCRIPT_FILENAME $request_filename;
-    }
-    
-    location @fallback {
-        proxy_pass      http://%ip%:%web_port%;
-    }
-
-    location ~ /\.ht    {return 404;}
-    location ~ /\.svn/  {return 404;}
-    location ~ /\.git/  {return 404;}
-    location ~ /\.hg/   {return 404;}
-    location ~ /\.bzr/  {return 404;}
-}
-
-server {
-    listen      %ip%:%proxy_ssl_port% ssl http2;
-    server_name %webmail_alias%.*;
-    ssl_certificate      /usr/local/hestia/ssl/certificate.crt;
-    ssl_certificate_key  /usr/local/hestia/ssl/certificate.key;
-
-    location / {
-        proxy_pass      https://%ip%:%web_ssl_port%;
-        location ~* ^.+\.(jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm)$ {
-            alias          /var/lib/roundcube/;
-            expires        15m;
-            try_files      $uri @fallback;
-        }
-    }
-
-    location /error/ {
-        alias   /var/www/document_errors/;
-    }
-
-    location ~ /(config|temp|logs) {
-        return 404;
-    }
-
-    location ~ ^/(.*\.php)$ {
-        alias /var/lib/roundcube/$1;
-        fastcgi_pass 127.0.0.1:9000;
-        fastcgi_index index.php;
-        include fastcgi_params;
-        fastcgi_param SCRIPT_FILENAME $request_filename;
-    }
-
-    location @fallback {
-        proxy_pass      https://%ip%:%web_ssl_port%;
-    }
-
-    location ~ /\.ht    {return 404;}
-    location ~ /\.svn/  {return 404;}
-    location ~ /\.git/  {return 404;}
-    location ~ /\.hg/   {return 404;}
-    location ~ /\.bzr/  {return 404;}
-
-}

+ 0 - 90
install/deb/roundcube/apache.conf

@@ -1,90 +0,0 @@
-<VirtualHost %ip%:%web_port%>
-    ServerAlias %webmail_alias%.*
-    Alias / /var/lib/roundcube/
-    Alias /error/ /var/www/document_errors/
-    #SuexecUserGroup %user% %group%
-    
-    <Directory "/usr/share/tinymce/www/">
-      Options Indexes MultiViews FollowSymLinks
-      AllowOverride None
-      Order allow,deny
-      allow from all
-    </Directory>
-
-    <Directory /var/lib/roundcube/>
-        Options +FollowSymLinks
-        # This is needed to parse /var/lib/roundcube/.htaccess. See its
-        # content before setting AllowOverride to None.
-        AllowOverride All
-        order allow,deny
-        allow from all
-    </Directory>
-
-    # Protecting basic directories:
-    <Directory /var/lib/roundcube/config>
-            Options -FollowSymLinks
-            AllowOverride None
-    </Directory>
-
-    <Directory /var/lib/roundcube/temp>
-            Options -FollowSymLinks
-            AllowOverride None
-        Order allow,deny
-        Deny from all
-    </Directory>
-
-    <Directory /var/lib/roundcube/logs>
-            Options -FollowSymLinks
-            AllowOverride None
-        Order allow,deny
-        Deny from all
-    </Directory>
-</VirtualHost>
-
-<VirtualHost %ip%:%web_ssl_port%>
-    ServerAlias %webmail_alias%.*
-    Alias / /var/lib/roundcube/
-    Alias /error/ %home%/%user%/web/%domain%/document_errors/
-    #SuexecUserGroup %user% %group%
-    
-    SSLEngine on
-    SSLVerifyClient none
-    SSLCertificateFile         /usr/local/hestia/ssl/certificate.crt
-    SSLCertificateKeyFile      /usr/local/hestia/ssl/certificate.key
-
-    <Directory "/usr/share/tinymce/www/">
-      Options Indexes MultiViews FollowSymLinks
-      AllowOverride None
-      Order allow,deny
-      allow from all
-    </Directory>
-
-    <Directory /var/lib/roundcube/>
-        Options +FollowSymLinks
-        # This is needed to parse /var/lib/roundcube/.htaccess. See its
-        # content before setting AllowOverride to None.
-        AllowOverride All
-        order allow,deny
-        allow from all
-    </Directory>
-
-    # Protecting basic directories:
-    <Directory /var/lib/roundcube/config>
-            Options -FollowSymLinks
-            AllowOverride None
-    </Directory>
-
-    <Directory /var/lib/roundcube/temp>
-            Options -FollowSymLinks
-            AllowOverride None
-        Order allow,deny
-        Deny from all
-    </Directory>
-
-    <Directory /var/lib/roundcube/logs>
-            Options -FollowSymLinks
-            AllowOverride None
-        Order allow,deny
-        Deny from all
-    </Directory>
-</VirtualHost>

+ 20 - 48
install/upgrade/0.9.8-29.sh

@@ -166,6 +166,12 @@ if [ -f /etc/dovecot/conf.d/15-mailboxes.conf ]; then
     # Remove mailboxes configuration if it exists
     rm -f /etc/dovecot/conf.d/15-mailboxes.conf
 fi
+if [ -f /etc/dovecot/dovecot.conf ]; then
+    # Update dovecot configuration and restart dovecot service
+    cp -f $HESTIA/install/deb/dovecot/dovecot.conf /etc/dovecot/dovecot.conf
+    systemctl restart dovecot
+    sleep 0.5
+fi
 
 # Fix exim configuration
 if [ -f /etc/exim4/exim4.conf.template ]; then
@@ -180,54 +186,6 @@ if [ -f /etc/exim4/exim4.conf.template ]; then
     fi
 fi
 
-if [ -f /etc/dovecot/dovecot.conf ]; then
-    # Update dovecot configuration and restart dovecot service
-    cp -f $HESTIA/install/deb/dovecot/dovecot.conf /etc/dovecot/dovecot.conf
-    systemctl restart dovecot
-    sleep 0.5
-fi
-
-# Update Roundcube webmail configuration
-if [ "$WEB_SYSTEM" = 'apache2' ]; then
-    echo "(*) Updating Roundcube global subdomain configuration for apache2..."
-    cp -f $HESTIA/install/deb/roundcube/apache.conf /etc/apache2/conf.d/roundcube.conf
-fi
-if [ ! -z "$PROXY_SYSTEM" ]; then
-    echo "(*) Updating Roundcube global subdomain configuration for nginx..."
-    if [ -f /etc/nginx/conf.d/webmail.inc ]; then
-        rm -f /etc/nginx/conf.d/webmail.inc
-    fi
-    cp -f $HESTIA/install/deb/nginx/webmail.conf /etc/nginx/conf.d/webmail.conf
-fi
-
-# Write web server configuration
-    sed -i 's|%webmail_alias%|'$WEBMAIL_ALIAS'|g' /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%domain%|'$domain'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%domain_idn%|'$domain'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%home%|'$HOMEDIR'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%user%|'$user'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%group%|'$user'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%ip%|'$ipaddr'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%web_port%|'$WEB_PORT'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%proxy_port%|'$PROXY_PORT'|g' /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%web_ssl_port%|'$WEB_SSL_PORT'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%proxy_ssl_port%|'$PROXY_SSL_PORT'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%web_system%|'$WEB_SYSTEM'|g' /etc/apache2/conf.d/roundcube.conf
-
-# Write proxy server configurationls
-    sed -i 's|%webmail_alias%|'$WEBMAIL_ALIAS'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%domain%|'$domain'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%domain_idn%|'$domain'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%home%|'$HOMEDIR'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%user%|'$user'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%group%|'$user'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%ip%|'$ipaddr'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%web_port%|'$WEB_PORT'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%proxy_port%|'$PROXY_PORT'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%web_ssl_port%|'$WEB_SSL_PORT'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%proxy_ssl_port%|'$PROXY_SSL_PORT'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%web_system%|'$WEB_SYSTEM'|g' /etc/nginx/conf.d/webmail.conf
-
 # Add IMAP system variable to configuration if dovecot is installed
 if [ -z "$IMAP_SYSTEM" ]; then 
     if [ -f /usr/bin/dovecot ]; then
@@ -236,6 +194,20 @@ if [ -z "$IMAP_SYSTEM" ]; then
     fi
 fi
 
+# Remove global webmail configuration files in favor of per-domain vhosts
+if [ -f /etc/apache2/conf.d/roundcube.conf ]; then
+    echo "(*) Removing global webmail configuration files for Apache2..."
+    rm -f /etc/apache2/conf.d/roundcube.conf
+fi
+if [ -f /etc/nginx/conf.d/webmail.inc ]; then
+    echo "(*) Removing global webmail configuration files for nginx..."
+    rm -f /etc/nginx/conf.d/webmail.inc 
+fi
+if [ -f /etc/nginx/conf.d/webmail.conf ]; then
+    echo "(*) Removing global webmail configuration files for nginx..."
+    rm -f /etc/nginx/conf.d/webmail.conf
+fi
+
 # Remove Webalizer and replace it with awstats as default
 echo "(*) Setting awstats as default web statistics backend..."
 apt purge webalizer -y > /dev/null 2>&1