Commits

Zhang Huangbin  committed c39af05

Amavisd @storage_sql_dsn now works with PGSQL.
phpPgAdmin works with PGSQL.
Awstats works with PGSQL.
Upgrade phpMyAdmin to 3.4.9.

  • Participants
  • Parent commits 5c80c92

Comments (0)

Files changed (22)

File iRedMail/conf/awstats

 export AWSTATS_CONF_MAIL="${AWSTATS_CONF_DIR}/awstats.smtp.conf"
 
 # Used for apache directory access list. Generated via 'htpasswd' command.
-export AWSTATS_HTPASSWD_FILE="${HTTPD_CONF_DIR}/awstats.users"
+export AWSTATS_HTPASSWD_FILE="${HTTPD_CONF_ROOT}/awstats.users"
 
 # Config files.
 if [ X"${DISTRO}" == X"RHEL" ]; then

File iRedMail/conf/core

 SSL cert keys (size: ${SSL_KEY_SIZE}):
     - ${SSL_CERT_FILE}
     - ${SSL_KEY_FILE}
+
 EOF
 }

File iRedMail/conf/global

 export MYSQL_SERVER='127.0.0.1'
 export MYSQL_SERVER_PORT='3306'
 # PGSQL server
-export PGSQL_SERVER='localhost'
+export PGSQL_SERVER='127.0.0.1'
 export PGSQL_SERVER_PORT='5432'
 # POP3/IMAP server (Dovecot)
 export IMAP_SERVER='127.0.0.1'

File iRedMail/conf/phpmyadmin

 # along with iRedMail.  If not, see <http://www.gnu.org/licenses/>.
 #---------------------------------------------------------------------
 
-export PHPMYADMIN_VERSION='3.4.8-all-languages'
+export PHPMYADMIN_VERSION='3.4.9-all-languages'
 export PHPMYADMIN_TARBALL="phpMyAdmin-${PHPMYADMIN_VERSION}.tar.bz2"
 
 # Install phpMyAdmin with source tarball.

File iRedMail/conf/phppgadmin

+#!/usr/bin/env bash
+
+# Author:   Zhang Huangbin (zhb(at)iredmail.org)
+
+#---------------------------------------------------------------------
+# This file is part of iRedMail, which is an open source mail server
+# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
+#
+# iRedMail is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# iRedMail is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with iRedMail.  If not, see <http://www.gnu.org/licenses/>.
+#---------------------------------------------------------------------
+
+export PHPPGADMIN_VERSION='5.0.3'
+export PHPPGADMIN_TARBALL="phpPgAdmin-${PHPPGADMIN_VERSION}.tar.bz2"
+
+# Install phpPgAdmin with source tarball.
+export PHPPGADMIN_USE_SOURCE='YES'
+export PHPPGADMIN_HTTPD_ROOT="${HTTPD_SERVERROOT}/phpPgAdmin-${PHPPGADMIN_VERSION}"
+export PHPPGADMIN_HTTPD_ROOT_SYMBOL_LINK="${HTTPD_SERVERROOT}/phppgadmin"
+export PHPPGADMIN_HTTPD_CONF="${HTTPD_CONF_DIR}/phppgadmin.conf"
+
+# Install phpPgAdmin with binary packages.
+if [ X"${DISTRO}" == X"UBUNTU" -o X"${DISTRO}" == X"DEBIAN" ]; then
+    export PHPPGADMIN_USE_SOURCE='NO'
+    export PHPPGADMIN_HTTPD_ROOT="/usr/share/phppgadmin"
+    export PHPPGADMIN_HTTPD_ROOT_SYMBOL_LINK="${PHPPGADMIN_HTTPD_ROOT}"
+    export PHPPGADMIN_HTTPD_CONF="${HTTPD_CONF_DIR}/phppgadmin"
+elif [ X"${DISTRO}" == X"FREEBSD" ]; then
+    export PHPPGADMIN_USE_SOURCE='NO'
+    export PHPPGADMIN_HTTPD_ROOT="${HTTPD_SERVERROOT}/phpPgAdmin"
+    export PHPPGADMIN_HTTPD_ROOT_SYMBOL_LINK="${PHPPGADMIN_HTTPD_ROOT}"
+    export PHPPGADMIN_HTTPD_CONF="${HTTPD_CONF_DIR}/phppgadmin.conf"
+fi
+
+export PHPPGADMIN_CONFIG_FILE="${PHPPGADMIN_HTTPD_ROOT}/conf/config.inc.php"

