Commits

Zhang Huangbin committed 36b45e2

[ldap] Add new attribute/value required by Dovecot-2 share folder:
enabledService=lib-storage. Thanks moreni <fmoreni _at_ simtrack.com.br> for the report.
[mysql & pgsql] Incorrect maildir path while using Postfix built-in
'virtual' as transport.

Comments (0)

Files changed (9)

extra/update/updateLDAPValues_080_to_081.py

+#!/usr/bin/env python
+# encoding: utf-8
+
+# Author:   Zhang Huangbin <zhb _at_ iredmail.org>
+# Purpose:  Add enabledService=doveadm for all mail users.
+#           Required by command doveadm which provided by Dovecot-2.0.
+# Date:     2012-04-19
+
+import sys
+import ldap
+
+# Note:
+#   * bind_dn must have write privilege on LDAP server.
+uri = 'ldap://127.0.0.1:389'
+basedn = 'o=domains,dc=example,dc=com'
+bind_dn = 'cn=Manager,dc=example,dc=com'
+bind_pw = 'passwd'
+
+# Initialize LDAP connection.
+print >> sys.stderr, "* Connecting to LDAP server: %s" % uri
+conn = ldap.initialize(uri=uri, trace_level=0,)
+conn.bind_s(bind_dn, bind_pw)
+
+# Get all mail users.
+print >> sys.stderr, "* Get all mail accounts..."
+allUsers = conn.search_s(
+        basedn,
+        ldap.SCOPE_SUBTREE,
+        "(objectClass=mailUser)",
+        ['mail', 'enabledService'],
+        )
+
+total = len(allUsers)
+print >> sys.stderr, "* Total %d user(s)." % (total)
+
+# Values of 'enabledService' which need to be added.
+services = ['lib-storage']
+
+# Counter.
+count = 1
+
+for user in allUsers:
+    (dn, entry) = user
+    mail = entry['mail'][0]
+    if not 'enabledService' in entry:
+        continue
+
+    enabledService = entry['enabledService']
+    # Get missing values.
+    values = [str(s).lower() for s in services if s not in enabledService]
+
+    mod_attrs = []
+
+    # Add missing values of 'enabledService'.
+    if len(values) > 0:
+        mod_attrs += [(ldap.MOD_ADD, 'enabledService', values)]
+
+    # Update.
+    if len(mod_attrs) > 0:
+        print >> sys.stderr, "* (%d of %d) Updating user: %s" % (count, total, mail)
+        conn.modify_s(dn, mod_attrs)
+    else:
+        print >> sys.stderr, "* (%d of %d) [SKIP] No update required: %s" % (count, total, mail)
+
+    count += 1
+
+# Unbind connection.
+print >> sys.stderr, "* Unbind LDAP server."
+conn.unbind()
+
+print >> sys.stderr, "* Update completed."

iRedMail/ChangeLog

     * Enforce connections over https in Roundcube.
     * Fix incorrect MySQL user password and databases in MySQL backup script.
     * Fixed:
+        + [ldap] Add new attribute/value required by Dovecot-2 share folder:
+          enabledService=lib-storage.
+          Thanks moreni <fmoreni _at_ simtrack.com.br> for the report.
+        + [mysql & pgsql] Incorrect maildir path while using Postfix built-in
+          'virtual' as transport.
         + [ldap] Don't require enabledService=smtp for maillist members.
           Thanks rain6966 <uenuan@gmail> for the report.
 

iRedMail/conf/openldap

 export LDAP_SERVICE_AWSTATS='awstats'
 export LDAP_SERVICE_SHADOW_ADDRESS='shadowaddress'
 export LDAP_SERVICE_DISPLAYED_IN_ADDRBOOK='displayedInGlobalAddressBook'
+export LDAP_SERVICE_LIB_STORAGE='lib-storage'
 
 # Shared attributes.
 export LDAP_ATTR_ACCOUNT_STATUS='accountStatus'

iRedMail/functions/clamav.sh

     perl -pi -e 's/^(TCPSocket .*)/#${1}/' ${CLAMD_CONF}
     perl -pi -e 's#^(TCPAddr ).*#${1} $ENV{CLAMD_LISTEN_ADDR}#' ${CLAMD_CONF}
 
