Commits

Zhang Huangbin committed 6a538b2

* Enable Awstats on Ubuntu 13.10.
* Fix incorrect package name on openSUSE-13.1.

  • Participants
  • Parent commits 4825e44

Comments (0)

Files changed (9)

File iRedMail/ChangeLog

 iRedMail-0.8.6:
     * Works on openSUSE-13.1 milestone 4.
     * Works on OpenBSD 5.4, plus Awstats support.
-    * Works on Ubuntu 13.10 (saucy). NOTES:
-      - Awstats, Cluebringer webui are not available due to package missing
-        (libapache2-mod-auth-mysql, libapache2-mod-auth-pgsql).
+    * Works on Ubuntu 13.10 (saucy). NOTE:
       - phpLDAPadmin is not available because it cannot be installed at all.
     * Merge per-domain and per-user transport_maps MySQL lookup into one file:
       - Removed: mysql/transport_maps_domain.cf, mysql/transport_maps_user.cf

File iRedMail/functions/awstats.sh

 
 
         elif [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
-            cat >> ${AWSTATS_HTTPD_CONF} <<EOF
+            if [ X"${DISTRO_CODENAME}" == X'wheezy' \
+                -o X"${DISTRO_CODENAME}" == X'precise' \
+                -o X"${DISTRO_CODENAME}" == X'raring' ]; then
+                cat >> ${AWSTATS_HTTPD_CONF} <<EOF
     AuthMYSQL on
     AuthBasicAuthoritative Off
     AuthUserFile /dev/null
     Auth_MySQL_Authoritative On
     #AuthMySQLUserCondition "isglobaladmin=1"
 EOF
-
-            # Set file permission.
-            chmod 0600 ${AWSTATS_HTTPD_CONF}
-
-            cat >> ${HTTPD_CONF} <<EOF
+                cat >> ${HTTPD_CONF} <<EOF
 # MySQL auth (libapache2-mod-auth-apache2).
 # Global config of MySQL server address, username, password.
 Auth_MySQL_Info ${SQL_SERVER} ${VMAIL_DB_BIND_USER} ${VMAIL_DB_BIND_PASSWD}
 Auth_MySQL_General_DB ${VMAIL_DB}
 EOF
 
+            else
+                perl -pi -e 's#(<Directory .*)#DBDriver mysql\n${1}#' ${AWSTATS_HTTPD_CONF}
+                perl -pi -e 's#(<Directory .*)#DBDParams "host=$ENV{SQL_SERVER} port=$ENV{SQL_SERVER_PORT} dbname=$ENV{VMAIL_DB} user=$ENV{VMAIL_DB_BIND_USER} pass=$ENV{VMAIL_DB_BIND_PASSWD}"\n${1}#' ${AWSTATS_HTTPD_CONF}
+
+                cat >> ${AWSTATS_HTTPD_CONF} <<EOF
+    AuthBasicProvider dbd
+    AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s AND isglobaladmin=1"
+EOF
+
+                a2enconf awstats &>/dev/null
+                a2enmod authn_dbd &>/dev/null
+            fi
+
+            # Set file permission.
+            chmod 0600 ${AWSTATS_HTTPD_CONF}
+
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then
             cat >> ${AWSTATS_HTTPD_CONF} <<EOF
     Auth_MYSQL on
         fi
 
     elif [ X"${BACKEND}" == X"PGSQL" ]; then
-        # Use PGSQL auth.
-        cat >> ${AWSTATS_HTTPD_CONF} <<EOF
+        if [ X"${DISTRO_CODENAME}" == X'saucy' ]; then
+            perl -pi -e 's#(<Directory .*)#DBDriver pgsql\n${1}#' ${AWSTATS_HTTPD_CONF}
+            perl -pi -e 's#(<Directory .*)#DBDParams "host=$ENV{SQL_SERVER} port=$ENV{SQL_SERVER_PORT} dbname=$ENV{VMAIL_DB} user=$ENV{VMAIL_DB_BIND_USER} password=$ENV{VMAIL_DB_BIND_PASSWD}"\n${1}#' ${AWSTATS_HTTPD_CONF}
+
+            cat >> ${AWSTATS_HTTPD_CONF} <<EOF
+    AuthBasicProvider dbd
+    AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s AND isglobaladmin=1"
+EOF
+
+            a2enconf awstats &>/dev/null
+            a2enmod authn_dbd &>/dev/null
+        else
+            # Use PGSQL auth.
+            cat >> ${AWSTATS_HTTPD_CONF} <<EOF
     Auth_PG_authoritative on
     Auth_PG_host ${SQL_SERVER}
     Auth_PG_port ${SQL_SERVER_PORT}
     Auth_PG_encrypted on
     Auth_PG_hash_type CRYPT
 EOF
+        fi
 
         if [ X"${DISTRO}" == X"SUSE" ]; then
             # Don't enable Awstats since we don't have Apache module mod_auth_pgsql
 EOF
 
     # Make Awstats accessible via HTTPS.
-    perl -pi -e 's#^( *</VirtualHost>)#Alias /awstats/icon "$ENV{AWSTATS_ICON_DIR}/"\n${1}#' ${HTTPD_SSL_CONF}
-    perl -pi -e 's#^( *</VirtualHost>)#Alias /awstatsicon "$ENV{AWSTATS_ICON_DIR}/"\n${1}#' ${HTTPD_SSL_CONF}
-    perl -pi -e 's#^( *</VirtualHost>)#ScriptAlias /awstats "$ENV{AWSTATS_CGI_DIR}/"\n${1}#' ${HTTPD_SSL_CONF}
+    perl -pi -e 's#^(\s*</VirtualHost>)#Alias /awstats/icon "$ENV{AWSTATS_ICON_DIR}/"\n${1}#' ${HTTPD_SSL_CONF}
+    perl -pi -e 's#^(\s*</VirtualHost>)#Alias /awstatsicon "$ENV{AWSTATS_ICON_DIR}/"\n${1}#' ${HTTPD_SSL_CONF}
+    perl -pi -e 's#^(\s*</VirtualHost>)#ScriptAlias /awstats "$ENV{AWSTATS_CGI_DIR}/"\n${1}#' ${HTTPD_SSL_CONF}
 
     cat >> ${TIP_FILE} <<EOF
 Awstats:

File iRedMail/functions/cluebringer.sh

 
                 cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
     AuthBasicProvider dbd
-    AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s"
+    AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s AND isglobaladmin=1"
 EOF
 
                 a2enconf cluebringer &>/dev/null
         fi  # DISTRO
 
     elif [ X"${BACKEND}" == X"PGSQL" ]; then
-        # Use mod_auth_pgsql.
-        cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
+        if [ X"${DISTRO_CODENAME}" == X'saucy' ]; then
+            perl -pi -e 's#(<Directory .*)#DBDriver pgsql\n${1}#' ${CLUEBRINGER_HTTPD_CONF}
+            perl -pi -e 's#(<Directory .*)#DBDParams "host=$ENV{SQL_SERVER} port=$ENV{SQL_SERVER_PORT} dbname=$ENV{VMAIL_DB} user=$ENV{VMAIL_DB_BIND_USER} password=$ENV{VMAIL_DB_BIND_PASSWD}"\n${1}#' ${CLUEBRINGER_HTTPD_CONF}
+
+            cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
+    AuthBasicProvider dbd
+    AuthDBDUserPWQuery "SELECT password FROM mailbox WHERE username=%s AND isglobaladmin=1"
+EOF
+
+            a2enconf cluebringer &>/dev/null
+            a2enmod authn_dbd &>/dev/null
+        else
+            # Use mod_auth_pgsql.
+            cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
     Auth_PG_authoritative on
     Auth_PG_host ${SQL_SERVER}
     Auth_PG_port ${SQL_SERVER_PORT}
     Auth_PG_encrypted on
     Auth_PG_hash_type CRYPT
 EOF
+        fi
 
         # Set file permission.
         chmod 0600 ${CLUEBRINGER_HTTPD_CONF}

File iRedMail/functions/iredadmin.sh

 
     if [ X"${DISTRO}" == X'OPENBSD' ]; then
         # Create directory alias.
-        perl -pi -e 's#^( *</VirtualHost>)#Alias /iredadmin/static "$ENV{IREDADMIN_HTTPD_ROOT_SYMBOL_LINK}/static"\n${1}#' ${HTTPD_SSL_CONF}
-        perl -pi -e 's#^( *</VirtualHost>)#ScriptAlias /iredadmin "$ENV{IREDADMIN_HTTPD_ROOT_SYMBOL_LINK}/iredadmin.py"\n${1}#' ${HTTPD_SSL_CONF}
+        perl -pi -e 's#^(\s*</VirtualHost>)#Alias /iredadmin/static "$ENV{IREDADMIN_HTTPD_ROOT_SYMBOL_LINK}/static"\n${1}#' ${HTTPD_SSL_CONF}
+        perl -pi -e 's#^(\s*</VirtualHost>)#ScriptAlias /iredadmin "$ENV{IREDADMIN_HTTPD_ROOT_SYMBOL_LINK}/iredadmin.py"\n${1}#' ${HTTPD_SSL_CONF}
 
         # There's no wsgi module for Apache available on OpenBSD, so
         # iRedAdmin runs as CGI program.
 </Directory>
 EOF
     else
-        perl -pi -e 's#^( *</VirtualHost>)#Alias /iredadmin/static "$ENV{IREDADMIN_HTTPD_ROOT_SYMBOL_LINK}/static/"\n${1}#' ${HTTPD_SSL_CONF}
-        perl -pi -e 's#^( *</VirtualHost>)#WSGIScriptAlias /iredadmin "$ENV{IREDADMIN_HTTPD_ROOT_SYMBOL_LINK}/iredadmin.py/"\n${1}#' ${HTTPD_SSL_CONF}
+        perl -pi -e 's#^(\s*</VirtualHost>)#Alias /iredadmin/static "$ENV{IREDADMIN_HTTPD_ROOT_SYMBOL_LINK}/static/"\n${1}#' ${HTTPD_SSL_CONF}
+        perl -pi -e 's#^(\s*</VirtualHost>)#WSGIScriptAlias /iredadmin "$ENV{IREDADMIN_HTTPD_ROOT_SYMBOL_LINK}/iredadmin.py/"\n${1}#' ${HTTPD_SSL_CONF}
 
         # iRedAdmin runs as WSGI application with Apache + mod_wsgi
         cat > ${IREDADMIN_HTTPD_CONF} <<EOF

File iRedMail/functions/packages.sh

 
         elif [ X"${DISTRO}" == X"SUSE" ]; then
             if [ X"${USE_LOCAL_MYSQL_SERVER}" == X'YES' ]; then
-                ALL_PKGS="${ALL_PKGS} mysql-community-server-client"
+                ALL_PKGS="${ALL_PKGS} mysql-community-server"
             fi
             ALL_PKGS="${ALL_PKGS} mysql-community-server-client"
 

File iRedMail/functions/phpldapadmin.sh

 EOF
 
     # Make phpldapadmin can be accessed via HTTPS only.
-    perl -pi -e 's#^( *</VirtualHost>)#Alias /phpldapadmin "$ENV{PLA_HTTPD_ROOT_SYMBOL_LINK}/"\nAlias /ldap "$ENV{PLA_HTTPD_ROOT_SYMBOL_LINK}/"\n${1}#' ${HTTPD_SSL_CONF}
+    perl -pi -e 's#^(\s*</VirtualHost>)#Alias /phpldapadmin "$ENV{PLA_HTTPD_ROOT_SYMBOL_LINK}/"\nAlias /ldap "$ENV{PLA_HTTPD_ROOT_SYMBOL_LINK}/"\n${1}#' ${HTTPD_SSL_CONF}
 
     cat >> ${TIP_FILE} <<EOF
 phpLDAPadmin:

File iRedMail/functions/phpmyadmin.sh

     fi
 
     # Make phpMyAdmin can be accessed via HTTPS only.
-    perl -pi -e 's#^( *</VirtualHost>)#Alias /phpmyadmin "$ENV{PHPMYADMIN_HTTPD_ROOT_SYMBOL_LINK}/"\n${1}#' ${HTTPD_SSL_CONF}
+    perl -pi -e 's#^(\s*</VirtualHost>)#Alias /phpmyadmin "$ENV{PHPMYADMIN_HTTPD_ROOT_SYMBOL_LINK}/"\n${1}#' ${HTTPD_SSL_CONF}
 
     ECHO_DEBUG "Config phpMyAdmin: ${PHPMYADMIN_CONFIG_FILE}."
     cd ${PHPMYADMIN_HTTPD_ROOT} && cp config.sample.inc.php ${PHPMYADMIN_CONFIG_FILE}

File iRedMail/functions/phppgadmin.sh

 EOF
 
     # Make phpPgAdmin can be accessed via HTTPS only.
-    perl -pi -e 's#^( *</VirtualHost>)#Alias /phppgadmin "$ENV{PHPPGADMIN_HTTPD_ROOT_SYMBOL_LINK}/"\n${1}#' ${HTTPD_SSL_CONF}
+    perl -pi -e 's#^(\s*</VirtualHost>)#Alias /phppgadmin "$ENV{PHPPGADMIN_HTTPD_ROOT_SYMBOL_LINK}/"\n${1}#' ${HTTPD_SSL_CONF}
 
     ECHO_DEBUG "Config phpPgAdmin: ${PHPPGADMIN_CONFIG_FILE}."
     cd ${PHPPGADMIN_HTTPD_ROOT} && cp config.inc.php-dist ${PHPPGADMIN_CONFIG_FILE} &>/dev/null

File iRedMail/functions/roundcubemail.sh

     fi
 
     # Make Roundcube can be accessed via HTTPS.
-    perl -pi -e 's#^( *</VirtualHost>)#Alias /mail "$ENV{RCM_HTTPD_ROOT_SYMBOL_LINK}/"\n${1}#' ${HTTPD_SSL_CONF}
+    perl -pi -e 's#^(\s*</VirtualHost>)#Alias /mail "$ENV{RCM_HTTPD_ROOT_SYMBOL_LINK}/"\n${1}#' ${HTTPD_SSL_CONF}
 
     # Redirect home page to webmail by default
     backup_file ${HTTPD_DOCUMENTROOT}/index.html