File iRedMail/conf/postgresql

 export PGSQL_SSL_CERT="${SSL_CERT_DIR}/iRedMail_CA_PostgreSQL.pem"
 export PGSQL_SSL_KEY="${SSL_KEY_DIR}/iRedMail_PostgreSQL.key"
 
+# Commands
+export PGSQL_BIN_PG_DUMP='/usr/bin/pg_dump'
+export PGSQL_BIN_PG_DUMPALL='/usr/bin/pg_dumpall'
+if [ X"${DISTRO}" == X"FREEBSD" ]; then
+    export PGSQL_BIN_PG_DUMP='/usr/local/bin/pg_dump'
+    export PGSQL_BIN_PG_DUMPALL='/usr/local/bin/pg_dumpall'
+fi
+
 export PGSQL_BACKUP_DATABASES="${PGSQL_BACKUP_DATABASES}"
 if [ X"${BACKEND}" == X"PGSQL" ]; then
     export PGSQL_BACKUP_DATABASES="${PGSQL_BACKUP_DATABASES} ${VMAIL_DB}"

File iRedMail/dialog/config_via_dialog.sh

 . ${CONF_DIR}/global
 . ${CONF_DIR}/core
 . ${CONF_DIR}/openldap
+. ${CONF_DIR}/postfix
 . ${CONF_DIR}/roundcube
 
 trap "exit 255" 2

File iRedMail/dialog/optional_components.sh

 " 20 76 8 \
     "DKIM signing/verification" "DomainKeys Identified Mail" "on" \
     "Roundcubemail" "WebMail program (PHP, AJAX)" "on" \
+    "phpPgAdmin" "Web-based MySQL management tool" "on" \
+    "Awstats" "Advanced web and mail log analyzer" "on" \
     "Fail2ban" "Ban IP with too many password failures" "on" \
     2>${tmp_config_optional_components}
-
-    #"phpPgAdmin" "Web-based MySQL management tool" "on" \
-    #"Awstats" "Advanced web and mail log analyzer" "on" \
 fi
 
 OPTIONAL_COMPONENTS="$(cat ${tmp_config_optional_components})"
 echo ${OPTIONAL_COMPONENTS} | grep -i 'iredadmin' >/dev/null 2>&1
 [ X"$?" == X"0" ] && export USE_IREDADMIN='YES' && export USE_IREDADMIN='YES' && echo "export USE_IREDADMIN='YES'" >> ${CONFIG_FILE}
 
-echo ${OPTIONAL_COMPONENTS} | grep -i 'roundcubemail' >/dev/null 2>&1
-if [ X"$?" == X"0" ]; then
+if echo ${OPTIONAL_COMPONENTS} | grep -i 'roundcubemail' &>/dev/null; then
     export USE_WEBMAIL='YES'
     export USE_RCM='YES'
+    export REQUIRE_PHP='YES'
     echo "export USE_WEBMAIL='YES'" >> ${CONFIG_FILE}
     echo "export USE_RCM='YES'" >> ${CONFIG_FILE}
     echo "export REQUIRE_PHP='YES'" >> ${CONFIG_FILE}
 fi
 
-echo ${OPTIONAL_COMPONENTS} | grep -i 'phpldapadmin' >/dev/null 2>&1
-if [ X"$?" == X"0" ]; then
+if echo ${OPTIONAL_COMPONENTS} | grep -i 'phpldapadmin' &>/dev/null; then
     export USE_PHPLDAPADMIN='YES'
+    export REQUIRE_PHP='YES'
     echo "export USE_PHPLDAPADMIN='YES'" >>${CONFIG_FILE}
     echo "export REQUIRE_PHP='YES'" >> ${CONFIG_FILE}
 fi
     echo "export REQUIRE_PHP='YES'" >> ${CONFIG_FILE}
 fi
 
-echo ${OPTIONAL_COMPONENTS} | grep -i 'awstats' >/dev/null 2>&1
-[ X"$?" == X"0" ] && export USE_AWSTATS='YES' && echo "export USE_AWSTATS='YES'" >>${CONFIG_FILE}
+if echo ${OPTIONAL_COMPONENTS} | grep -i 'phppgadmin' &>/dev/null; then
+    export USE_PHPPGADMIN='YES'
+    echo "export USE_PHPPGADMIN='YES'" >>${CONFIG_FILE}
+fi
 
