Commits

Zhang Huangbin committed 4b1987a

Merge sample config files.

Comments (0)

Files changed (8)

iRedMail/conf/mysql

 export MYSQL_ROOT_USER='root'
 
 # Use lowercase variable name for IP address.
+# Will set SQL_SERVER in functions/backend.sh.
 if [ X"${MYSQL_SERVER}" == X"localhost" ]; then
     export mysql_server='127.0.0.1'
 else

iRedMail/conf/postgresql

 export PGSQL_SYS_USER='postgres'
 export PGSQL_SYS_GROUP='postgres'
 
+# PGSQL server address
+# Will set SQL_SERVER in functions/backend.sh.
 export PGSQL_SERVER='localhost'
 export PGSQL_PORT='5432'
 export PGSQL_ROOT_USER='postgres'

iRedMail/functions/backend.sh

         # Initialize MySQL database server.
         check_status_before_run mysql_initialize
     elif [ X"${BACKEND}" == X"MYSQL" ]; then
-        # Initialize MySQL.
+        export SQL_SERVER="${MYSQL_SERVER}"
+
         check_status_before_run mysql_initialize
         check_status_before_run mysql_import_vmail_users
     elif [ X"${BACKEND}" == X"PGSQL" ]; then
+        export SQL_SERVER="${PGSQL_SERVER}"
+
         check_status_before_run pgsql_initialize
         check_status_before_run pgsql_import_vmail_users
     else

iRedMail/functions/dovecot2.sh

     elif [ X"${BACKEND}" == X"MYSQL" ]; then
 
         backup_file ${DOVECOT_MYSQL_CONF}
-        cp -f ${SAMPLE_DIR}/conf/dovecot2-mysql.conf ${DOVECOT_MYSQL_CONF}
+        cp -f ${SAMPLE_DIR}/conf/dovecot2-sql.conf ${DOVECOT_MYSQL_CONF}
 
-        perl -pi -e 's#PH_MYSQL_SERVER#$ENV{MYSQL_SERVER}#' ${DOVECOT_MYSQL_CONF}
+        perl -pi -e 's#PH_SQL_DRIVER#mysql#' ${DOVECOT_MYSQL_CONF}
+        perl -pi -e 's#PH_SQL_SERVER#$ENV{MYSQL_SERVER}#' ${DOVECOT_MYSQL_CONF}
         perl -pi -e 's#PH_VMAIL_DB#$ENV{VMAIL_DB}#' ${DOVECOT_MYSQL_CONF}
         perl -pi -e 's#PH_VMAIL_DB_BIND_USER#$ENV{VMAIL_DB_BIND_USER}#' ${DOVECOT_MYSQL_CONF}
         perl -pi -e 's#PH_VMAIL_DB_BIND_PASSWD#$ENV{VMAIL_DB_BIND_PASSWD}#' ${DOVECOT_MYSQL_CONF}
     elif [ X"${BACKEND}" == X"PGSQL" ]; then
 
         backup_file ${DOVECOT_PGSQL_CONF}
-        cp -f ${SAMPLE_DIR}/conf/dovecot2-pgsql.conf ${DOVECOT_PGSQL_CONF}
+        cp -f ${SAMPLE_DIR}/conf/dovecot2-sql.conf ${DOVECOT_PGSQL_CONF}
 
-        perl -pi -e 's#PH_PGSQL_SERVER#$ENV{PGSQL_SERVER}#' ${DOVECOT_PGSQL_CONF}
+        perl -pi -e 's#PH_SQL_DRIVER#pgsql#' ${DOVECOT_PGSQL_CONF}
+        perl -pi -e 's#PH_SQL_SERVER#$ENV{PGSQL_SERVER}#' ${DOVECOT_PGSQL_CONF}
         perl -pi -e 's#PH_VMAIL_DB#$ENV{VMAIL_DB}#' ${DOVECOT_PGSQL_CONF}
         perl -pi -e 's#PH_VMAIL_DB_BIND_USER#$ENV{VMAIL_DB_BIND_USER}#' ${DOVECOT_PGSQL_CONF}
         perl -pi -e 's#PH_VMAIL_DB_BIND_PASSWD#$ENV{VMAIL_DB_BIND_PASSWD}#' ${DOVECOT_PGSQL_CONF}
     fi
 
 