-    # Set log file
-    perl -pi -e 's#^(LogFile ).*#${1}$ENV{CLAMD_LOGFILE}#' ${CLAMD_CONF}
-    perl -pi -e 's/^#(LogFile ).*/${1}$ENV{CLAMD_LOGFILE}/' ${CLAMD_CONF}
+    # Disable log file
+    perl -pi -e 's/^(LogFile.*/#${1}/' ${CLAMD_CONF}
 
     # Set CLAMD_LOCAL_SOCKET
     perl -pi -e 's/^(LocalSocket ).*/${1}$ENV{CLAMD_LOCAL_SOCKET}/' ${CLAMD_CONF}

iRedMail/functions/openldap.sh

 ${LDAP_ENABLED_SERVICE}: ${LDAP_SERVICE_SIEVES}
 ${LDAP_ENABLED_SERVICE}: ${LDAP_SERVICE_DISPLAYED_IN_ADDRBOOK}
 ${LDAP_ENABLED_SERVICE}: ${LDAP_SERVICE_SHADOW_ADDRESS}
+${LDAP_ENABLED_SERVICE}: ${LDAP_SERVICE_LIB_STORAGE}
 EOF
 
     ldapadd -x -D "${LDAP_ROOTDN}" -w "${LDAP_ROOTPW}" -f ${LDAP_INIT_LDIF} >/dev/null

iRedMail/functions/postfix.sh

 hosts       = ${MYSQL_SERVER}
 port        = ${MYSQL_SERVER_PORT}
 dbname      = ${VMAIL_DB}
-query       = SELECT CONCAT(mailbox.storagenode, '/', mailbox.maildir) FROM mailbox,domain WHERE mailbox.username='%s' AND mailbox.active=1 AND mailbox.enabledeliver=1 AND domain.domain = mailbox.domain AND domain.active=1
+query       = SELECT CONCAT(mailbox.storagenode, '/', mailbox.maildir, '/Maildir/') FROM mailbox,domain WHERE mailbox.username='%s' AND mailbox.active=1 AND mailbox.enabledeliver=1 AND domain.domain = mailbox.domain AND domain.active=1
 EOF
 
     cat > ${mysql_virtual_alias_maps_cf} <<EOF
 hosts       = ${PGSQL_SERVER}
 port        = ${PGSQL_SERVER_PORT}
 dbname      = ${VMAIL_DB}
-query       = SELECT (mailbox.storagenode || '/' || mailbox.maildir) FROM mailbox,domain WHERE mailbox.username='%s' AND mailbox.active=1 AND mailbox.enabledeliver=1 AND domain.domain = mailbox.domain AND domain.active=1
+query       = SELECT (mailbox.storagenode || '/' || mailbox.maildir || '/Maildir/') FROM mailbox,domain WHERE mailbox.username='%s' AND mailbox.active=1 AND mailbox.enabledeliver=1 AND domain.domain = mailbox.domain AND domain.active=1
 EOF
 
     cat > ${pgsql_virtual_alias_maps_cf} <<EOF

iRedMail/samples/sa.local.cf

 use_bayes          1
 bayes_auto_learn   1
 bayes_auto_expire  1
-#
-# Store bayesian data in SQL database
-# For MySQL
+
+# Store bayesian data in MySQL
 #bayes_store_module Mail::SpamAssassin::BayesStore::MySQL
 #bayes_sql_dsn      DBI:mysql:database:sql_server:sql_port
-# For PostgreSQL
+
+# Store bayesian data in MySQL
 #bayes_store_module Mail::SpamAssassin::BayesStore::PgSQL
 #bayes_sql_dsn      DBI:Pg:database:sql_server:sql_port
 #

iRedMail/tools/create_mail_user_OpenLDAP.py

                                 'deliver', 'lda', 'forward', 'senderbcc', 'recipientbcc',
                                  'managesieve', 'managesievesecured',
                                  'sieve', 'sievesecured', 'shadowaddress',
-                                'displayedInGlobalAddressBook', ]),
+                                'displayedInGlobalAddressBook', 'lib-storage', ]),
         ('memberOfGroup',       groups),
         ]
 

iRedMail/tools/create_mail_user_OpenLDAP.sh

 enabledService: recipientbcc
 enabledService: shadowaddress
 enabledService: displayedInGlobalAddressBook
+enabledService: lib-storage
 ${LDIF_PUREFTPD_USER}
 EOF
 }