Commits

Zhang Huangbin committed 9a3159c

Code cleanup in functions/cluebringer.sh.

Comments (0)

Files changed (2)

iRedMail/conf/cluebringer

     export CLUEBRINGER_CONF='/etc/policyd.conf'
     export CLUEBRINGER_INIT_SCRIPT="${DIR_RC_SCRIPTS}/policyd"
     export CLUEBRINGER_PID_FILE='/var/run/cluebringer/cbpolicyd.pid'
+    export CLUEBRINGER_HTTPD_ROOT=''
 
     # Path of policyd-clean
     export CLUEBRINGER_CLEANUP_BIN='/usr/sbin/policyd-cleanup'
     export CLUEBRINGER_CONF='/etc/cluebringer/cluebringer.conf'
     export CLUEBRINGER_INIT_SCRIPT="${DIR_RC_SCRIPTS}/policyd"
     export CLUEBRINGER_PID_FILE='var/run/cluebringer/cbpolicyd.pid'
+    export CLUEBRINGER_HTTPD_ROOT=''
 
     # Path of policyd-clean
     export CLUEBRINGER_CLEANUP_BIN='/usr/lib/policyd/cleanup'
     export CLUEBRINGER_CONF='/usr/local/etc/postfix-policyd-sf.conf'
     export CLUEBRINGER_INIT_SCRIPT="${DIR_RC_SCRIPTS}/policyd"
     export CLUEBRINGER_PID_FILE='var/run/cluebringer/cbpolicyd.pid'
+    export CLUEBRINGER_HTTPD_ROOT=''
 
     # Path of policyd-clean
     export CLUEBRINGER_CLEANUP_BIN='/usr/local/sbin/postfix-policyd-sf-cleanup'

iRedMail/functions/cluebringer.sh

 
 cluebringer_webui_config()
 {
-    ECHO_DEBUG "Configure cluebringer webui."
+    ECHO_DEBUG "Configure webui of Policyd (cluebringer)."
 
     backup_file ${CLUEBRINGER_CONF}
 
-    if [ X"${DISTRO}" == X"UBUNTU" ]; then
-        if [ X"${DISTRO_CODENAME}" == X"oneiric" ]; then
-            cat > ${CLUEBRINGER_HTTPD_CONF} <<EOF
+    cat > ${CLUEBRINGER_HTTPD_CONF} <<EOF
 ${CONF_MSG}
 # Note: Please refer to ${HTTPD_SSL_CONF} for SSL/TLS setting.
 #Alias /cluebringer ${CLUEBRINGER_HTTPD_ROOT}/
     AuthName "Authorization Required"
 EOF
 
-            ECHO_DEBUG "Setup user auth for cluebringer webui: ${CLUEBRINGER_HTTPD_CONF}."
-            if [ X"${BACKEND}" == X"OpenLDAP" ]; then
-                # Use LDAP auth.
-                cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
+    ECHO_DEBUG "Setup user auth for cluebringer webui: ${CLUEBRINGER_HTTPD_CONF}."
+    if [ X"${BACKEND}" == X"OpenLDAP" ]; then
+        # Use LDAP auth.
+        cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
     AuthType Basic
 
     AuthBasicProvider ldap
     AuthLDAPBindPassword "${LDAP_BINDPW}"
 EOF
 
-                [ X"${LDAP_USE_TLS}" == X"YES" ] && \
-                    perl -pi -e 's#(AuthLDAPUrl.*)(ldap://)(.*)#${1}ldaps://${3}#' ${CLUEBRINGER_HTTPD_CONF}
+        [ X"${LDAP_USE_TLS}" == X"YES" ] && \
+            perl -pi -e 's#(AuthLDAPUrl.*)(ldap://)(.*)#${1}ldaps://${3}#' ${CLUEBRINGER_HTTPD_CONF}
 
-            elif [ X"${BACKEND}" == X"MySQL" ]; then
-                # 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
+    elif [ X"${BACKEND}" == X"MySQL" ]; then
+        # 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
     AuthMySQLNameField username
     AuthMySQLPasswordField password
 EOF
-                    # FreeBSD special.
-                    if [ X"${DISTRO}" == X"FREEBSD" ]; then
-                        # Enable mod_auth_mysql module in httpd.conf.
-                        perl -pi -e 's/^#(LoadModule.*mod_auth_mysql.*)/${1}/' ${HTTPD_CONF}
-                    fi
 
-                    # OpenSuSE & FreeBSD special.
-                    if [ X"${DISTRO}" == X"SUSE" -o X"${DISTRO}" == X"FREEBSD" ]; then
-                        echo "AuthBasicAuthoritative Off" >> ${CLUEBRINGER_HTTPD_CONF}
-                    fi
+            # FreeBSD special.
+            if [ X"${DISTRO}" == X"FREEBSD" ]; then
+                # Enable mod_auth_mysql module in httpd.conf.
+                perl -pi -e 's/^#(LoadModule.*mod_auth_mysql.*)/${1}/' ${HTTPD_CONF}
+            fi
 
-                elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
-                    cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
+            # OpenSuSE & FreeBSD special.
+            if [ X"${DISTRO}" == X"SUSE" -o X"${DISTRO}" == X"FREEBSD" ]; then
+                echo "AuthBasicAuthoritative Off" >> ${CLUEBRINGER_HTTPD_CONF}
+            fi
+
+        elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
+            cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
     AuthType Basic
 
     AuthMYSQL on
     Auth_MySQL_Authoritative On
 EOF
 
-                    # Set file permission.
-                    chmod 0600 ${CLUEBRINGER_HTTPD_CONF}
+            # 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 ${MYSQL_SERVER} ${MYSQL_BIND_USER} ${MYSQL_BIND_PW}
 Auth_MySQL_General_DB ${VMAIL_DB}
 EOF
-                else
-                    :
-                fi
+        else
+            :
+        fi
 
-                # Close <Directory> container.
-                cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
+        # Close <Directory> container.
+        cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
 
     Require valid-user
 </Directory>
 EOF
-            fi
-
-        fi
     fi
 
     echo 'export status_cluebringer_webui_config="DONE"' >> ${STATUS_FILE}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.