-echo ${OPTIONAL_COMPONENTS} | grep -i 'fail2ban' >/dev/null 2>&1
-[ X"$?" == X"0" ] && export USE_FAIL2BAN='YES' && echo "export USE_FAIL2BAN='YES'" >>${CONFIG_FILE}
+if echo ${OPTIONAL_COMPONENTS} | grep -i 'awstats' &>/dev/null; then
+    export USE_AWSTATS='YES'
+    echo "export USE_AWSTATS='YES'" >>${CONFIG_FILE}
+fi
+
+if echo ${OPTIONAL_COMPONENTS} | grep -i 'fail2ban' &>/dev/null; then
+    export USE_FAIL2BAN='YES'
+    echo "export USE_FAIL2BAN='YES'" >>${CONFIG_FILE}
+fi
 
 # ----------------------------------------------------------------
 # Promot to choose the prefer language for webmail.

File iRedMail/dialog/virtual_domain_config.sh

 
 Alias for root user:
     * Alias address: ${MAIL_ALIAS_ROOT}
-    * You can change it in file 'aliases' under postfix root directory. It should be:
-        + /etc/postfix/aliases (Linux)
-        + /usr/local/etc/postfix/aliases (FreeBSD)
+    * You can change it in file ${POSTFIX_FILE_ALIASES}, then execute command 'postalias ${POSTFIX_FILE_ALIASES}'.
 
 EOF

File iRedMail/functions/amavisd.sh

     ['DBI:mysql:database=${AMAVISD_DB_NAME};host=${SQL_SERVER};port=${SQL_SERVER_PORT}', '${AMAVISD_DB_USER}', '${AMAVISD_DB_PASSWD}'],
 );
 EOF
-    elif [ X"${BACKEND}" == X"MYSQL" ]; then
+    elif [ X"${BACKEND}" == X"PGSQL" ]; then
         cat >> ${AMAVISD_CONF} <<EOF
 @storage_sql_dsn = (
     ['DBI:Pg:database=${AMAVISD_DB_NAME};host=${SQL_SERVER};port=${SQL_SERVER_PORT}', '${AMAVISD_DB_USER}', '${AMAVISD_DB_PASSWD}'],
+#@lookup_sql_dsn = @storage_sql_dsn;
 );
 EOF
     fi
 # WARNING: IN() may cause MySQL lookup performance issue.
 #\$sql_select_policy = "SELECT domain FROM domain WHERE CONCAT('@', domain) IN (%k)";
 EOF
-    elif [ X"${BACKEND}" == X"PGSQL" ]; then
-        cat >> ${AMAVISD_CONF} <<EOF
-# Uncomment below two lines to lookup virtual mail domains from PostgreSQL database.
-#@lookup_sql_dsn =  (
-#    ['DBI:Pg:database=${VMAIL_DB};host=${MYSQL_SERVER};port=${MYSQL_SERVER_PORT}', '${VMAIL_DB_BIND_USER}', '${VMAIL_DB_BIND_PASSWD}'],
-#);
-# For Amavisd-new-2.7.0 and later versions. Placeholder '%d' is available in Amavisd-2.7.0+.
-#\$sql_select_policy = "SELECT domain FROM domain WHERE domain='%d'";
-
-# For Amavisd-new-2.6.x.
-# WARNING: IN() may cause MySQL lookup performance issue.
-#\$sql_select_policy = "SELECT domain FROM domain WHERE CONCAT('@', domain) IN (%k)";
-EOF
     fi
 
     # Use 'utf8' character set.

File iRedMail/functions/apache_php.sh

 
         [ X"${BACKEND}" == X"OPENLDAP" ] && a2enmod authnz_ldap > /dev/null
         [ X"${BACKEND}" == X"MYSQL" ] && a2enmod auth_mysql > /dev/null
+        [ X"${BACKEND}" == X"PGSQL" ] && a2enmod 000_auth_pgsql > /dev/null
 
         # Ubuntu 10.04.
         # Comments starting with '#' are deprecated.

File iRedMail/functions/awstats.sh

 Auth_MySQL_Info ${MYSQL_SERVER} ${VMAIL_DB_BIND_USER} ${VMAIL_DB_BIND_PASSWD}
 Auth_MySQL_General_DB ${VMAIL_DB}
 EOF
-        else
-            :
         fi
