Commits

Zhang Huangbin committed f1e3474

* It now works on Linux Mint 12 (code name: lisa).
* Fixed: Two Dovecot config files are world readable: used_quota.conf, share-folder.conf.
Thanks Martin Kuchar for the report.
* Add share folder support within Dovecot 2.

Comments (0)

Files changed (8)

 iRedMail-0.8.0-beta3:
+    * It now works on Linux Mint 12 (code name: lisa).
+    * Add share folder support within Dovecot 2.
     * Fixed:
         + Two Dovecot config files are world readable: used_quota.conf,
           share-folder.conf.

iRedMail/conf/dovecot

 export DOVECOT_QUOTA_WARNING_SCRIPT='/usr/local/bin/dovecot-quota-warning.sh'
 export DOVECOT_REALTIME_QUOTA_TABLE='used_quota'
 export DOVECOT_SHARE_FOLDER_DB_TABLE='share_folder'
+
 if [ X"${BACKEND}" == X"OPENLDAP" -o X"${BACKEND}" == X"MYSQL" ]; then
     export DOVECOT_SHARE_FOLDER_SQLTYPE='mysql'
     export DOVECOT_REALTIME_QUOTA_SQLTYPE='mysql'
         export DISTRO_VERSION="$(grep 'VERSION' /etc/SuSE-release | awk '{print $3}')"
 
         # SuSE code name.
+        #   - 12.1: asparagus
+        #   - 11.4: celadon
         #   - 11.3:
-        #   - 11.4: celadon
         export DISTRO_CODENAME="$(grep 'CODENAME' /etc/SuSE-release | awk '{print $3}' |tr [A-Z] [a-z])"
 
     elif [ -f /etc/lsb-release ]; then
         #   - 10.10: maverick
         #   - 11.04: natty
         #   - 11.10: oneiric
+        export DISTRO_ID="$(grep 'DISTRIB_ID' /etc/lsb-release | awk -F'=' '{print $2}')"
         export DISTRO_VERSION="$(grep 'DISTRIB_RELEASE' /etc/lsb-release | awk -F'=' '{print $2}')"
         export DISTRO_CODENAME="$(grep 'DISTRIB_CODENAME' /etc/lsb-release | awk -F'=' '{print $2}')"
 
             export DISTRO_CODENAME='lucid'
         fi
 
+        # Linux Mint support
+        # - 12 (lisa) based on Ubuntu 11.10
+        if [ X"${DISTRO_CODENAME}" == X"lisa" ]; then
+            export DISTRO_CODENAME="oneiric"
+        fi
+
     elif [ -f /etc/debian_version ]; then
         # Debian
         export DISTRO='DEBIAN'

iRedMail/functions/amavisd.sh

     # Add postfix alias for user: amavis.
     if [ ! -z ${MAIL_ALIAS_ROOT} ]; then
         echo "${AMAVISD_SYS_USER}: root" >> ${POSTFIX_FILE_ALIASES}
-        postalias hash:${POSTFIX_FILE_ALIASES} 2>/dev/null
+        postalias hash:${POSTFIX_FILE_ALIASES} &>/dev/null
     else
         :
     fi

iRedMail/functions/apache_php.sh

         :
     fi
 
-    # FreeBSD
     if [ X"${DISTRO}" == X'GENTOO' ]; then
         # Change 'Deny from all' to 'Allow from all'.
         sed -i '/Order deny,allow/,/Deny from all/s#Deny\ from\ all#Allow\ from\ all#' ${HTTPD_CONF_DIR}/00_default_settings.conf
 Disallow: /iredadmin
 EOF
 
+    echo "${HTTPD_USER}: root" >> ${POSTFIX_FILE_ALIASES}
+    postalias hash:${POSTFIX_FILE_ALIASES} &>/dev/null
     # --------------------------
     # PHP Setting.
     # --------------------------

iRedMail/functions/dovecot1.sh

 }
 EOF
 
+        chown ${DOVECOT_USER}:${DOVECOT_GROUP} ${DOVECOT_REALTIME_QUOTA_CONF}
         chmod 0500 ${DOVECOT_REALTIME_QUOTA_CONF}
 
         # Create MySQL database ${IREDADMIN_DB_USER} and table 'used_quota'
 }
 EOF
 
