Zhang Huangbin avatar Zhang Huangbin committed 63fa297

Enable sample dovecot sieve rules, will be shown in Roundcube webmail by default.

Comments (0)

Files changed (4)

iRedMail/conf/dovecot

 # Default quota type: maildir, dict:user::proxy::quotadict (quotadict).
 export DOVECOT_QUOTA_TYPE='dict:user::proxy::quotadict'
 
+# Do not starts with dot (.).
+export SIEVE_RULE_FILENAME='dovecot.sieve'
+export DOVECOT_GLOBAL_SIEVE_FILE="/etc/dovecot/${SIEVE_RULE_FILENAME}"
+
 # A symbol link to global sieve rule file.
-export DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL='/etc/dovecot/dovecot.sieve'
+export DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL="${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_SYMBOL='/etc/dovecot.sieve'
+        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_GLOBAL_SIEVE_FILE_SYMBOL='/usr/local/etc/dovecot.sieve'
     export DOVECOT_DELIVER='/usr/local/libexec/dovecot/deliver'
 fi
 export DOVECOT_BIN='/usr/sbin/dovecot'
 export DOVECOT_SIEVEC='/usr/libexec/dovecot/sievec'
 
-# Do not starts with dot (.).
-export SIEVE_RULE_FILENAME='dovecot.sieve'
-export GLOBAL_SIEVE_FILE="${SIEVE_DIR}/${SIEVE_RULE_FILENAME}"
-
 # Dovecot plugin: Expire.
 # NOTE: dict process currently runs as root, so this file will be owned as root.
 export DOVECOT_EXPIRE_DICT_BDB='/var/lib/dovecot/expire/expire.db'

iRedMail/functions/dovecot1.sh

     postmaster_address = root
     auth_socket_path = ${DOVECOT_AUTH_SOCKET_PATH}
     mail_plugins = ${DOVECOT_LDA_PLUGINS}
-    sieve_global_path = ${GLOBAL_SIEVE_FILE}
+    sieve_global_path = ${DOVECOT_GLOBAL_SIEVE_FILE}
     log_path = ${SIEVE_LOG_FILE}
 }
 
     fi
     # ---- IMAP shared folder ----
 
-    ECHO_DEBUG "Copy sample sieve global filter rule file: ${GLOBAL_SIEVE_FILE}.sample."
-    cp -f ${SAMPLE_DIR}/dovecot.sieve ${GLOBAL_SIEVE_FILE}
-    chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${GLOBAL_SIEVE_FILE}
-    chmod 0500 ${GLOBAL_SIEVE_FILE}
+    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 0500 ${DOVECOT_GLOBAL_SIEVE_FILE}
 
     # Create symbol link of global sieve rule.
-    rm -f ${DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL} &>/dev/null
-    ln -s ${GLOBAL_SIEVE_FILE} ${DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL}
+    if [ X"${DOVECOT_GLOBAL_SIEVE_FILE}" != X"${DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL}" ]; then
+        rm -f ${DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL} &>/dev/null
+        ln -s ${DOVECOT_GLOBAL_SIEVE_FILE} ${DOVECOT_GLOBAL_SIEVE_FILE_SYMBOL}
+    fi
 
     ECHO_DEBUG "Create dovecot log file: ${DOVECOT_LOG_FILE}, ${SIEVE_LOG_FILE}."
     touch ${DOVECOT_LOG_FILE} ${SIEVE_LOG_FILE}
         - ${DOVECOT_LOG_FILE}
         - ${SIEVE_LOG_FILE}
     * See also:
-        - ${GLOBAL_SIEVE_FILE}
+        - ${DOVECOT_GLOBAL_SIEVE_FILE}
 
 EOF
 

iRedMail/functions/dovecot2.sh

     # Sieve.
     perl -pi -e 's#PH_SIEVE_DIR#$ENV{SIEVE_DIR}#' ${DOVECOT_CONF}
     perl -pi -e 's#PH_SIEVE_RULE_FILENAME#$ENV{SIEVE_RULE_FILENAME}#' ${DOVECOT_CONF}
-    perl -pi -e 's#PH_GLOBAL_SIEVE_FILE#$ENV{GLOBAL_SIEVE_FILE}#' ${DOVECOT_CONF}
+    perl -pi -e 's#PH_GLOBAL_SIEVE_FILE#$ENV{DOVECOT_GLOBAL_SIEVE_FILE}#' ${DOVECOT_CONF}
 
     # SSL.
     perl -pi -e 's#PH_ENABLE_SSL#yes#' ${DOVECOT_CONF}
     fi
     # ---- IMAP shared folder ----
 
-    ECHO_DEBUG "Copy sample sieve global filter rule file: ${GLOBAL_SIEVE_FILE}.sample."
-    cp -f ${SAMPLE_DIR}/dovecot.sieve ${GLOBAL_SIEVE_FILE}.sample
-    chown ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${GLOBAL_SIEVE_FILE}.sample
-    chmod 0500 ${GLOBAL_SIEVE_FILE}.sample
+    ECHO_DEBUG "Copy sample sieve global filter rule file: ${DOVECOT_GLOBAL_SIEVE_FILE}.sample."
+    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}
         - ${DOVECOT_LOG_FILE}
         - ${SIEVE_LOG_FILE}
     * See also:
-        - ${GLOBAL_SIEVE_FILE}
+        - ${DOVECOT_GLOBAL_SIEVE_FILE}
 
 EOF
 

iRedMail/functions/managesieve.sh

 plugin {
     # If the user has no personal active script (i.e. if the file 
     # indicated in sieve= does not exist), use this one:
-    #sieve_global_path = ${GLOBAL_SIEVE_FILE}
+    #sieve_global_path = ${DOVECOT_GLOBAL_SIEVE_FILE}
 
     # The include extension fetches the :global scripts from this 
     # directory.
     # (with the proper .sieve extension) are executed. The order of
     # execution is determined by the file names, using a normal 8bit
     # per-character comparison.
-    #sieve_before = ${GLOBAL_SIEVE_FILE}
+    #sieve_before = ${DOVECOT_GLOBAL_SIEVE_FILE}
 
     # Identical to sieve_before, only the specified scripts are
     # executed after the user's script (only when keep is still in
     # effect!).
-    #sieve_after = ${GLOBAL_SIEVE_FILE}
+    #sieve_after = ${DOVECOT_GLOBAL_SIEVE_FILE}
 
     # Location of the active script. When ManageSieve is used this is actually
     # a symlink pointing to the active script in the sieve storage directory.
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.