Commits

Zhang Huangbin  committed 2bd15cd

Better support for OpenBSD 5.4:
- Add missing package for ldapd backend.
- Use valid log format in Awstats for built-in Apache log file.
- Don't explicitly specify cyrus-sasl package flavor to avoid package conflict.

  • Participants
  • Parent commits 4b8184a

Comments (0)

Files changed (4)

File iRedMail/functions/apache_php.sh

         # Create /var/www/dev/*random.
         cd /var/www/dev/ && /dev/MAKEDEV random
 
-        # Enable mod_auth_mysql
+        # Enable mod_auth_ldap/mysql/pgsql
+        [ X"${BACKEND}" == X'OPENLDAP' -o X"${BACKEND}" == X'LDAPD' ] && /usr/local/sbin/mod_auth_ldap-enable &>/dev/null
         [ X"${BACKEND}" == X'MYSQL' ] && /usr/local/sbin/mod_auth_mysql-enable &>/dev/null
+        [ X"${BACKEND}" == X'PGSQL' ] && /usr/local/sbin/mod_auth_pgsql-enable &>/dev/null
     fi
 
     # --------------------------

File iRedMail/functions/awstats.sh

     ECHO_DEBUG "Setup user auth for awstats: ${AWSTATS_HTTPD_CONF}."
     if [ X"${BACKEND}" == X'OPENLDAP'  -o X"${BACKEND}" == X'LDAPD' ]; then
         # Use LDAP auth.
-        cat >> ${AWSTATS_HTTPD_CONF} <<EOF
+        if [ X"${DISTRO}" == X'OPENBSD' ]; then
+            cat >> ${AWSTATS_HTTPD_CONF} <<EOF
+    AuthLDAPEnabled on
+    AuthLDAPAuthoritative Off
+EOF
+        else
+            cat >> ${AWSTATS_HTTPD_CONF} <<EOF
     AuthBasicProvider ldap
     AuthzLDAPAuthoritative   Off
+EOF
+        fi
 
+        cat >> ${AWSTATS_HTTPD_CONF} <<EOF
     AuthLDAPUrl   ldap://${LDAP_SERVER_HOST}:${LDAP_SERVER_PORT}/${LDAP_BASEDN}?${LDAP_ATTR_USER_RDN}?sub?(&(objectclass=${LDAP_OBJECTCLASS_MAILUSER})(${LDAP_ATTR_ACCOUNT_STATUS}=${LDAP_STATUS_ACTIVE})(${LDAP_ATTR_DOMAIN_GLOBALADMIN}=${LDAP_VALUE_DOMAIN_GLOBALADMIN}))
 
     AuthLDAPBindDN "${LDAP_BINDDN}"
 
     perl -pi -e 's#^(DirIcons=)(.*)#${1}"/awstats/icon#' ${AWSTATS_CONF_WEB}
 
+    # LogFormat
+    if [ X"${DISTRO}" == X'OPENBSD' ]; then
+        perl -pi -e 's#^(LogFormat).*#${1}="%host %other %logname %time1 %methodurl %code %bytesd"#' ${AWSTATS_CONF_WEB}
+    fi
     # On RHEL/CentOS/Debian, ${AWSTATS_CONF_SAMPLE} is default config file. Overrided here.
     backup_file ${AWSTATS_CONF_SAMPLE}
     [ X"${DISTRO}" != X"SUSE" ] && cp -f ${AWSTATS_CONF_WEB} ${AWSTATS_CONF_SAMPLE}

File iRedMail/functions/packages.sh

                 PKG_SCRIPTS="${PKG_SCRIPTS} ${OPENLDAP_RC_SCRIPT_NAME}"
             fi
 
-            ALL_PKGS="${ALL_PKGS} cyrus-sasl--ldap openldap-client mysql-server mysql-client"
+            ALL_PKGS="${ALL_PKGS} openldap-client mysql-server mysql-client"
             PKG_SCRIPTS="${PKG_SCRIPTS} ${MYSQL_RC_SCRIPT_NAME}"
 
         fi
                 ALL_PKGS="${ALL_PKGS} mysql-server"
                 PKG_SCRIPTS="${PKG_SCRIPTS} ${MYSQL_RC_SCRIPT_NAME}"
             fi
-            ALL_PKGS="${ALL_PKGS} mysql-client cyrus-sasl--mysql"
+            ALL_PKGS="${ALL_PKGS} mysql-client"
         fi
     elif [ X"${BACKEND}" == X"PGSQL" ]; then
         ENABLED_SERVICES="${ENABLED_SERVICES} ${PGSQL_RC_SCRIPT_NAME}"
             fi
 
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then
-            ALL_PKGS="${ALL_PKGS} postgresql-client cyrus-sasl--pgsql postgresql-server postgresql-contrib"
+            ALL_PKGS="${ALL_PKGS} postgresql-client postgresql-server postgresql-contrib"
             PKG_SCRIPTS="${PKG_SCRIPTS} ${PGSQL_RC_SCRIPT_NAME}"
         fi
     fi
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then
             ALL_PKGS="${ALL_PKGS} awstats"
 
-            [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} mod_auth_ldap"
+            [ X"${BACKEND}" == X'OPENLDAP' -o X"${BACKEND}" == X'LDAPD' ] && ALL_PKGS="${ALL_PKGS} mod_auth_ldap"
             [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} mod_auth_mysql"
             [ X"${BACKEND}" == X'PGSQL' ] && ALL_PKGS="${ALL_PKGS} mod_auth_pgsql"
         fi

File iRedMail/functions/postgresql.sh

 
     backup_file ${PGSQL_CONF_PG_HBA} ${PGSQL_CONF_POSTGRESQL}
 
-    ECHO_DEBUG "Listen on address: ${LOCAL_ADDRESS}"
-    if [ X"${LOCAL_ADDRESS}" == X'127.0.0.1' ]; then
-        perl -pi -e 's#.*(listen_addresses.=.)(.).*#${1}${2}localhost${2}#' ${PGSQL_CONF_POSTGRESQL}
-    else
-        perl -pi -e 's#.*(listen_addresses.=.)(.).*#${1}${2}$ENV{LOCAL_ADDRESS}${2}#' ${PGSQL_CONF_POSTGRESQL}
+    ECHO_DEBUG "Update config file to listen on address: ${LOCAL_ADDRESS}"
+    perl -pi -e 's#.*(listen_addresses.=.)(.).*#${1}${2}$ENV{LOCAL_ADDRESS}${2}#' ${PGSQL_CONF_POSTGRESQL}
 
+    if [ X"${LOCAL_ADDRESS}" != X'127.0.0.1' ]; then
         # Allow remote access
         echo "host   all all ${LOCAL_ADDRESS}/32 md5" >> ${PGSQL_CONF_PG_HBA}
     fi