-        if [ X"${BACKEND}" == X"OPENLDAP" ]; then
-            realtime_quota_db_name="${IREDADMIN_DB_NAME}"
-            realtime_quota_db_user="${IREDADMIN_DB_USER}"
-            realtime_quota_db_passwd="${IREDADMIN_DB_PASSWD}"
-        else
-            realtime_quota_db_name="${VMAIL_DB}"
-            realtime_quota_db_user="${VMAIL_DB_ADMIN_USER}"
-            realtime_quota_db_passwd="${VMAIL_DB_ADMIN_PASSWD}"
-        fi
+    if [ X"${BACKEND}" == X"OPENLDAP" ]; then
+        realtime_quota_db_name="${IREDADMIN_DB_NAME}"
+        realtime_quota_db_user="${IREDADMIN_DB_USER}"
+        realtime_quota_db_passwd="${IREDADMIN_DB_PASSWD}"
+    else
+        realtime_quota_db_name="${VMAIL_DB}"
+        realtime_quota_db_user="${VMAIL_DB_ADMIN_USER}"
+        realtime_quota_db_passwd="${VMAIL_DB_ADMIN_PASSWD}"
+    fi
 
-        cat > ${DOVECOT_REALTIME_QUOTA_CONF} <<EOF
+    cat > ${DOVECOT_REALTIME_QUOTA_CONF} <<EOF
 ${CONF_MSG}
 connect = host=${MYSQL_SERVER} dbname=${realtime_quota_db_name} user=${realtime_quota_db_user} password=${realtime_quota_db_passwd}
 map {
 }
 EOF
 
-        # Create MySQL database ${IREDADMIN_DB_USER} and table 'used_quota'
-        # which used to store realtime quota.
-        if [ X"${BACKEND}" == X"OPENLDAP" -a X"${USE_IREDADMIN}" != X"YES" ]; then
-            # If iRedAdmin is not used, create database and import table here.
-            mysql -h${MYSQL_SERVER} -P${MYSQL_PORT} -u${MYSQL_ROOT_USER} -p"${MYSQL_ROOT_PASSWD}" <<EOF
+    # Create MySQL database ${IREDADMIN_DB_USER} and table 'used_quota'
+    # which used to store realtime quota.
+    if [ X"${BACKEND}" == X"OPENLDAP" -a X"${USE_IREDADMIN}" != X"YES" ]; then
+        # If iRedAdmin is not used, create database and import table here.
+        mysql -h${MYSQL_SERVER} -P${MYSQL_PORT} -u${MYSQL_ROOT_USER} -p"${MYSQL_ROOT_PASSWD}" <<EOF
 # Create databases.
 CREATE DATABASE IF NOT EXISTS ${IREDADMIN_DB_NAME} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
 
 FLUSH PRIVILEGES;
 EOF
 
-        fi
+    fi
     # ---- real time dict quota ----
 
     # ---- IMAP shared folder ----

iRedMail/functions/roundcubemail.sh

 
     cd ${RCM_HTTPD_ROOT}/config/
 
-    export RCM_DB_USER RCM_DB_PASSWD RCMD_DB MYSQL_SERVER FIRST_DOMAIN
+    export RCM_DB_USER RCM_DB_PASSWD RCMD_DB MYSQL_SERVER PGSQL_SERVER SQL_SERVER FIRST_DOMAIN
 
-    perl -pi -e 's#(.*db_dsnw.*= )(.*)#${1}"$ENV{PHP_CONN_TYPE}://$ENV{RCM_DB_USER}:$ENV{RCM_DB_PASSWD}\@$ENV{MYSQL_SERVER}/$ENV{RCM_DB}";#' db.inc.php
+    perl -pi -e 's#(.*db_dsnw.*= )(.*)#${1}"$ENV{PHP_CONN_TYPE}://$ENV{RCM_DB_USER}:$ENV{RCM_DB_PASSWD}\@$ENV{SQL_SERVER}/$ENV{RCM_DB}";#' db.inc.php
 
     # ----------------------------------
     # LOGGING/DEBUGGING
     # Require the new password to contain a letter and punctuation character
     perl -pi -e 's#(.*password_require_nonalpha.*=).*#${1} true;#' config.inc.php
 