+        chown ${DOVECOT_USER}:${DOVECOT_GROUP} ${DOVECOT_SHARE_FOLDER_CONF}
         chmod 0500 ${DOVECOT_SHARE_FOLDER_CONF}
 
         # Create MySQL database ${IREDADMIN_DB_USER} and table 'share_folder'

iRedMail/functions/dovecot2.sh

     perl -pi -e 's#PH_SSL_CERT#<$ENV{SSL_CERT_FILE}#' ${DOVECOT_CONF}
     perl -pi -e 's#PH_SSL_KEY#<$ENV{SSL_KEY_FILE}#' ${DOVECOT_CONF}
 
+
     # Generate dovecot quota warning script.
     mkdir -p $(dirname ${DOVECOT_QUOTA_WARNING_SCRIPT}) 2>/dev/null
 
 
     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}
+connect = host=${SQL_SERVER} dbname=${realtime_quota_db_name} user=${realtime_quota_db_user} password=${realtime_quota_db_passwd}
 map {
     pattern = priv/quota/storage
     table = ${DOVECOT_REALTIME_QUOTA_TABLE}
 }
 EOF
 
+    chown ${DOVECOT_USER}:${DOVECOT_GROUP} ${DOVECOT_REALTIME_QUOTA_CONF}
     chmod 0500 ${DOVECOT_REALTIME_QUOTA_CONF}
 
     # Create MySQL database ${IREDADMIN_DB_USER} and table 'used_quota'
         share_folder_db_passwd="${VMAIL_DB_ADMIN_PASSWD}"
     fi
 
-    # Enable dict quota in dovecot.
-    cat >> ${DOVECOT_CONF} <<EOF
-namespace private {
-    separator = /
-    prefix =
-    #location defaults to mail_location.
-    inbox = yes
-}
-
-namespace shared {
-    separator = /
-    prefix = Shared/%%u/
-    location = maildir:/%%Lh/Maildir/:INDEX=/%%Lh/Maildir/Shared/%%u
-    # this namespace should handle its own subscriptions or not.
-    subscriptions = yes
-    list = children
-}
-
-plugin {
-    acl = vfile
-    acl_shared_dict = proxy::acl
-}
-dict {
-    acl = ${DOVECOT_SHARE_FOLDER_SQLTYPE}:${DOVECOT_SHARE_FOLDER_CONF}
-}
-EOF
+    # ACL and share folder
+    perl -pi -e 's#PH_DOVECOT_SHARE_FOLDER_SQLTYPE#$ENV{DOVECOT_SHARE_FOLDER_SQLTYPE}#' ${DOVECOT_CONF}
+    perl -pi -e 's#PH_DOVECOT_SHARE_FOLDER_CONF#$ENV{DOVECOT_SHARE_FOLDER_CONF}#' ${DOVECOT_CONF}
 
     # SQL lookup for share folder.
     cat > ${DOVECOT_SHARE_FOLDER_CONF} <<EOF
     }
 }
 EOF
+
+    chown ${DOVECOT_USER}:${DOVECOT_GROUP} ${DOVECOT_SHARE_FOLDER_CONF}
     chmod 0500 ${DOVECOT_SHARE_FOLDER_CONF}
 
     # Create MySQL database ${IREDADMIN_DB_USER} and table 'share_folder'

iRedMail/samples/conf/dovecot2.conf

     expire = Trash 7 Trash/* 7 Junk 30
     expire_dict = proxy::expire
 
+    # ACL and share folder
+    acl = vfile
+    acl_shared_dict = proxy::acl
+
     # Pigeonhole managesieve service.
     # Reference: http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration
     # Per-user sieve settings.
 dict {
     expire = db:/var/lib/dovecot/expire/expire.db
     quotadict = PH_DOVECOT_REALTIME_QUOTA_SQLTYPE:PH_DOVECOT_REALTIME_QUOTA_CONF
+    acl = PH_DOVECOT_SHARE_FOLDER_SQLTYPE:PH_DOVECOT_SHARE_FOLDER_CONF
 }
 
 protocol lda {
     pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
     pop3_uidl_format = %08Xu%08Xv
 }
+namespace {
+    type = private
+    separator = /
+    prefix =
+    #location defaults to mail_location.
+    inbox = yes
+}
+
+namespace {
+    type = shared
+    separator = /
+    prefix = Shared/%%u/
+    location = maildir:/%%Lh/Maildir/:INDEX=/%%Lh/Maildir/Shared/%%u
+    # this namespace should handle its own subscriptions or not.
+    subscriptions = yes
+    list = children
+}