Commits

Zhang Huangbin committed e872cf2

Code cleanup.

Comments (0)

Files changed (6)

iRedMail/ChangeLog

 iRedMail-0.7.4:
-    * Enable two sample dovecot sieve filters: Move spam to Junk, Vacation.
-      Both are disabled by default.
+    * Enable two sample dovecot sieve filters in Roundcube webmail:
+      Move spam to Junk, Vacation. Both are disabled by default.
     * Store realtime mailbox quota in separate SQL table in MySQL backend.
     * It now works on Ubuntu 11.10, openSUSE 12.1.
     * SPF verification is now enabled by default.

iRedMail/conf/dovecot

 
 # Do not starts with dot (.).
 export SIEVE_RULE_FILENAME='dovecot.sieve'
-export DOVECOT_GLOBAL_SIEVE_FILE="/etc/dovecot/${SIEVE_RULE_FILENAME}"
+export DOVECOT_GLOBAL_SIEVE_FILE="${SIEVE_DIR}/${SIEVE_RULE_FILENAME}"
 
 if [ X"${DISTRO}" == X"RHEL" ]; then
     export DOVECOT_VERSION='2'
         export DOVECOT_VERSION='1.2'
         export DOVECOT_CONF='/etc/dovecot.conf'
         export DOVECOT_LDAP_CONF='/etc/dovecot-ldap.conf'
-        export DOVECOT_GLOBAL_SIEVE_FILE="/etc/${SIEVE_RULE_FILENAME}"
         export DOVECOT_MYSQL_CONF='/etc/dovecot-mysql.conf'
         export DOVECOT_REALTIME_QUOTA_CONF='/etc/dovecot-used-quota.conf'
         export DOVECOT_SHARE_FOLDER_CONF='/etc/dovecot-share-folder.conf'
     export DOVECOT_MYSQL_CONF='/usr/local/etc/dovecot-mysql.conf'
     export DOVECOT_REALTIME_QUOTA_CONF='/usr/local/etc/dovecot-used-quota.conf'
     export DOVECOT_SHARE_FOLDER_CONF='/usr/local/etc/dovecot-share-folder.conf'
-    export DOVECOT_GLOBAL_SIEVE_FILE="/usr/local/etc/${SIEVE_RULE_FILENAME}"
     export DOVECOT_DELIVER='/usr/local/libexec/dovecot/deliver'
 fi
 

iRedMail/conf/roundcube

     export RCM_HTTPD_ROOT_SYMBOL_LINK="${HTTPD_SERVERROOT}/roundcubemail"
 fi
 
+# Sample sieve filter template
+export RCM_SIEVE_SAMPLE_FILE="${RCM_HTTPD_ROOT}/config/dovecot.sieve"
+
 # Syslog log file.
 export RCM_LOGFILE="${MAILLOG}"
 

iRedMail/functions/dovecot1.sh

     # ---- IMAP shared folder ----
 
     ECHO_DEBUG "Copy sample sieve global filter rule file: ${DOVECOT_GLOBAL_SIEVE_FILE}.sample."
-    cp -f ${SAMPLE_DIR}/dovecot.sieve ${DOVECOT_GLOBAL_SIEVE_FILE}
-    chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${DOVECOT_GLOBAL_SIEVE_FILE}
-    chmod 0555 ${DOVECOT_GLOBAL_SIEVE_FILE}
+    cp -f ${SAMPLE_DIR}/dovecot.sieve ${DOVECOT_GLOBAL_SIEVE_FILE}.sample
+    chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${DOVECOT_GLOBAL_SIEVE_FILE}.sample
+    chmod 0500 ${DOVECOT_GLOBAL_SIEVE_FILE}.sample
 
     ECHO_DEBUG "Create dovecot log file: ${DOVECOT_LOG_FILE}, ${SIEVE_LOG_FILE}."
     touch ${DOVECOT_LOG_FILE} ${SIEVE_LOG_FILE}

iRedMail/functions/dovecot2.sh

     # ---- IMAP shared folder ----
 
     ECHO_DEBUG "Copy sample sieve global filter rule file: ${DOVECOT_GLOBAL_SIEVE_FILE}.sample."