+
+    elif [ X"${BACKEND}" == X"PGSQL" ]; then
+        # Use PGSQL auth.
+        cat >> ${AWSTATS_HTTPD_CONF} <<EOF
+    Auth_PG_authoritative on
+    Auth_PG_host ${PGSQL_SERVER}
+    Auth_PG_port ${PGSQL_SERVER_PORT}
+    Auth_PG_database ${VMAIL_DB}
+    Auth_PG_user ${VMAIL_DB_BIND_USER}
+    Auth_PG_pwd ${VMAIL_DB_BIND_PASSWD}
+    Auth_PG_pwd_table admin
+    #Auth_PG_pwd_whereclause 'AND xxx'
+    Auth_PG_uid_field username
+    Auth_PG_pwd_field password
+    Auth_PG_lowercase_uid on
+    Auth_PG_encrypted on
+    Auth_PG_hash_type CRYPT
+EOF
+
     else
         # Use basic auth mech.
         cat >> ${AWSTATS_HTTPD_CONF} <<EOF

File iRedMail/functions/cluebringer.sh

 Auth_MySQL_Info ${MYSQL_SERVER} ${VMAIL_DB_BIND_USER} ${VMAIL_DB_BIND_PASSWD}
 Auth_MySQL_General_DB ${VMAIL_DB}
 EOF
-        else
-            :
         fi  # DISTRO
