Commits

Zhang Huangbin committed 4825e44

Re-enable Cluebringer webui on Ubuntu 13.10 with libaprutil1-dbd-mysql.

Comments (0)

Files changed (3)

iRedMail/functions/cluebringer.sh

         cp /usr/local/share/policyd2/contrib/httpd/cluebringer-httpd.conf ${CLUEBRINGER_WEBUI_CONF}
 
     # Make Cluebringer accessible via HTTPS.
-    perl -pi -e 's#^( *</VirtualHost>)#Alias /cluebringer "$ENV{CLUEBRINGER_HTTPD_ROOT}/"\n${1}#' ${HTTPD_SSL_CONF}
+    perl -pi -e 's#^(\s*</VirtualHost>)#Alias /cluebringer "$ENV{CLUEBRINGER_HTTPD_ROOT}/"\n${1}#' ${HTTPD_SSL_CONF}
 
     # Configure webui.
     if [ X"${BACKEND}" == X'OPENLDAP' -o X"${BACKEND}" == X'MYSQL' ]; then
     if [ X"${BACKEND}" == X"OPENLDAP" ]; then
         # Use LDAP auth.
         cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
-    AuthType Basic
-
     AuthBasicProvider ldap
     AuthzLDAPAuthoritative   Off
 
         # Use mod_auth_mysql.
         if [ X"${DISTRO}" == X"RHEL" -o X"${DISTRO}" == X"SUSE" -o X"${DISTRO}" == X"FREEBSD" ]; then
             cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
-    AuthType Basic
-
     AuthMYSQLEnable On
     AuthMySQLHost ${SQL_SERVER}
     AuthMySQLPort ${SQL_SERVER_PORT}
             fi
 
         elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
-            cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
-    AuthType Basic
-
+            if [ X"${DISTRO_CODENAME}" == X'wheezy' \
+                -o X"${DISTRO_CODENAME}" == X'precise' \
+                -o X"${DISTRO_CODENAME}" == X'raring' ]; then
+                cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
     AuthMYSQL on
     AuthBasicAuthoritative Off
     AuthUserFile /dev/null
     AuthMySQL_Encryption_Types Crypt_MD5
     Auth_MySQL_Authoritative On
 EOF
-
-            # Set file permission.
-            chmod 0600 ${CLUEBRINGER_HTTPD_CONF}
-
-            cat >> ${HTTPD_CONF} <<EOF
+                cat >> ${HTTPD_CONF} <<EOF
 # MySQL auth (libapache2-mod-auth-apache2).
 # Global config of MySQL server, 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}#' ${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} pass=$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"
+EOF
+
+                a2enconf cluebringer &>/dev/null
+                a2enmod authn_dbd &>/dev/null
+            fi
+
+            # Set file permission.
+            chmod 0600 ${CLUEBRINGER_HTTPD_CONF}
+
         fi  # DISTRO
 
     elif [ X"${BACKEND}" == X"PGSQL" ]; then

iRedMail/functions/packages.sh

                 -o X"${DISTRO_CODENAME}" == X'precise' \
                 -o X"${DISTRO_CODENAME}" == X'raring' ]; then
                 ALL_PKGS="${ALL_PKGS} libapache2-mod-auth-mysql"
+            else
+                ALL_PKGS="${ALL_PKGS} libaprutil1-dbd-mysql"
             fi
 
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then
                 -o X"${DISTRO_CODENAME}" == X'precise' \
                 -o X"${DISTRO_CODENAME}" == X'raring' ]; then
                 ALL_PKGS="${ALL_PKGS} libapache2-mod-auth-pgsql"
+            else
+                ALL_PKGS="${ALL_PKGS} libaprutil1-dbd-pgsql"
             fi
 
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then

iRedMail/functions/policy_server.sh

         check_status_before_run cluebringer_user
         check_status_before_run cluebringer_config
 
-        if [ X"${DISTRO}" == X'SUSE' ]; then
+        if [ X"${DISTRO}" != X'SUSE' ]; then
             # openSUSE-12.3 doesn't have Apache module mod_auth_mysql & mod_auth_pgsql.
-            :
-        elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
-            # Ubuntu 13.10 doesn't ship libapache2-mod-auth-mysql/pgsql
-            if [ X"${DISTRO_CODENAME}" == X'wheezy' \
-                -o X"${DISTRO_CODENAME}" == X'precise' \
-                -o X"${DISTRO_CODENAME}" == X'raring' ]; then
-                check_status_before_run cluebringer_webui_config
-            else
-                :
-            fi
-        else
             check_status_before_run cluebringer_webui_config
         fi
     fi