-    cp -f ${SAMPLE_DIR}/dovecot.sieve ${DOVECOT_GLOBAL_SIEVE_FILE}
-    chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${DOVECOT_GLOBAL_SIEVE_FILE}
-    chmod 0555 ${DOVECOT_GLOBAL_SIEVE_FILE}
+    cp -f ${SAMPLE_DIR}/dovecot.sieve ${DOVECOT_GLOBAL_SIEVE_FILE}.sample
+    chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${DOVECOT_GLOBAL_SIEVE_FILE}.sample
+    chmod 0500 ${DOVECOT_GLOBAL_SIEVE_FILE}.sample
 
     ECHO_DEBUG "Create dovecot log file: ${DOVECOT_LOG_FILE}, ${SIEVE_LOG_FILE}."
     touch ${DOVECOT_LOG_FILE} ${SIEVE_LOG_FILE}

iRedMail/functions/roundcubemail.sh

     cd ${RCM_HTTPD_ROOT}/config/
     cp -f db.inc.php.dist db.inc.php
     cp -f main.inc.php.dist main.inc.php
-    chown ${HTTPD_USER}:${HTTPD_GROUP} db.inc.php main.inc.php
-    chmod 0640 db.inc.php main.inc.php
+    cp -f ${SAMPLE_DIR}/dovecot.sieve ${RCM_SIEVE_SAMPLE_FILE}
+    chown ${HTTPD_USER}:${HTTPD_GROUP} db.inc.php main.inc.php ${RCM_SIEVE_SAMPLE_FILE}
+    chmod 0640 db.inc.php main.inc.php ${RCM_SIEVE_SAMPLE_FILE}
 
     echo 'export status_rcm_install="DONE"' >> ${STATUS_FILE}
 }
     cd ${RCM_HTTPD_ROOT}/config/ && \
     perl -pi -e 's#(.*rcmail_config.*plugins.*=.*array\()(.*)#${1}"managesieve",${2}#' main.inc.php
 
-    export MANAGESIEVE_BINDADDR MANAGESIEVE_PORT
+    export MANAGESIEVE_BINDADDR MANAGESIEVE_PORT RCM_SIEVE_SAMPLE_FILE
     cd ${RCM_HTTPD_ROOT}/plugins/managesieve/ && \
     cp config.inc.php.dist config.inc.php && \
-    perl -pi -e 's#(.*managesieve_port.*=).*#${1} $ENV{'MANAGESIEVE_PORT'};#' config.inc.php
-    perl -pi -e 's#(.*managesieve_host.*=).*#${1} "$ENV{'MANAGESIEVE_BINDADDR'}";#' config.inc.php
+    perl -pi -e 's#(.*managesieve_port.*=).*#${1} $ENV{MANAGESIEVE_PORT};#' config.inc.php
+    perl -pi -e 's#(.*managesieve_host.*=).*#${1} "$ENV{MANAGESIEVE_BINDADDR}";#' config.inc.php
     perl -pi -e 's#(.*managesieve_usetls.*=).*#${1} false;#' config.inc.php
-    perl -pi -e 's#(.*managesieve_default.*=).*#${1} "$ENV{DOVECOT_GLOBAL_SIEVE_FILE}";#' config.inc.php
+    perl -pi -e 's#(.*managesieve_default.*=).*#${1} "$ENV{RCM_SIEVE_SAMPLE_FILE}";#' config.inc.php
 
     echo 'export status_rcm_plugin_managesieve="DONE"' >> ${STATUS_FILE}
 }
 
         # Use 'md5crypt' instead of 'ssha', because SSHA requires PHP module
         # 'mhash' which may be unavailable on some supported distros.
-        perl -pi -e 's#(.*password_ldap_encodage.*=).*#${1} "ssha";#' config.inc.php
+        perl -pi -e 's#(.*password_ldap_encodage.*=).*#${1} "md5crypt";#' config.inc.php
 
         perl -pi -e 's#(.*password_ldap_pwattr.*=).*#${1} "userPassword";#' config.inc.php
         perl -pi -e 's#(.*password_ldap_force_replace.*=).*#${1} false;#' config.inc.php