-    if [ X"${BACKEND}" == X"MYSQL" ]; then
+    if [ X"${BACKEND}" == X"MYSQL" -o X"${BACKEND}" == X"PGSQL" ]; then
         perl -pi -e 's#(.*password_driver.*=).*#${1} "sql";#' config.inc.php
-        perl -pi -e 's#(.*password_db_dsn.*= )(.*)#${1}"$ENV{'PHP_CONN_TYPE'}://$ENV{'RCM_DB_USER'}:$ENV{'RCM_DB_PASSWD'}\@$ENV{'MYSQL_SERVER'}/$ENV{'VMAIL_DB'}";#' config.inc.php
-        perl -pi -e 's#(.*password_query.*=).*#${1} "UPDATE $ENV{'VMAIL_DB'}.mailbox SET password=%c,passwordlastchange=NOW() WHERE username=%u LIMIT 1";#' config.inc.php
+        perl -pi -e 's#(.*password_db_dsn.*= )(.*)#${1}"$ENV{PHP_CONN_TYPE}://$ENV{RCM_DB_USER}:$ENV{RCM_DB_PASSWD}\@$ENV{SQL_SERVER}/$ENV{VMAIL_DB}";#' config.inc.php
+        perl -pi -e 's#(.*password_query.*=).*#${1} "UPDATE $ENV{VMAIL_DB}.mailbox SET password=%c,passwordlastchange=NOW() WHERE username=%u LIMIT 1";#' config.inc.php
         perl -pi -e 's#(.*password_hash_algorithm.*=).*#${1} "md5crypt";#' config.inc.php
         perl -pi -e 's#(.*password_hash_base64.*=).*#${1} false;#' config.inc.php
 

iRedMail/samples/conf/dovecot2-mysql.conf

-driver = mysql
-default_pass_scheme = CRYPT
-connect = host=PH_MYSQL_SERVER dbname=PH_VMAIL_DB user=PH_VMAIL_DB_BIND_USER password=PH_VMAIL_DB_BIND_PASSWD
-password_query = SELECT password FROM mailbox WHERE username='%u' AND active='1'
-user_query = SELECT \
-    CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
-    CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \
-FROM mailbox,domain \
-WHERE mailbox.username='%u' \
-    AND mailbox.domain='%d' \
-    AND mailbox.enable%Ls%Lc=1 \
-    AND mailbox.domain=domain.domain \
-    AND domain.backupmx=0 \
-    AND domain.active=1 \
-    AND mailbox.active=1

iRedMail/samples/conf/dovecot2-pgsql.conf

-driver = pgsql
-default_pass_scheme = CRYPT
-connect = host=PH_PGSQL_SERVER dbname=PH_VMAIL_DB user=PH_VMAIL_DB_BIND_USER password=PH_VMAIL_DB_BIND_PASSWD
-password_query = SELECT password FROM mailbox WHERE username='%u' AND active='1'
-user_query = SELECT \
-    CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
-    CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \
-FROM mailbox,domain \
-WHERE mailbox.username='%u' \
-    AND mailbox.domain='%d' \
-    AND mailbox.enable%Ls%Lc=1 \
-    AND mailbox.domain=domain.domain \
-    AND domain.backupmx=0 \
-    AND domain.active=1 \
-    AND mailbox.active=1

iRedMail/samples/conf/dovecot2-sql.conf

+driver = PH_SQL_DRIVER
+default_pass_scheme = CRYPT
+connect = host=PH_SQL_SERVER dbname=PH_VMAIL_DB user=PH_VMAIL_DB_BIND_USER password=PH_VMAIL_DB_BIND_PASSWD
+password_query = SELECT password FROM mailbox WHERE username='%u' AND active='1'
+user_query = SELECT \
+    CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
+    CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \
+FROM mailbox,domain \
+WHERE mailbox.username='%u' \
+    AND mailbox.domain='%d' \
+    AND mailbox.enable%Ls%Lc=1 \
+    AND mailbox.domain=domain.domain \
+    AND domain.backupmx=0 \
+    AND domain.active=1 \
+    AND mailbox.active=1
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.