-    fi  # BACKEND
+
+    elif [ X"${BACKEND}" == X"PGSQL" ]; then
+        # Use mod_auth_pgsql.
+        if [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
+            cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF
+    Auth_PG_authoritative on
+    Auth_PG_host ${PGSQL_SERVER}
+    Auth_PG_port ${PGSQL_SERVER_PORT}
+    Auth_PG_database ${VMAIL_DB}
+    Auth_PG_user ${VMAIL_DB_BIND_USER}
+    Auth_PG_pwd ${VMAIL_DB_BIND_PASSWD}
+    Auth_PG_pwd_table admin
+    #Auth_PG_pwd_whereclause 'AND xxx'
+    Auth_PG_uid_field username
+    Auth_PG_pwd_field password
+    Auth_PG_lowercase_uid on
+    Auth_PG_encrypted on
+    Auth_PG_hash_type CRYPT
+EOF
+        fi
+
+        # Set file permission.
+        chmod 0600 ${CLUEBRINGER_HTTPD_CONF}
+
+    fi
+    # END BACKEND
 
         # Close <Directory> container.
         cat >> ${CLUEBRINGER_HTTPD_CONF} <<EOF

File iRedMail/functions/mysql.sh

 
     ${MYSQLD_INIT_SCRIPT} restart >/dev/null 2>&1
 
-    ECHO_INFO -n "Sleep 5 seconds for MySQL daemon initialize:"
-    for i in 5 4 3 2 1; do
-        echo -n " ${i}" && sleep 1
-    done
-    echo '.'
+    ECHO_DEBUG -n "Sleep 5 seconds for MySQL daemon initialize:"
+    sleep 5
 
     echo '' > ${MYSQL_INIT_SQL}
 
 
     cat >> ${TIP_FILE} <<EOF
 Virtual Users:
+    - ${MYSQL_VMAIL_STRUCTURE_SAMPLE}
     - ${MYSQL_VMAIL_SQL}
-    - ${MYSQL_VMAIL_STRUCTURE_SAMPLE}
 
 EOF
 

File iRedMail/functions/openldap.sh

     ECHO_DEBUG "Starting OpenLDAP."
     ${LDAP_INIT_SCRIPT} restart >/dev/null
 
-    ECHO_INFO -n "Sleep 5 seconds for LDAP daemon initialize:"
-    for i in 5 4 3 2 1; do
-        echo -n " ${i}" && sleep 1
-    done
-    echo '.'
+    ECHO_DEBUG -n "Sleep 5 seconds for LDAP daemon initialize:"
+    sleep 5
 
     ECHO_DEBUG "Initialize LDAP tree."
     # home_mailbox format is 'maildir/' by default.

File iRedMail/functions/optional_components.sh

     [ X"${USE_PHPMYADMIN}" == X"YES" ] && \
         check_status_before_run phpmyadmin_install
 
+    # phpPgAdmin
+    [ X"${USE_PHPPGADMIN}" == X"YES" ] && \
+        check_status_before_run phppgadmin_install
+
     # Awstats.
     [ X"${USE_AWSTATS}" == X"YES" ] && \
         check_status_before_run awstats_config_basic && \

File iRedMail/functions/packages.sh

             ENABLED_SERVICES="rsyslog ${ENABLED_SERVICES}"
         fi
     fi
-    #### End syslog ####
-
-    #################
-    # Apache and PHP.
-    #
-    if [ X"${DISTRO}" == X"RHEL" ]; then
-        ALL_PKGS="${ALL_PKGS} httpd${PKG_ARCH} mod_ssl${PKG_ARCH} php${PKG_ARCH} php-common${PKG_ARCH} php-gd${PKG_ARCH} php-xml${PKG_ARCH} php-mysql${PKG_ARCH} php-ldap${PKG_ARCH}"
-        if [ X"${DISTRO_VERSION}" == X"5" ]; then
-            ALL_PKGS="${ALL_PKGS} php-imap${PKG_ARCH} libmcrypt${PKG_ARCH} php-mcrypt${PKG_ARCH} php-mhash${PKG_ARCH} php-mbstring${PKG_ARCH}"
-        fi
-        ENABLED_SERVICES="${ENABLED_SERVICES} httpd"
-
-    elif [ X"${DISTRO}" == X"SUSE" ]; then
-        ALL_PKGS="${ALL_PKGS} apache2-prefork apache2-mod_php5 php5-iconv php5-ldap php5-mysql php5-mcrypt php5-mbstring php5-gettext php5-dom php5-json php5-intl php5-fileinfo"
-        if [ X"${DISTRO_VERSION}" == X"11.3" -o X"${DISTRO_VERSION}" == X"11.4" ]; then
-            ALL_PKGS="${ALL_PKGS} php5-hash"
-        fi
-        ENABLED_SERVICES="${ENABLED_SERVICES} apache2"
-
-    elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
-        ALL_PKGS="${ALL_PKGS} apache2 apache2-mpm-prefork apache2.2-common libapache2-mod-php5 libapache2-mod-auth-mysql php5-cli php5-imap php5-gd php5-mcrypt php5-mysql php5-ldap php5-pgsql"
-
-        if [ X"${DISTRO_CODENAME}" != X"oneiric" ]; then
-            ALL_PKGS="${ALL_PKGS} php5-mhash"
-        fi
-
-        if [ X"${DISTRO_CODENAME}" == X"lucid" \
-            -o X"${DISTRO_CODENAME}" == X"natty" \
-            -o X"${DISTRO_CODENAME}" == X"oneiric" \
-            ]; then
-            if [ X"${BACKEND}" == X"OPENLDAP" ]; then
-                ALL_PKGS="${ALL_PKGS} php-net-ldap2"
-            fi
-        fi
-
-        ENABLED_SERVICES="${ENABLED_SERVICES} apache2"
-    else
-        :
-    fi
-    #### End Apache & PHP ####
-
-    ###############
-    # Postfix.
-    #
-    if [ X"${DISTRO}" == X"RHEL" ]; then
-        ALL_PKGS="${ALL_PKGS} postfix${PKG_ARCH}"
-    elif [ X"${DISTRO}" == X"SUSE" ]; then
-        # On OpenSuSE, postfix already has ldap_table support.
-        ALL_PKGS="${ALL_PKGS} postfix"
-    elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
-        ALL_PKGS="${ALL_PKGS} postfix postfix-pcre"
-    else
-        :
-    fi
-
-    ENABLED_SERVICES="${ENABLED_SERVICES} postfix"
-    #### End Postfix ####
-
-    #############
-    # Awstats.
-    #
-    if [ X"${USE_AWSTATS}" == X"YES" ]; then
-        if [ X"${DISTRO}" == X"RHEL" ]; then
-            ALL_PKGS="${ALL_PKGS} awstats.noarch"
-        elif [ X"${DISTRO}" == X"SUSE" ]; then
-            ALL_PKGS="${ALL_PKGS} awstats"
-        elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
-            ALL_PKGS="${ALL_PKGS} awstats"
-        else
-            :
-        fi
-    else
-        :
-    fi
-    #### End Awstats ####
 
     #################################################
     # Backend: OpenLDAP, MySQL, PGSQL and extra packages.
             # Postfix module
             ALL_PKGS="${ALL_PKGS} postfix-pgsql"
         fi
+    fi
+
+    #################
+    # Apache and PHP.
+    #
+    if [ X"${DISTRO}" == X"RHEL" ]; then
+        ALL_PKGS="${ALL_PKGS} httpd${PKG_ARCH} mod_ssl${PKG_ARCH} php${PKG_ARCH} php-common${PKG_ARCH} php-gd${PKG_ARCH} php-xml${PKG_ARCH} php-mysql${PKG_ARCH} php-ldap${PKG_ARCH}"
+        if [ X"${DISTRO_VERSION}" == X"5" ]; then
+            ALL_PKGS="${ALL_PKGS} php-imap${PKG_ARCH} libmcrypt${PKG_ARCH} php-mcrypt${PKG_ARCH} php-mhash${PKG_ARCH} php-mbstring${PKG_ARCH}"
+        fi
+        ENABLED_SERVICES="${ENABLED_SERVICES} httpd"
+
+    elif [ X"${DISTRO}" == X"SUSE" ]; then
+        ALL_PKGS="${ALL_PKGS} apache2-prefork apache2-mod_php5 php5-iconv php5-ldap php5-mysql php5-mcrypt php5-mbstring php5-gettext php5-dom php5-json php5-intl php5-fileinfo"
+        if [ X"${DISTRO_VERSION}" == X"11.3" -o X"${DISTRO_VERSION}" == X"11.4" ]; then
+            ALL_PKGS="${ALL_PKGS} php5-hash"
+        fi
+        ENABLED_SERVICES="${ENABLED_SERVICES} apache2"
+
+    elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
+        ALL_PKGS="${ALL_PKGS} apache2 apache2-mpm-prefork apache2.2-common libapache2-mod-php5 php5-cli php5-imap php5-gd php5-mcrypt php5-mysql php5-ldap php5-pgsql"
+
+        # Authentication modules
+        ALL_PKGS="${ALL_PKGS} libapache2-mod-auth-mysql libapache2-mod-auth-pgsql"
+
+        if [ X"${DISTRO_CODENAME}" != X"oneiric" ]; then
+            ALL_PKGS="${ALL_PKGS} php5-mhash"
+        fi
+
+        if [ X"${DISTRO_CODENAME}" == X"lucid" \
+            -o X"${DISTRO_CODENAME}" == X"natty" \
+            -o X"${DISTRO_CODENAME}" == X"oneiric" \
+            ]; then
+            if [ X"${BACKEND}" == X"OPENLDAP" ]; then
+                ALL_PKGS="${ALL_PKGS} php-net-ldap2"
+            fi
+        fi
+
+        ENABLED_SERVICES="${ENABLED_SERVICES} apache2"
     else
         :
     fi
 
+    ###############
+    # Postfix.
+    #
+    if [ X"${DISTRO}" == X"RHEL" ]; then
+        ALL_PKGS="${ALL_PKGS} postfix${PKG_ARCH}"
+    elif [ X"${DISTRO}" == X"SUSE" ]; then
+        # On OpenSuSE, postfix already has ldap_table support.
+        ALL_PKGS="${ALL_PKGS} postfix"
+    elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
+        ALL_PKGS="${ALL_PKGS} postfix postfix-pcre"
+    fi
+
+    ENABLED_SERVICES="${ENABLED_SERVICES} postfix"
+
     # Policyd.
     if [ X"${DISTRO}" == X"RHEL" ]; then
         ALL_PKGS="${ALL_PKGS} policyd${PKG_ARCH}"
         ALL_PKGS="${ALL_PKGS} libmail-spf-perl"
     fi
 
+    # phpPgAdmin
+    if [ X"${USE_PHPPGADMIN}" == X"YES" ]; then
+        if [ X"${DISTRO}" == X"RHEL" ]; then
+            :
+        elif [ X"${DISTRO}" == X"SUSE" ]; then
+            ALL_PKGS="${ALL_PKGS} phpPgAdmin"
+        elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
+            ALL_PKGS="${ALL_PKGS} phppgadmin"
+        fi
+    fi
 
     ############
     # iRedAPD.
         [ X"${USE_IREDAPD}" != "YES" ] && ALL_PKGS="${ALL_PKGS} python-ldap"
     fi
 
+    #############
+    # Awstats.
+    #
+    if [ X"${USE_AWSTATS}" == X"YES" ]; then
+        if [ X"${DISTRO}" == X"RHEL" ]; then
+            ALL_PKGS="${ALL_PKGS} awstats.noarch"
+        elif [ X"${DISTRO}" == X"SUSE" ]; then
+            ALL_PKGS="${ALL_PKGS} awstats"
+        elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
+            ALL_PKGS="${ALL_PKGS} awstats"
+        fi
+    fi
 
     #### Fail2ban ####
     if [ X"${USE_FAIL2BAN}" == X"YES" ]; then

File iRedMail/functions/phppgadmin.sh

+#!/usr/bin/env bash
+
+# Author: Zhang Huangbin <zhb(at)iredmail.org>
+
+# -------------------------------------------------
+# phpPgAdmin.
+# -------------------------------------------------
+phppgadmin_install()
+{
+    ECHO_INFO "Configure phpPgAdmin (web-based PostgreSQL management tool)." 
+
+    if [ X"${PHPPGADMIN_USE_SOURCE}" == X"YES" ]; then
+        cd ${MISC_DIR}
+
+        extract_pkg ${PHPPGADMIN_TARBALL} ${HTTPD_SERVERROOT}
+
+        ECHO_DEBUG "Set file permission for phpPgAdmin: ${PHPPGADMIN_HTTPD_ROOT}."
+        chown -R ${SYS_ROOT_USER}:${SYS_ROOT_GROUP} ${PHPPGADMIN_HTTPD_ROOT}
+        chmod -R 0755 ${PHPPGADMIN_HTTPD_ROOT}
+
+        # Create symbol link, so that we don't need to modify apache
+        # conf.d/phppgadmin.conf file after upgrade this component.
+        ln -s ${PHPPGADMIN_HTTPD_ROOT} ${PHPPGADMIN_HTTPD_ROOT_SYMBOL_LINK} >/dev/null
+    fi
+
+    backup_file ${PHPPGADMIN_CONFIG_FILE}
+
+    ECHO_DEBUG "Create directory alias for phpPgAdmin in Apache: ${PHPPGADMIN_HTTPD_CONF}."
+    cat > ${PHPPGADMIN_HTTPD_CONF} <<EOF
+${CONF_MSG}
+# Note: Please refer to ${HTTPD_SSL_CONF} for SSL/TLS setting.
+<Directory "${PHPPGADMIN_HTTPD_ROOT_SYMBOL_LINK}/">
+    Options -Indexes
+</Directory>
+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}
+
+    ECHO_DEBUG "Config phpPgAdmin: ${PHPPGADMIN_CONFIG_FILE}."
+    cd ${PHPPGADMIN_HTTPD_ROOT} && cp config.inc.php-dist ${PHPPGADMIN_CONFIG_FILE} &>/dev/null
+
+    perl -pi -e 's#(.*servers.*host.*=).*#${1} "$ENV{PGSQL_SERVER}";#' ${PHPPGADMIN_CONFIG_FILE}
+    perl -pi -e 's#(.*servers.*port.*=).*#${1} $ENV{PGSQL_SERVER_PORT};#' ${PHPPGADMIN_CONFIG_FILE}
+    perl -pi -e 's#(.*servers.*sslmode.*=).*#${1} "require";#' ${PHPPGADMIN_CONFIG_FILE}
+
+    perl -pi -e 's#(.*servers.*pg_dump_path.*=).*#${1} "$ENV{PGSQL_BIN_PG_DUMP}";#' ${PHPPGADMIN_CONFIG_FILE}
+    perl -pi -e 's#(.*servers.*pg_dumpall_path.*=).*#${1} "$ENV{PGSQL_BIN_PG_DUMPALL}";#' ${PHPPGADMIN_CONFIG_FILE}
+
+    perl -pi -e 's#(.*owned_only.*=).*#${1} true;#' ${PHPPGADMIN_CONFIG_FILE}
+    perl -pi -e 's#(.*show_reports.*=).*#${1} false;#' ${PHPPGADMIN_CONFIG_FILE}
+    perl -pi -e 's#(.*owned_reports_only.*=).*#${1} true;#' ${PHPPGADMIN_CONFIG_FILE}
+    perl -pi -e 's#(.*min_password_length.*=).*#${1} 8;#' ${PHPPGADMIN_CONFIG_FILE}
+
+    perl -pi -e 's#(.*Servers.*connect_type.*=).*#${1}"socket";#' ${PHPPGADMIN_CONFIG_FILE}
+
+    cat >> ${TIP_FILE} <<EOF
+phpPgAdmin:
+    * Configuration files:
+        - ${PHPPGADMIN_HTTPD_ROOT}
+        - ${PHPPGADMIN_CONFIG_FILE}
+    * Login account:
+        - Username: ${PGSQL_ROOT_USER}, password: ${PGSQL_ROOT_PASSWD}
+        - Username: ${VMAIL_DB_ADMIN_USER}, password: ${VMAIL_DB_ADMIN_PASSWD}
+        - Username (read-only): ${VMAIL_DB_BIND_USER}, password: ${VMAIL_DB_BIND_PASSWD}
+    * URL:
+        - httpS://${HOSTNAME}/phppgadmin
+    * See also:
+        - ${PHPPGADMIN_HTTPD_CONF}
+
+EOF
+
+    echo 'export status_phppgadmin_install="DONE"' >> ${STATUS_FILE}
+}

