Zhang Huangbin avatar Zhang Huangbin committed 0eea304

Enable Dovecot Master User by default, but no pre-defined account.

Comments (0)

Files changed (4)

iRedMail/ChangeLog

 iRedMail-0.8.4:
+    * Enable Dovecot Master User by default, but no pre-defined account.
     * New SQL columns in `vmail.mailbox` for per-user restriction, used by
       iRedAPD:
       allowedsenders, rejectedsenders, allowedrecipients, rejectedrecipients

iRedMail/conf/dovecot

 export SIEVE_RULE_FILENAME='dovecot.sieve'
 export DOVECOT_GLOBAL_SIEVE_FILE="${SIEVE_DIR}/${SIEVE_RULE_FILENAME}"
 
-# Dovecot config files
-export DOVECOT_CONF='/etc/dovecot/dovecot.conf'
-export DOVECOT_LDAP_CONF='/etc/dovecot/dovecot-ldap.conf'
-export DOVECOT_MYSQL_CONF='/etc/dovecot/dovecot-mysql.conf'
-export DOVECOT_PGSQL_CONF='/etc/dovecot/dovecot-pgsql.conf'
-export DOVECOT_REALTIME_QUOTA_CONF='/etc/dovecot/dovecot-used-quota.conf'
-export DOVECOT_SHARE_FOLDER_CONF='/etc/dovecot/dovecot-share-folder.conf'
+# Directory used to store Dovecot config files
+export DOVECOT_CONF_DIR='/etc/dovecot'
 
 # Path to Dovecot deliver agant
 export DOVECOT_DELIVER='/usr/libexec/dovecot/deliver'
 if [ X"${DISTRO}" == X"RHEL" ]; then
     if [ X"${DISTRO_VERSION}" == X"5" ]; then
         export DOVECOT_VERSION='1.2'
-        export DOVECOT_CONF='/etc/dovecot.conf'
-        export DOVECOT_LDAP_CONF='/etc/dovecot-ldap.conf'
-        export DOVECOT_MYSQL_CONF='/etc/dovecot-mysql.conf'
-        export DOVECOT_PGSQL_CONF='/etc/dovecot-pgsql.conf'
-        export DOVECOT_REALTIME_QUOTA_CONF='/etc/dovecot-used-quota.conf'
-        export DOVECOT_SHARE_FOLDER_CONF='/etc/dovecot-share-folder.conf'
+        export DOVECOT_CONF_DIR='/etc'
     fi
 elif [ X"${DISTRO}" == X"SUSE" ]; then
     export DOVECOT_DELIVER='/usr/lib/dovecot/deliver'
     export DOVECOT_DELIVER='/usr/lib/dovecot/deliver'
 
 elif [ X"${DISTRO}" == X"FREEBSD" ]; then
-    export DOVECOT_CONF='/usr/local/etc/dovecot/dovecot.conf'
-    export DOVECOT_LDAP_CONF='/usr/local/etc/dovecot/dovecot-ldap.conf'
-    export DOVECOT_MYSQL_CONF='/usr/local/etc/dovecot/dovecot-mysql.conf'
-    export DOVECOT_PGSQL_CONF='/usr/local/etc/dovecot/dovecot-pgsql.conf'
-    export DOVECOT_REALTIME_QUOTA_CONF='/usr/local/etc/dovecot/dovecot-used-quota.conf'
-    export DOVECOT_SHARE_FOLDER_CONF='/usr/local/etc/dovecot/dovecot-share-folder.conf'
+    export DOVECOT_CONF_DIR='/usr/local/etc/dovecot'
     export DOVECOT_DELIVER='/usr/local/libexec/dovecot/deliver'
 
 elif [ X"${DISTRO}" == X'OPENBSD' ]; then
 
 fi
 
+# Dovecot config files
+export DOVECOT_CONF="${DOVECOT_CONF_DIR}/dovecot.conf"
+export DOVECOT_LDAP_CONF="${DOVECOT_CONF_DIR}/dovecot-ldap.conf"
+export DOVECOT_MYSQL_CONF="${DOVECOT_CONF_DIR}/dovecot-mysql.conf"
+export DOVECOT_PGSQL_CONF="${DOVECOT_CONF_DIR}/dovecot-pgsql.conf"
+export DOVECOT_REALTIME_QUOTA_CONF="${DOVECOT_CONF_DIR}/dovecot-used-quota.conf"
+export DOVECOT_SHARE_FOLDER_CONF="${DOVECOT_CONF_DIR}/dovecot-share-folder.conf"
+export DOVECOT_MASTER_USER_PASSWORD_FILE="${DOVECOT_CONF_DIR}/dovecot-master-users-passwd"
+
 # Log & logrotate files.
 export DOVECOT_LOG_FILE='/var/log/dovecot.log'
 export SIEVE_LOG_FILE='/var/log/sieve.log'

iRedMail/functions/dovecot2.sh

         perl -pi -e 's#PH_PASSDB_DRIVER#sql#' ${DOVECOT_CONF}
     fi
 
+    # Master user.
+    perl -pi -e 's#PH_DOVECOT_MASTER_USER_PASSWORD_FILE#$ENV{DOVECOT_MASTER_USER_PASSWORD_FILE}#' ${DOVECOT_CONF}
+    touch ${DOVECOT_MASTER_USER_PASSWORD_FILE}
+
     perl -pi -e 's#PH_AUTH_SOCKET_PATH#$ENV{DOVECOT_AUTH_SOCKET_PATH}#' ${DOVECOT_CONF}
 
     # Quota.

iRedMail/samples/dovecot/dovecot2.conf

     driver = PH_PASSDB_DRIVER
 }
 
+# Master user.
+# Master users are able to log in as other users. It's also possible to
+# directly log in as any user using a master password, although this isn't
+# recommended.
+# Reference: http://wiki2.dovecot.org/Authentication/MasterUsers
+auth_master_user_separator = *
+passdb {
+    driver = passwd-file
+    args = PH_DOVECOT_MASTER_USER_PASSWORD_FILE
+    master = yes
+}
+
 plugin {
     auth_socket_path = PH_AUTH_SOCKET_PATH
 
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.