File iRedMail/functions/postfix.sh

 EOF
     done
 
+        echo '' >> ${TIP_FILE}
     echo 'export status_postfix_config_vhost_pgsql="DONE"' >> ${STATUS_FILE}
 }
 

File iRedMail/functions/postgresql.sh

     ECHO_DEBUG "Start PostgreSQL server"
     ${PGSQL_INIT_SCRIPT} restart >/dev/null 2>&1
 
-    ECHO_INFO -n "Sleep 5 seconds for PostgreSQL daemon initialize:"
-    for i in 5 4 3 2 1; do
-        echo -n " ${i}" && sleep 1
-    done
-    echo '.'
+    ECHO_DEBUG -n "Sleep 5 seconds for PostgreSQL daemon initialize:"
+    sleep 5
 
     ECHO_DEBUG "Setting password for PostgreSQL admin: (${PGSQL_ROOT_USER})."
     su - ${PGSQL_SYS_USER} -c "psql -d template1" >/dev/null <<EOF
     * RC script: ${PGSQL_INIT_SCRIPT}
     * Log file: /var/log/postgresql/
     * See also:
-        - ${PGSQL_INIT_SQL}
+        - ${PGSQL_INIT_SQL_SAMPLE}
         - ${PGSQL_DOT_PGPASS}
 
 EOF
 
     cat >> ${TIP_FILE} <<EOF
 Virtual Users:
+    - ${PGSQL_VMAIL_STRUCTURE_SAMPLE}
     - ${PGSQL_INIT_SQL_SAMPLE}
-    - ${PGSQL_VMAIL_STRUCTURE_SAMPLE}
 
 EOF
 

File iRedMail/iRedMail.sh

 . ${CONF_DIR}/spamassassin
 . ${CONF_DIR}/roundcube
 . ${CONF_DIR}/phpmyadmin
+. ${CONF_DIR}/phppgadmin
 . ${CONF_DIR}/awstats
 . ${CONF_DIR}/fail2ban
 . ${CONF_DIR}/iredadmin
 . ${FUNCTIONS_DIR}/user_vmail.sh
 
 . ${FUNCTIONS_DIR}/apache_php.sh
-
-# LDAP
 . ${FUNCTIONS_DIR}/openldap.sh
-. ${FUNCTIONS_DIR}/phpldapadmin.sh
-
-# MySQL
 . ${FUNCTIONS_DIR}/mysql.sh
-. ${FUNCTIONS_DIR}/phpmyadmin.sh
-
-# PostgreSQL
 . ${FUNCTIONS_DIR}/postgresql.sh
 
 # Switch backend
 . ${FUNCTIONS_DIR}/amavisd.sh
 . ${FUNCTIONS_DIR}/spamassassin.sh
 . ${FUNCTIONS_DIR}/roundcubemail.sh
+. ${FUNCTIONS_DIR}/phpldapadmin.sh
+. ${FUNCTIONS_DIR}/phpmyadmin.sh
+. ${FUNCTIONS_DIR}/phppgadmin.sh
 . ${FUNCTIONS_DIR}/awstats.sh
 . ${FUNCTIONS_DIR}/fail2ban.sh
 . ${FUNCTIONS_DIR}/iredadmin.sh

File iRedMail/pkgs/MD5.misc

 ddd7ba4271056e9ce6b230420fd9b66b  misc/iRedAdmin-0.1.6.tar.bz2
 bc4f20d3d7f69a5df0ae54172da2998f  misc/roundcubemail-0.7.1.tar.gz
 78ca61eb5d7913963f8e42eb3b4f0e95  misc/phpldapadmin-1.2.2.tgz
-e4ec403738639d4a37a8ae20d4181b5c  misc/phpMyAdmin-3.4.8-all-languages.tar.bz2
+ab181a3fffc89e5d5c4ebd62ccfe396b  misc/phpMyAdmin-3.4.9-all-languages.tar.bz2