19 commits - configure.ac conf/kolab.conf Makefile.am pykolab/auth pykolab/setup pykolab.spec.in pykolab/wap_client share/Makefile.am share/templates

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Thu May 3 21:42:32 CEST 2012


 Makefile.am                                                    |    1 
 conf/kolab.conf                                                |    5 
 configure.ac                                                   |    3 
 pykolab.spec.in                                                |    6 
 pykolab/auth/ldap/__init__.py                                  |   42 +
 pykolab/setup/setup_imap.py                                    |   86 +--
 pykolab/setup/setup_ldap.py                                    |   22 
 pykolab/setup/setup_mta.py                                     |   27 +
 pykolab/setup/setup_mysql.py                                   |   44 +
 pykolab/setup/setup_roundcube.py                               |  114 ++++
 pykolab/wap_client/__init__.py                                 |    7 
 share/Makefile.am                                              |   18 
 share/templates/cyrus.conf.tpl                                 |   44 +
 share/templates/imapd.conf.tpl                                 |   50 +
 share/templates/master.cf.tpl                                  |  183 ++++++
 share/templates/roundcubemail/acl.inc.php.tpl                  |    8 
 share/templates/roundcubemail/calendar.inc.php.tpl             |   10 
 share/templates/roundcubemail/compose_addressbook.inc.php.tpl  |    4 
 share/templates/roundcubemail/db.inc.php.tpl                   |   25 
 share/templates/roundcubemail/kolab.inc.php.tpl                |   17 
 share/templates/roundcubemail/kolab_auth.inc.php.tpl           |   66 ++
 share/templates/roundcubemail/kolab_folders.inc.php.tpl        |   14 
 share/templates/roundcubemail/main.inc.php.tpl                 |  269 ++++++++++
 share/templates/roundcubemail/managesieve.inc.php.tpl          |   13 
 share/templates/roundcubemail/mimetypes.php.tpl                |   49 +
 share/templates/roundcubemail/owncloud.inc.php.tpl             |    4 
 share/templates/roundcubemail/password.inc.php.tpl             |  151 +++++
 share/templates/roundcubemail/recipient_to_contact.inc.php.tpl |    4 
 share/templates/roundcubemail/terms.html.tpl                   |   10 
 share/templates/roundcubemail/terms.inc.php.tpl                |   18 
 30 files changed, 1252 insertions(+), 62 deletions(-)

New commits:
commit 70c329e6295ace7eaf05816cd9ec2769452b7b17
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 20:42:16 2012 +0100

    Add more debugging

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 40ef7e7..4ad9d5b 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -378,7 +378,6 @@ class LDAP(pykolab.base.Base):
 
             Given an entry, returns the entry's attribute values to be set.
         """
-
         entry_dn = self.entry_dn(entry)
         entry_modifications = {}
         entry_type = self._entry_type(entry)
@@ -388,6 +387,8 @@ class LDAP(pykolab.base.Base):
         secondary_mail_attribute = self.config_get_list('mail_attributes')[1]
         want_attrs = []
 
+        log.debug(_("Applying recipient policy to %r") % (entry_dn), level=8)
+
         # See which mail attributes we would want to control.
         #
         # 'mail' is considered for primary_mail,
@@ -401,17 +402,40 @@ class LDAP(pykolab.base.Base):
         if secondary_mail == None and entry_type == 'user':
             secondary_mail = self.config_get_raw('secondary_mail')
 
+        print primary_mail, secondary_mail
         # See if the relevant mail attributes exist
-        _mail_attrs = self.config_get('mail_attributes')
+        _mail_attrs = self.config_get_list('mail_attributes')
+
+        log.debug(
+                _("Using mail attributes: %r, with primary %r and " + \
+                        "secondary %r") % (
+                                _mail_attrs,
+                                primary_mail_attribute,
+                                secondary_mail_attribute
+                            ),
+                level=8
+            )
+
         for _mail_attr in _mail_attrs:
             if not entry.has_key(_mail_attr):
+                log.debug(_("key %r not in entry") % (_mail_attr), level=8)
                 if _mail_attr == primary_mail_attribute:
+                    log.debug(_("key %r is the prim. mail attr.") % (_mail_attr), level=8)
                     if not primary_mail == None:
+                        log.debug(_("prim. mail pol. is not empty"))
                         want_attrs.append(_mail_attr)
                 elif _mail_attr == secondary_mail_attribute:
+                    log.debug(_("key %r is the sec. mail attr.") % (_mail_attr), level=8)
                     if not secondary_mail == None:
+                        log.debug(_("sec. mail pol. is not empty"))
                         want_attrs.append(_mail_attr)
 
+        log.debug(_("Attributes %r are not yet available for entry %r") % (
+                    want_attrs,
+                    entry_dn
+                ),
+                level=8
+            )
         # Also append the preferredlanguage or 'native tongue' configured
         # for the entry.
         if not entry.has_key('preferredlanguage'):
@@ -419,6 +443,12 @@ class LDAP(pykolab.base.Base):
 
         # If we wanted anything, now is the type to get it.
         if len(want_attrs) > 0:
+            log.debug(_("Attributes %r are not yet available for entry %r") % (
+                        want_attrs,
+                        entry_dn
+                    ),
+                    level=8
+                )
             attributes = self.get_entry_attributes(entry_dn, want_attrs)
 
             for attribute in attributes.keys():
@@ -612,6 +642,8 @@ class LDAP(pykolab.base.Base):
 
                         entry_modifications[secondary_mail_attribute] = secondary_mail_addresses
 
+        log.debug(_("Entry modifications list: %r") % (entry_modifications), level=8)
+
         return entry_modifications
 
     def set_entry_attribute(self, entry_id, attribute, value):
@@ -622,8 +654,6 @@ class LDAP(pykolab.base.Base):
 
         entry_dn = self.entry_dn(entry_id)
 
-        print entry_dn
-
         attrs = {}
         for attribute in attributes.keys():
             attrs[attribute.lower()] = attributes[attribute]
@@ -647,6 +677,7 @@ class LDAP(pykolab.base.Base):
                 attrlist=[
                         '*',
                         self.config_get('unique_attribute'),
+                        conf.get('cyrus-sasl', 'result_attribute'),
                         'modifytimestamp'
                     ],
                 callback=self._synchronize_callback,
@@ -1022,10 +1053,11 @@ class LDAP(pykolab.base.Base):
         result_attribute = conf.get('cyrus-sasl', 'result_attribute')
 
         rcpt_addrs = self.recipient_policy(entry)
+
         for key in rcpt_addrs.keys():
             entry[key] = rcpt_addrs[key]
 
-        cache.get_entry(self.domain, entry)
+        #cache.get_entry(self.domain, entry)
 
         self.imap.connect(domain=self.domain)
 


commit 0b652a20ed2580a8e2d35339f68fdf3a27c4f3b6
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 17:51:26 2012 +0100

    Bump pre-release

diff --git a/configure.ac b/configure.ac
index 4f5dc42..9f0bb8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_INIT([pykolab], 0.4)
-AC_SUBST([RELEASE], 0.5)
+AC_SUBST([RELEASE], 0.6)
 
 AC_CONFIG_SRCDIR(pykolab/constants.py.in)
 
diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index ee5f5ea..71c1e5d 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -140,6 +140,8 @@ ServerAdminPwd = %(admin_pass)s
             '--file=%s' % (filename)
         ]
 
+    log.info(_("Setting up 389 Directory Server"))
+
     setup_389 = subprocess.Popen(
             command,
             stdout=subprocess.PIPE,
@@ -199,6 +201,8 @@ ServerAdminPwd = %(admin_pass)s
         _input['cyrus_admin_pass'] = conf.get('cyrus-imap', 'admin_password')
         _input['kolab_service_pass'] = conf.get('ldap', 'service_bind_pw')
 
+    log.info(_("Writing out configuration to kolab.conf"))
+
     # Write out kolab configuration
     conf.command_set('kolab', 'primary_domain', _input['domain'])
     conf.command_set('ldap', 'base_dn', _input['rootdn'])
@@ -211,6 +215,8 @@ ServerAdminPwd = %(admin_pass)s
     conf.cfg_parser.write(fp)
     fp.close()
 
+    log.info(_("Inserting service users into LDAP."))
+
     # Insert service users
     auth = Auth(_input['domain'])
     auth.connect()
@@ -253,6 +259,8 @@ ServerAdminPwd = %(admin_pass)s
     # Do the actual synchronous add-operation to the ldapserver
     auth._auth.ldap.add_s(dn, ldif)
 
+    log.info(_("Writing out cn=kolab,cn=config"))
+
     dn = 'cn=kolab,cn=config'
 
     # A dict to help build the "body" of the object
@@ -274,17 +282,16 @@ ServerAdminPwd = %(admin_pass)s
 
     # TODO: Add kolab-admin role
     # TODO: Assign kolab-admin admin ACLs
-    # TODO: Add the primary domain to cn=kolab,cn=config
+
+    log.info(_("Adding domain %s to list of domains for this deployment") % (_input['domain']))
     dn = "associateddomain=%s,cn=kolab,cn=config" % (_input['domain'])
     attrs = {}
     attrs['objectclass'] = ['top','domainrelatedobject']
     attrs['associateddomain'] = '%s' % (_input['domain'])
-
     ldif = ldap.modlist.addModlist(attrs)
-
     auth._auth.ldap.add_s(dn, ldif)
 
-    # TODO: Allow no anonymous binds
+    log.info(_("Disabling anonymous binds"))
     dn = "cn=config"
     modlist = []
     modlist.append((ldap.MOD_REPLACE, "nsslapd-allow-anonymous-access", "off"))
@@ -292,18 +299,19 @@ ServerAdminPwd = %(admin_pass)s
 
     # TODO: Ensure the uid attribute is unique
     # TODO^2: Consider renaming the general "attribute uniqueness to "uid attribute uniqueness"
+    log.info(_("Enabling attribute uniqueness plugin"))
     dn = "cn=attribute uniqueness,cn=plugins,cn=config"
     modlist = []
     modlist.append((ldap.MOD_REPLACE, "nsslapd-pluginEnabled", "on"))
     auth._auth.ldap.modify_s(dn, modlist)
 
-    # TODO: Enable referential integrity plugin
+    log.info(_("Enabling referential integrity plugin"))
     dn = "cn=referential integrity postoperation,cn=plugins,cn=config"
     modlist = []
     modlist.append((ldap.MOD_REPLACE, "nsslapd-pluginEnabled", "on"))
     auth._auth.ldap.modify_s(dn, modlist)
 
-    # TODO: Enable account policy plugin
+    log.info(_("Enabling and configuring account policy plugin"))
     dn = "cn=Account Policy Plugin,cn=plugins,cn=config"
     modlist = []
     modlist.append((ldap.MOD_REPLACE, "nsslapd-pluginEnabled", "on"))
@@ -318,6 +326,7 @@ ServerAdminPwd = %(admin_pass)s
     auth._auth.ldap.modify_s(dn, modlist)
 
     # TODO: Add kolab-admin role
+    log.info(_("Adding the kolab-admin role"))
     dn = "cn=kolab-admin,%s" % (_input['rootdn'])
     attrs = {}
     attrs['description'] = "Kolab Administrator"
@@ -328,6 +337,7 @@ ServerAdminPwd = %(admin_pass)s
     auth._auth.ldap.add_s(dn, ldif)
 
     # TODO: User writeable attributes on root_dn
+    log.info(_("Setting access control to %s") % (_input['rootdn']))
     dn = _input['rootdn']
     aci = []
     aci.append('(targetattr = "homePhone || preferredDeliveryMethod || jpegPhoto || postalAddress || carLicense || userPassword || mobile || kolabAllowSMTPRecipient || displayName || kolabDelegate || description || labeledURI || homePostalAddress || postOfficeBox || registeredAddress || postalCode || photo || title || street || kolabInvitationPolicy || pager || o || l || initials || kolabAllowSMTPSender || telephoneNumber || preferredLanguage || facsimileTelephoneNumber") (version 3.0;acl "Enable self write for common attributes";allow (read,compare,search,write)(userdn = "ldap:///self");)')
diff --git a/pykolab/wap_client/__init__.py b/pykolab/wap_client/__init__.py
index 31cfb57..791ff43 100644
--- a/pykolab/wap_client/__init__.py
+++ b/pykolab/wap_client/__init__.py
@@ -7,10 +7,10 @@ sys.path.append('../..')
 
 from pykolab import utils
 
-API_HOSTNAME = "admin.klab.cc"
+API_HOSTNAME = "localhost"
 API_PORT = "80"
 API_SCHEME = "http"
-API_BASE = "/~vanmeeuwen/kolab-wap/public_html/api"
+API_BASE = "/kolab-webadmin/api"
 
 session_id = None
 
@@ -55,6 +55,9 @@ def domains_capabilities():
 def domains_list():
     return request('GET', 'domains.list')
 
+def domain_info(domain):
+    return request('GET', 'domain.info?domain=%s' % (domain))
+
 def get_group_input():
     group_types = group_types_list()
 


commit bf6b66e1038231f65cb991e190b1ae4b79cc60f0
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 17:51:04 2012 +0100

    Correct cache_entry call

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index c43700f..40ef7e7 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1025,7 +1025,7 @@ class LDAP(pykolab.base.Base):
         for key in rcpt_addrs.keys():
             entry[key] = rcpt_addrs[key]
 
-        cache.get_entry(entry)
+        cache.get_entry(self.domain, entry)
 
         self.imap.connect(domain=self.domain)
 


commit a256037e35128c30360c6a5ad5718045e1e85386
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 16:05:16 2012 +0100

    Bump pre-release

diff --git a/configure.ac b/configure.ac
index 248224a..4f5dc42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_INIT([pykolab], 0.4)
-AC_SUBST([RELEASE], 0.4)
+AC_SUBST([RELEASE], 0.5)
 
 AC_CONFIG_SRCDIR(pykolab/constants.py.in)
 


commit a8f9b177b728908dc2257f94f3e184ea69f3793a
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 16:04:55 2012 +0100

    Correct the use of mysql commands and debugging

diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py
index 14fbd22..a5ce45c 100644
--- a/pykolab/setup/setup_roundcube.py
+++ b/pykolab/setup/setup_roundcube.py
@@ -40,6 +40,12 @@ def description():
     return _("Setup Roundcube.")
 
 def execute(*args, **kw):
+    mysql_roundcube_password = utils.ask_question(
+            _("MySQL roundcube password"),
+            default=utils.generate_password(),
+            password=True
+        )
+
     rc_settings = {
             'imap_admin_login': conf.get('cyrus-imapd', 'admin_login'),
             'imap_admin_password': conf.get('cyrus-imapd', 'admin_password'),
@@ -51,7 +57,7 @@ def execute(*args, **kw):
             'ldap_service_bind_pw': conf.get('ldap', 'service_bind_pw'),
             'ldap_user_base_dn': conf.get('ldap', 'user_base_dn'),
             'ldap_user_filter': conf.get('ldap', 'user_filter'),
-            'mysql_uri': 'mysqli://root@localhost/roundcube',
+            'mysql_uri': 'mysqli://roundcube:%s@localhost/roundcube' % (mysql_roundcube_password),
         }
 
 
@@ -74,9 +80,6 @@ def execute(*args, **kw):
 
     for want_file in want_files:
         template_file = None
-
-        print "Going for", want_file
-
         if os.path.isfile('/etc/kolab/templates/roundcubemail/%s.tpl' % (want_file)):
             template_file = '/etc/kolab/templates/roundcubemail/%s.tpl' % (want_file)
         elif os.path.isfile('/usr/share/kolab/templates/roundcubemail/%s.tpl' % (want_file)):
@@ -85,11 +88,20 @@ def execute(*args, **kw):
             template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'roundcubemail', '%s.tpl' % (want_file)))
 
         if not template_file == None:
+            log.debug(_("Using template file %r") % (template_file), level=8)
             fp = open(template_file, 'r')
             template_definition = fp.read()
             fp.close()
 
             t = Template(template_definition, searchList=[rc_settings])
+            log.debug(
+                    _("Successfully compiled template %r, writing out to %r") % (
+                            template_file,
+                            '/etc/roundcubemail/%s' % (want_file)
+                        ),
+                    level=8
+                )
+
             fp = open('/etc/roundcubemail/%s' % (want_file), 'w')
             fp.write(t.__str__())
             fp.close()
@@ -105,15 +117,34 @@ def execute(*args, **kw):
             if filename.startswith('mysql') and filename.endswith('.sql'):
                 schema_files.append(os.path.join(root,filename))
 
-    subprocess.call(['service', 'mysqld', 'start'])
     p1 = subprocess.Popen(['echo', 'create database roundcube;'], stdout=subprocess.PIPE)
-    p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
+    p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout)
+    p1.stdout.close()
+    p2.communicate()
+
+    p1 = subprocess.Popen(['echo', 'GRANT ALL PRIVILEGES ON roundcube.* TO \'roundcube\'@\'localhost\' IDENTIFIED BY \'%s\';' % (mysql_roundcube_password)], stdout=subprocess.PIPE)
+    p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout)
     p1.stdout.close()
     p2.communicate()
 
     for schema_file in schema_files:
         p1 = subprocess.Popen(['cat', schema_file], stdout=subprocess.PIPE)
-        p2 = subprocess.Popen(['mysql', 'roundcube'], stdin=p1.stdout)
+        p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf', 'roundcube'], stdin=p1.stdout)
         p1.stdout.close()
         p2.communicate()
 
+    p1 = subprocess.Popen(['echo', 'FLUSH PRIVILEGES;'], stdout=subprocess.PIPE)
+    p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout)
+    p1.stdout.close()
+    p2.communicate()
+
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'start', 'httpd.service'])
+        subprocess.call(['/bin/systemctl', 'enable', 'httpd.service'])
+    elif os.path.isfile('/sbin/service'):
+        subprocess.call(['/sbin/service', 'httpd', 'start'])
+        subprocess.call(['/sbin/chkconfig', 'httpd', 'on'])
+    else:
+        log.error(_("Could not start and configure to start on boot, the " + \
+                "webserver service."))
+


commit 834589fb53548e58a02ea02dce67011a8a4a806d
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 16:04:34 2012 +0100

    Set the MySQL root password

diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index 4ef3c22..36bfe14 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -19,6 +19,7 @@
 
 import os
 import subprocess
+import tempfile
 
 import components
 
@@ -38,6 +39,42 @@ def description():
     return _("Setup MySQL.")
 
 def execute(*args, **kw):
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['/bin/systemctl', 'start', 'mysqld.service'])
+        subprocess.call(['/bin/systemctl', 'enable', 'mysqld.service'])
+    elif os.path.isfile('/sbin/service'):
+        subprocess.call(['/sbin/service', 'mysqld', 'start'])
+        subprocess.call(['/sbin/chkconfig', 'mysqld', 'on'])
+    else:
+        log.error(_("Could not start and configure to start on boot, the " + \
+                "MySQL database service."))
+
+    mysql_root_pw = utils.ask_question(
+            _("MySQL root password"),
+            default=utils.generate_password(),
+            password=True
+        )
+
+    p1 = subprocess.Popen(['echo', 'UPDATE mysql.user SET Password=PASSWORD(\'%s\') WHERE User=\'root\';' % (mysql_root_pw)], stdout=subprocess.PIPE)
+    p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
+    p1.stdout.close()
+    p2.communicate()
+
+    p1 = subprocess.Popen(['echo', 'FLUSH PRIVILEGES;'], stdout=subprocess.PIPE)
+    p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
+    p1.stdout.close()
+    p2.communicate()
+
+    data = """
+[mysql]
+user=root
+password=%s
+""" % (mysql_root_pw)
+
+    fp = open('/tmp/kolab-setup-my.cnf', 'w')
+    fp.write(data)
+    fp.close()
+
     schema_file = None
     for root, directories, filenames in os.walk('/usr/share/doc/'):
         for filename in filenames:
@@ -45,16 +82,17 @@ def execute(*args, **kw):
                 schema_file = os.path.join(root,filename)
 
     if not schema_file == None:
-        subprocess.call(['service', 'mysqld', 'start'])
         p1 = subprocess.Popen(['echo', 'create database kolab;'], stdout=subprocess.PIPE)
-        p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
+        p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout)
         p1.stdout.close()
         p2.communicate()
 
         p1 = subprocess.Popen(['cat', schema_file], stdout=subprocess.PIPE)
-        p2 = subprocess.Popen(['mysql', 'kolab'], stdin=p1.stdout)
+        p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf', 'kolab'], stdin=p1.stdout)
         p1.stdout.close()
         p2.communicate()
+
+        conf.command_set('kolab_wap', 'sql_uri', 'mysql://root:%s@localhost/kolab' % (mysql_root_pw))
     else:
         log.warning(_("Could not find the Kolab schema file"))
 


commit b5aa2db0c05416f2a3ff4fe7f580efcdcf238535
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 16:04:08 2012 +0100

    Import Template from Cheetah.Template

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 10f97f1..d806e0b 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -18,6 +18,7 @@
 #
 
 from augeas import Augeas
+from Cheetah.Template import Template
 import os
 import subprocess
 
@@ -238,7 +239,7 @@ result_attribute = mail
         template_definition = fp.read()
         fp.close()
 
-        t = Template(template_definition, searchList=[imapd_settings])
+        t = Template(template_definition, searchList=[postfix_master_settings])
         fp = open('/etc/postfix/master.cf', 'w')
         fp.write(t.__str__())
         fp.close()


commit e6718ddec843f91f44f0fff42e522685b0224547
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 16:03:36 2012 +0100

    Add kolab_wap section

diff --git a/conf/kolab.conf b/conf/kolab.conf
index 2a0eacd..c1efe67 100644
--- a/conf/kolab.conf
+++ b/conf/kolab.conf
@@ -132,6 +132,11 @@ cache_uri = mysql://user:pass@localhost/database
 cache_retention = 30
 address_search_attrs = mail, alias
 
+[kolab_wap]
+skin = default
+sql_uri = mysql://user:pass@localhost/database
+;api_url = http://localhost/kolab-webadmin/api
+
 [cyrus-imap]
 ; The URI to use to connect to IMAP. Note that pykolab itself can detect whether
 ; or not Cyrus IMAP is deployed in a Murder topology, and should be able to


commit 16293b6e69836c8853570cf1ba1b1a55cade5d39
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 15:03:44 2012 +0100

    Bump pre-release

diff --git a/configure.ac b/configure.ac
index 747eacf..248224a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_INIT([pykolab], 0.4)
-AC_SUBST([RELEASE], 0.3)
+AC_SUBST([RELEASE], 0.4)
 
 AC_CONFIG_SRCDIR(pykolab/constants.py.in)
 


commit a2905078b8e065ff61f5159fe141c180242ff302
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 15:03:12 2012 +0100

    Add apache user to the kolab group

diff --git a/pykolab.spec.in b/pykolab.spec.in
index 1452d43..9b89889 100644
--- a/pykolab.spec.in
+++ b/pykolab.spec.in
@@ -147,6 +147,8 @@ getent passwd %{kolab_user} &>/dev/null || \
     useradd -r -u %{kolab_user_id} -g %{kolab_group} -d %{_localstatedir}/lib/%{kolab_user} -s /sbin/nologin \
         -c "Kolab System Account" %{kolab_user} &>/dev/null || :
 
+gpasswd -a apache kolab >/dev/null 2>&1 || :
+
 getent group %{kolabn_group} &>/dev/null || groupadd -r %{kolabn_group} -g %{kolabn_group_id} &>/dev/null
 getent passwd %{kolabn_user} &>/dev/null || \
     useradd -r -u %{kolabn_user_id} -g %{kolabn_group} -d %{_localstatedir}/lib/%{kolabn_user} -s /sbin/nologin \


commit 4892e46650a58f4fd9f206217005316537da8e03
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 15:02:17 2012 +0100

    Correct permissions for /etc/kolab/kolab.conf

diff --git a/pykolab.spec.in b/pykolab.spec.in
index aad3e2b..1452d43 100644
--- a/pykolab.spec.in
+++ b/pykolab.spec.in
@@ -244,7 +244,7 @@ rm -rf %{buildroot}
 %files -f pykolab.lang
 %defattr(-,root,root,-)
 %doc AUTHORS ChangeLog COPYING README README.tests
-%attr(0640,root,kolab) %config(noreplace) %{_sysconfdir}/kolab/kolab.conf
+%attr(0640,kolab-n,kolab) %config(noreplace) %{_sysconfdir}/kolab/kolab.conf
 %dir %{python_sitelib}/pykolab/
 %exclude %{python_sitelib}/pykolab/telemetry.*
 %{python_sitelib}/pykolab/*.py


commit d9375d2be9348831f588b6cf8c074a6e43a592df
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 15:01:57 2012 +0100

    Add deploying master.cf

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index b3d5175..10f97f1 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -221,5 +221,31 @@ result_attribute = mail
 
     myaugeas.save()
 
+    postfix_master_settings = {
+        }
+
+    template_file = None
+
+    if os.path.isfile('/etc/kolab/templates/master.cf.tpl'):
+        template_file = '/etc/kolab/templates/master.cf.tpl'
+    elif os.path.isfile('/usr/share/kolab/templates/master.cf.tpl'):
+        template_file = '/usr/share/kolab/templates/master.cf.tpl'
+    elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'master.cf.tpl'))):
+        template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'master.cf.tpl'))
+
+    if not template_file == None:
+        fp = open(template_file, 'r')
+        template_definition = fp.read()
+        fp.close()
+
+        t = Template(template_definition, searchList=[imapd_settings])
+        fp = open('/etc/postfix/master.cf', 'w')
+        fp.write(t.__str__())
+        fp.close()
+
+    else:
+        log.error(_("Could not write out Postfix configuration file /etc/postfix/master.cf"))
+        return
+
     subprocess.call(['service', 'postfix', 'restart'])
 


commit c34d64f3b56353c2c46ffccbf423a40627fe4f3c
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 15:01:24 2012 +0100

    Add a template for master.cf

diff --git a/share/templates/master.cf.tpl b/share/templates/master.cf.tpl
new file mode 100644
index 0000000..8a94637
--- /dev/null
+++ b/share/templates/master.cf.tpl
@@ -0,0 +1,183 @@
+#
+# Postfix master process configuration file.  For details on the format
+# of the file, see the master(5) manual page (command: "man 5 master").
+#
+# Do not forget to execute "postfix reload" after editing this file.
+#
+# ==========================================================================
+# service type  private unpriv  chroot  wakeup  maxproc command + args
+#               (yes)   (yes)   (yes)   (never) (100)
+# ==========================================================================
+smtp      inet  n       -       n       -       -       smtpd
+#smtp      inet  n       -       n       -       1       postscreen
+#smtpd     pass  -       -       n       -       -       smtpd
+#dnsblog   unix  -       -       n       -       0       dnsblog
+#tlsproxy  unix  -       -       n       -       0       tlsproxy
+#submission inet n       -       n       -       -       smtpd
+#  -o syslog_name=postfix/submission
+#  -o smtpd_tls_security_level=encrypt
+#  -o smtpd_sasl_auth_enable=yes
+#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
+#  -o milter_macro_daemon_name=ORIGINATING
+#smtps     inet  n       -       n       -       -       smtpd
+#  -o syslog_name=postfix/smtps
+#  -o smtpd_tls_wrappermode=yes
+#  -o smtpd_sasl_auth_enable=yes
+#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
+#  -o milter_macro_daemon_name=ORIGINATING
+#628       inet  n       -       n       -       -       qmqpd
+pickup    fifo  n       -       n       60      1       pickup
+cleanup   unix  n       -       n       -       0       cleanup
+qmgr      fifo  n       -       n       300     1       qmgr
+#qmgr     fifo  n       -       n       300     1       oqmgr
+tlsmgr    unix  -       -       n       1000?   1       tlsmgr
+rewrite   unix  -       -       n       -       -       trivial-rewrite
+bounce    unix  -       -       n       -       0       bounce
+defer     unix  -       -       n       -       0       bounce
+trace     unix  -       -       n       -       0       bounce
+verify    unix  -       -       n       -       1       verify
+flush     unix  n       -       n       1000?   0       flush
+proxymap  unix  -       -       n       -       -       proxymap
+proxywrite unix -       -       n       -       1       proxymap
+smtp      unix  -       -       n       -       -       smtp
+relay     unix  -       -       n       -       -       smtp
+#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
+showq     unix  n       -       n       -       -       showq
+error     unix  -       -       n       -       -       error
+retry     unix  -       -       n       -       -       error
+discard   unix  -       -       n       -       -       discard
+local     unix  -       n       n       -       -       local
+virtual   unix  -       n       n       -       -       virtual
+lmtp      unix  -       -       n       -       -       lmtp
+anvil     unix  -       -       n       -       1       anvil
+scache    unix  -       -       n       -       1       scache
+#
+# ====================================================================
+# Interfaces to non-Postfix software. Be sure to examine the manual
+# pages of the non-Postfix software to find out what options it wants.
+#
+# Many of the following services use the Postfix pipe(8) delivery
+# agent.  See the pipe(8) man page for information about \${recipient}
+# and other message envelope options.
+# ====================================================================
+#
+# maildrop. See the Postfix MAILDROP_README file for details.
+# Also specify in main.cf: maildrop_destination_recipient_limit=1
+#
+#maildrop  unix  -       n       n       -       -       pipe
+#  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d \${recipient}
+#
+# ====================================================================
+#
+# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
+#
+# Specify in cyrus.conf:
+#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
+#
+# Specify in main.cf one or more of the following:
+#  mailbox_transport = lmtp:inet:localhost
+#  virtual_transport = lmtp:inet:localhost
+#
+# ====================================================================
+#
+# Cyrus 2.1.5 (Amos Gouaux)
+# Also specify in main.cf: cyrus_destination_recipient_limit=1
+#
+#cyrus     unix  -       n       n       -       -       pipe
+#  user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r \${sender} -m \${extension} \${user}
+#
+# ====================================================================
+#
+# Old example of delivery via Cyrus.
+#
+#old-cyrus unix  -       n       n       -       -       pipe
+#  flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m \${extension} \${user}
+#
+# ====================================================================
+#
+# See the Postfix UUCP_README file for configuration details.
+#
+#uucp      unix  -       n       n       -       -       pipe
+#  flags=Fqhu user=uucp argv=uux -r -n -z -a\$sender - \$nexthop!rmail (\$recipient)
+#
+# ====================================================================
+#
+# Other external delivery methods.
+#
+#ifmail    unix  -       n       n       -       -       pipe
+#  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r \$nexthop (\$recipient)
+#
+#bsmtp     unix  -       n       n       -       -       pipe
+#  flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f \$sender \$nexthop \$recipient
+#
+#scalemail-backend unix -       n       n       -       2       pipe
+#  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
+#  \${nexthop} \${user} \${extension}
+#
+#mailman   unix  -       n       n       -       -       pipe
+#  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
+#  \${nexthop} \${user}
+
+#
+# Filter email through Amavisd
+#
+smtp-amavis     unix    -   -   n   -       3   smtp
+    -o smtp_data_done_timeout=1800
+    -o disable_dns_lookups=yes
+    -o smtp_send_xforward_command=yes
+    -o max_use=20
+
+#
+# Listener to re-inject email from Amavsid into Postfix
+#
+127.0.0.1:10025 inet    n   -   n   -       100 smtpd
+    -o content_filter=
+    -o local_recipient_maps=
+    -o relay_recipient_maps=
+    -o smtpd_restriction_classes=
+    -o smtpd_client_restrictions=
+    -o smtpd_helo_restrictions=
+    -o smtpd_sender_restrictions=
+    -o smtpd_recipient_restrictions=permit_mynetworks,reject
+    -o mynetworks=127.0.0.0/8
+    -o smtpd_authorized_xforward_hosts=127.0.0.0/8
+
+#
+# Filter email through Wallace
+#
+smtp-wallace    unix    -   -   n   -       3   smtp
+    -o smtp_data_done_timeout=1800
+    -o disable_dns_lookups=yes
+    -o smtp_send_xforward_command=yes
+    -o max_use=20
+
+#
+# Listener to re-inject email from Wallace into Postfix
+#
+127.0.0.1:10027 inet    n   -   n   -       100 smtpd
+    -o content_filter=
+    -o local_recipient_maps=
+    -o relay_recipient_maps=
+    -o smtpd_restriction_classes=
+    -o smtpd_client_restrictions=
+    -o smtpd_helo_restrictions=
+    -o smtpd_sender_restrictions=
+    -o smtpd_recipient_restrictions=permit_mynetworks,reject
+    -o mynetworks=127.0.0.0/8
+    -o smtpd_authorized_xforward_hosts=127.0.0.0/8
+
+recipient_policy unix    -   n   n   -       -   spawn
+    user=kolab-n argv=/usr/libexec/postfix/kolab_smtp_access_policy --verify-recipient
+
+recipient_policy_incoming unix - n n -       -   spawn
+    user=kolab-n argv=/usr/libexec/postfix/kolab_smtp_access_policy --verify-recipient --allow-unauthenticated
+
+sender_policy    unix    -   n   n   -       -   spawn
+    user=kolab-n argv=/usr/libexec/postfix/kolab_smtp_access_policy --verify-sender
+
+sender_policy_incoming unix - n  n   -       -   spawn
+    user=kolab-n argv=/usr/libexec/postfix/kolab_smtp_access_policy --verify-sender --allow-unauthenticated
+
+submission_policy unix - n n - - spawn
+    user=kolab-n argv=/usr/libexec/postfix/kolab_smtp_access_policy --verify-sender --verify-recipient
+


commit 58f832ae12ab54acef7ed6b2576f461ecb62e29a
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 13:24:59 2012 +0100

    Bump pre-release

diff --git a/configure.ac b/configure.ac
index ab8adc8..747eacf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_INIT([pykolab], 0.4)
-AC_SUBST([RELEASE], 0.2)
+AC_SUBST([RELEASE], 0.3)
 
 AC_CONFIG_SRCDIR(pykolab/constants.py.in)
 


commit 2843fdb8bf71aef985b00592ea0f88d4e719b264
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 13:24:32 2012 +0100

    Adjust autofoo for the new templates

diff --git a/Makefile.am b/Makefile.am
index cab8db0..8eca568 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,6 +40,7 @@ SUBDIRS = \
 	po \
 	pykolab \
 	saslauthd \
+	share \
 	wallace
 
 ChangeLog: pylint
diff --git a/configure.ac b/configure.ac
index 757f2f2..ab8adc8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,7 @@ po/Makefile.in
 pykolab/constants.py
 pykolab/Makefile
 saslauthd/Makefile
+share/Makefile
 wallace/Makefile
 ])
 
diff --git a/pykolab.spec.in b/pykolab.spec.in
index 1145888..aad3e2b 100644
--- a/pykolab.spec.in
+++ b/pykolab.spec.in
@@ -282,6 +282,8 @@ rm -rf %{buildroot}
 %{_sbindir}/kolab
 %{_sbindir}/kolab-conf
 %{_sbindir}/setup-kolab
+%dir %{_sysconfdir}/kolab/templates
+%{_datadir}/kolab/templates
 %dir %{python_sitelib}/pykolab/cli/
 %{python_sitelib}/pykolab/cli/*.py
 %{python_sitelib}/pykolab/cli/*.pyc


commit c2ee99f72e5d683d1e3e88d5a0b68dca1943460d
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 13:24:11 2012 +0100

    Use the Roundcube templates in setup_roundcube

diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py
index 28d8be8..14fbd22 100644
--- a/pykolab/setup/setup_roundcube.py
+++ b/pykolab/setup/setup_roundcube.py
@@ -17,7 +17,10 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
+from Cheetah.Template import Template
 import os
+import subprocess
+import sys
 
 import components
 
@@ -31,10 +34,86 @@ log = pykolab.getLogger('pykolab.setup')
 conf = pykolab.getConf()
 
 def __init__():
-    components.register('roundcube', execute, description=description())
+    components.register('roundcube', execute, description=description(), after=['mysql','ldap'])
 
 def description():
     return _("Setup Roundcube.")
 
 def execute(*args, **kw):
-    pass
\ No newline at end of file
+    rc_settings = {
+            'imap_admin_login': conf.get('cyrus-imapd', 'admin_login'),
+            'imap_admin_password': conf.get('cyrus-imapd', 'admin_password'),
+            'ldap_base_dn': conf.get('ldap', 'base_dn'),
+            'ldap_group_base_dn': conf.get('ldap', 'group_base_dn'),
+            'ldap_group_filter': conf.get('ldap', 'group_filter'),
+            'ldap_ldap_uri': conf.get('ldap', 'ldap_uri'),
+            'ldap_service_bind_dn': conf.get('ldap', 'service_bind_dn'),
+            'ldap_service_bind_pw': conf.get('ldap', 'service_bind_pw'),
+            'ldap_user_base_dn': conf.get('ldap', 'user_base_dn'),
+            'ldap_user_filter': conf.get('ldap', 'user_filter'),
+            'mysql_uri': 'mysqli://root@localhost/roundcube',
+        }
+
+
+    want_files = [
+            'acl.inc.php',
+            'calendar.inc.php',
+            'compose_addressbook.inc.php',
+            'db.inc.php',
+            'kolab_auth.inc.php',
+            'kolab_folders.inc.php',
+            'kolab.inc.php',
+            'main.inc.php',
+            'managesieve.inc.php',
+            'owncloud.inc.php',
+            'password.inc.php',
+            'recipient_to_contact.inc.php',
+            'terms.html',
+            'terms.inc.php'
+        ]
+
+    for want_file in want_files:
+        template_file = None
+
+        print "Going for", want_file
+
+        if os.path.isfile('/etc/kolab/templates/roundcubemail/%s.tpl' % (want_file)):
+            template_file = '/etc/kolab/templates/roundcubemail/%s.tpl' % (want_file)
+        elif os.path.isfile('/usr/share/kolab/templates/roundcubemail/%s.tpl' % (want_file)):
+            template_file = '/usr/share/kolab/templates/roundcubemail/%s.tpl' % (want_file)
+        elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'roundcubemail', '%s.tpl' % (want_file)))):
+            template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'roundcubemail', '%s.tpl' % (want_file)))
+
+        if not template_file == None:
+            fp = open(template_file, 'r')
+            template_definition = fp.read()
+            fp.close()
+
+            t = Template(template_definition, searchList=[rc_settings])
+            fp = open('/etc/roundcubemail/%s' % (want_file), 'w')
+            fp.write(t.__str__())
+            fp.close()
+
+    schema_files = []
+    for root, directories, filenames in os.walk('/usr/share/doc/'):
+        for filename in filenames:
+            if filename.startswith('mysql.initial') and filename.endswith('.sql'):
+                schema_files.append(os.path.join(root,filename))
+
+    for root, directories, filenames in os.walk('/usr/share/roundcubemail/plugins/calendar/drivers/kolab/'):
+        for filename in filenames:
+            if filename.startswith('mysql') and filename.endswith('.sql'):
+                schema_files.append(os.path.join(root,filename))
+
+    subprocess.call(['service', 'mysqld', 'start'])
+    p1 = subprocess.Popen(['echo', 'create database roundcube;'], stdout=subprocess.PIPE)
+    p2 = subprocess.Popen(['mysql'], stdin=p1.stdout)
+    p1.stdout.close()
+    p2.communicate()
+
+    for schema_file in schema_files:
+        p1 = subprocess.Popen(['cat', schema_file], stdout=subprocess.PIPE)
+        p2 = subprocess.Popen(['mysql', 'roundcube'], stdin=p1.stdout)
+        p1.stdout.close()
+        p2.communicate()
+


commit 4a5c8e92a390dba483a9ff58d6b7a3005014f0b6
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 13:23:58 2012 +0100

    Add Roundcube templates

diff --git a/share/Makefile.am b/share/Makefile.am
new file mode 100644
index 0000000..047b5c2
--- /dev/null
+++ b/share/Makefile.am
@@ -0,0 +1,18 @@
+templatedir = $(datadir)/kolab/templates
+
+template_DATA = \
+	$(wildcard templates/*.tpl)
+
+rctemplatedir = $(datadir)/kolab/templates/roundcubemail
+rctemplate_DATA = \
+	$(wildcard templates/roundcubemail/*.tpl)
+
+EXTRA_DIST = \
+	$(template_DATA) \
+	$(rctemplate_DATA)
+
+install-exec-local:
+	mkdir -p \
+		$(DESTDIR)/$(sysconfdir)/kolab/templates \
+		$(DESTDIR)/$(sysconfdir)/kolab/templates/roundcubemail
+
diff --git a/share/templates/roundcubemail/acl.inc.php.tpl b/share/templates/roundcubemail/acl.inc.php.tpl
new file mode 100644
index 0000000..e056660
--- /dev/null
+++ b/share/templates/roundcubemail/acl.inc.php.tpl
@@ -0,0 +1,8 @@
+<?php
+    \$rcmail_config['acl_advanced_mode'] = false;
+    \$rcmail_config['acl_users_source'] = 'Kolab';
+    \$rcmail_config['acl_users_field'] = 'mail';
+    \$rcmail_config['acl_users_filter'] = 'objectClass=kolabInetOrgPerson';
+
+    \$rcmail_config['acl_users_source'] = 'kolab_ldap';
+?>
diff --git a/share/templates/roundcubemail/calendar.inc.php.tpl b/share/templates/roundcubemail/calendar.inc.php.tpl
new file mode 100644
index 0000000..bc871ce
--- /dev/null
+++ b/share/templates/roundcubemail/calendar.inc.php.tpl
@@ -0,0 +1,10 @@
+<?php
+    \$rcmail_config['calendar_driver'] = "kolab";
+    \$rcmail_config['calendar_default_view'] = "agendaWeek";
+    \$rcmail_config['calendar_timeslots'] = 2;
+    \$rcmail_config['calendar_first_day'] = 1;
+    \$rcmail_config['calendar_first_hour'] = 6;
+    \$rcmail_config['calendar_work_start'] = 6;
+    \$rcmail_config['calendar_work_end'] = 18;
+    \$rcmail_config['calendar_event_coloring'] = 0;
+?>
diff --git a/share/templates/roundcubemail/compose_addressbook.inc.php.tpl b/share/templates/roundcubemail/compose_addressbook.inc.php.tpl
new file mode 100644
index 0000000..31702ac
--- /dev/null
+++ b/share/templates/roundcubemail/compose_addressbook.inc.php.tpl
@@ -0,0 +1,4 @@
+<?php
+    \$rcmail_config['compose_addressbooks'] = \$rcmail_config['autocomplete_addressbooks'];
+    \$rcmail_config['compose_addressbook_mode'] = 'full';
+?>
diff --git a/share/templates/roundcubemail/db.inc.php.tpl b/share/templates/roundcubemail/db.inc.php.tpl
new file mode 100644
index 0000000..8b8db48
--- /dev/null
+++ b/share/templates/roundcubemail/db.inc.php.tpl
@@ -0,0 +1,25 @@
+<?php
+
+    \$rcmail_config = array();
+
+    \$rcmail_config['db_dsnw'] = '$mysql_uri';
+
+    \$rcmail_config['db_max_length'] = 512000;
+    \$rcmail_config['db_persistent'] = TRUE;
+    \$rcmail_config['db_table_users'] = 'users';
+    \$rcmail_config['db_table_identities'] = 'identities';
+    \$rcmail_config['db_table_contacts'] = 'contacts';
+    \$rcmail_config['db_table_contactgroups'] = 'contactgroups';
+    \$rcmail_config['db_table_contactgroupmembers'] = 'contactgroupmembers';
+    \$rcmail_config['db_table_session'] = 'session';
+    \$rcmail_config['db_table_cache'] = 'cache';
+    \$rcmail_config['db_table_messages'] = 'messages';
+    \$rcmail_config['db_sequence_users'] = 'user_ids';
+    \$rcmail_config['db_sequence_identities'] = 'identity_ids';
+    \$rcmail_config['db_sequence_contacts'] = 'contact_ids';
+    \$rcmail_config['db_sequence_contactgroups'] = 'contactgroups_ids';
+    \$rcmail_config['db_sequence_cache'] = 'cache_ids';
+    \$rcmail_config['db_sequence_messages'] = 'message_ids';
+
+
+?>
diff --git a/share/templates/roundcubemail/kolab.inc.php.tpl b/share/templates/roundcubemail/kolab.inc.php.tpl
new file mode 100644
index 0000000..c7f81a6
--- /dev/null
+++ b/share/templates/roundcubemail/kolab.inc.php.tpl
@@ -0,0 +1,17 @@
+<?php
+// Configuration for Kolab LDAP binding used by Kolab_Storage
+\$rcmail_config['kolab']['ldap']['server'] = '$ldap_ldap_uri';
+\$rcmail_config['kolab']['ldap']['basedn'] = '$ldap_base_dn';
+\$rcmail_config['kolab']['ldap']['phpdn'] = '$ldap_service_bind_dn';
+\$rcmail_config['kolab']['ldap']['phppw'] = '$ldap_service_bind_pw';
+
+\$rcmail_config['kolab']['freebusy']['server'] = 'https://' . \$_SERVER["HTTP_HOST"] . '/freebusy';
+
+\$rcmail_config['kolab']['imap']['secure'] = true;
+\$rcmail_config['kolab']['imap']['namespaces'] = array(
+    array('type' => 'personal', 'name' => '', 'delimiter' => '/'),
+    array('type' => 'other', 'name' => 'Other Users', 'delimiter' => '/'),
+    array('type' => 'shared', 'name' => 'Shared Folders', 'delimiter' => '/'),
+);
+
+?>
diff --git a/share/templates/roundcubemail/kolab_auth.inc.php.tpl b/share/templates/roundcubemail/kolab_auth.inc.php.tpl
new file mode 100644
index 0000000..41e0bc8
--- /dev/null
+++ b/share/templates/roundcubemail/kolab_auth.inc.php.tpl
@@ -0,0 +1,66 @@
+<?php
+
+// The id of the LDAP address book (which refers to the rcmail_config['ldap_public'])
+// or complete addressbook definition array.
+\$rcmail_config['kolab_auth_addressbook'] = Array(
+    'name'                      => 'Kolab Auth',
+    'hosts'                     => Array('localhost'),
+    'port'                      => 389,
+    'use_tls'                   => false,
+    'user_specific'             => false,
+    'base_dn'                   => '$ldap_user_base_dn',
+    'bind_dn'                   => '$ldap_service_bind_dn',
+    'bind_pass'                 => '$ldap_service_bind_pw',
+    'writable'                  => false,
+    'ldap_version'              => 3,       // using LDAPv3
+    'fieldmap'                  => Array(
+            'name'              => 'displayname',
+            'email'             => 'mail',
+            'email:alias'       => 'alias',
+            'role'              => 'nsroledn',
+        ),
+    'sort'                      => 'displayname',
+    'scope'                     => 'sub',
+    'filter'                    => '(objectClass=*)',
+    'fuzzy_search'              => true,
+    'sizelimit'                 => '0',
+    'timelimit'                 => '0',
+    'groups'                    => Array(
+            'base_dn'           => '$ldap_group_base_dn',
+            'filter'            => '$ldap_group_filter',
+            'object_classes'    => Array('top', 'groupOfUniqueNames'),
+            'member_attr'       => 'uniqueMember',
+        ),
+);
+
+
+// This will overwrite defined filter
+\$rcmail_config['kolab_auth_filter'] = '(&' . '$ldap_user_filter' . '(|(uid=%u)(mail=%fu)(alias=%fu)))';
+
+// Use this fields (from fieldmap configuration) to get authentication ID
+\$rcmail_config['kolab_auth_login'] = 'email';
+
+// Use this fields (from fieldmap configuration) for default identity
+\$rcmail_config['kolab_auth_name']  = 'name';
+\$rcmail_config['kolab_auth_alias'] = 'alias';
+\$rcmail_config['kolab_auth_email'] = 'email';
+
+if (preg_match('/\/helpdesk-login\//', \$_SERVER["REQUEST_URI"]) ) {
+
+    // Login and password of the admin user. Enables "Login As" feature.
+    \$rcmail_config['kolab_auth_admin_login']    = '$imap_admin_login';
+    \$rcmail_config['kolab_auth_admin_password'] = '$imap_admin_password';
+
+    \$rcmail_config['kolab_auth_auditlog'] = true;
+}
+
+// Administrative role field (from fieldmap configuration) which must be filled with
+// specified value which adds privilege to login as another user.
+\$rcmail_config['kolab_auth_role']       = 'role';
+\$rcmail_config['kolab_auth_role_value'] = 'cn=kolab-admin,$ldap_base_dn';
+
+// Administrative group name to which user must be assigned to
+// which adds privilege to login as another user.
+\$rcmail_config['kolab_auth_group'] = 'Kolab Helpdesk';
+
+?>
diff --git a/share/templates/roundcubemail/kolab_folders.inc.php.tpl b/share/templates/roundcubemail/kolab_folders.inc.php.tpl
new file mode 100644
index 0000000..b0c7ea1
--- /dev/null
+++ b/share/templates/roundcubemail/kolab_folders.inc.php.tpl
@@ -0,0 +1,14 @@
+<?php
+    \$rcmail_config['kolab_folders_configuration_default'] = 'Configuration';
+    \$rcmail_config['kolab_folders_event_default'] = 'Calendar';
+    \$rcmail_config['kolab_folders_contact_default'] = 'Contacts';
+    \$rcmail_config['kolab_folders_task_default'] = '';
+    \$rcmail_config['kolab_folders_note_default'] = '';
+    \$rcmail_config['kolab_folders_journal_default'] = '';
+    \$rcmail_config['kolab_folders_mail_inbox'] = 'INBOX';
+    \$rcmail_config['kolab_folders_mail_drafts'] = 'Drafts';
+    \$rcmail_config['kolab_folders_mail_sentitems'] = 'Sent';
+    \$rcmail_config['kolab_folders_mail_junkemail'] = 'Trash';
+    \$rcmail_config['kolab_folders_mail_outbox'] = '';
+    \$rcmail_config['kolab_folders_mail_wastebasket'] = '';
+?>
diff --git a/share/templates/roundcubemail/main.inc.php.tpl b/share/templates/roundcubemail/main.inc.php.tpl
new file mode 100644
index 0000000..030e239
--- /dev/null
+++ b/share/templates/roundcubemail/main.inc.php.tpl
@@ -0,0 +1,269 @@
+<?php
+    \$rcmail_config = array();
+
+    \$rcmail_config['imap_cache'] = 'db';
+    \$rcmail_config['messages_cache'] = 'db';
+    \$rcmail_config['force_https'] = false;
+    \$rcmail_config['use_https'] = false;
+    \$rcmail_config['login_autocomplete'] = 0;
+    \$rcmail_config['session_lifetime'] = 180;
+    \$rcmail_config['ip_check'] = false;
+    \$rcmail_config['referer_check'] = false;
+    \$rcmail_config['password_charset'] = 'ISO-8859-1';
+    \$rcmail_config['sendmail_delay'] = 0;
+    \$rcmail_config['max_recipients'] = 0;
+    \$rcmail_config['max_group_members'] = 0;
+    \$rcmail_config['useragent'] = 'Roundcube Webmail/'.RCMAIL_VERSION;
+    \$rcmail_config['include_host_config'] = false;
+    \$rcmail_config['generic_message_footer'] = '';
+    \$rcmail_config['generic_message_footer_html'] = '';
+    \$rcmail_config['http_received_header'] = true;
+    \$rcmail_config['http_received_header_encrypt'] = true;
+    \$rcmail_config['mail_header_delimiter'] = NULL;
+    \$rcmail_config['line_length'] = 72;
+    \$rcmail_config['send_format_flowed'] = true;
+    \$rcmail_config['dont_override'] = Array();
+    \$rcmail_config['identities_level'] = 0;
+    \$rcmail_config['contact_photo_size'] = 160;
+    \$rcmail_config['email_dns_check'] = false;
+
+    \$rcmail_config['message_sort_col'] = '';
+    \$rcmail_config['message_sort_order'] = 'DESC';
+    \$rcmail_config['list_cols'] = array('subject', 'status', 'from', 'date', 'size', 'flag', 'attachment');
+    \$rcmail_config['language'] = null;
+    \$rcmail_config['date_short'] = 'D H:i';
+    \$rcmail_config['date_long'] = 'd.m.Y H:i';
+    \$rcmail_config['date_today'] = 'H:i';
+    \$rcmail_config['date_format'] = 'Y-m-d';
+    \$rcmail_config['quota_zero_as_unlimited'] = false;
+    \$rcmail_config['enable_spellcheck'] = true;
+    \$rcmail_config['spellcheck_dictionary'] = true;
+    \$rcmail_config['spellcheck_engine'] = 'googie';
+    \$rcmail_config['spellcheck_uri'] = '';
+    \$rcmail_config['spellcheck_languages'] = NULL;
+    \$rcmail_config['spellcheck_ignore_caps'] = true;
+    \$rcmail_config['spellcheck_ignore_nums'] = true;
+    \$rcmail_config['spellcheck_ignore_syms'] = true;
+    \$rcmail_config['max_pagesize'] = 200;
+    \$rcmail_config['min_keep_alive'] = 60;
+    \$rcmail_config['undo_timeout'] = 10;
+    \$rcmail_config['upload_progress'] = 2;
+    \$rcmail_config['address_book_type'] = 'ldap';
+    \$rcmail_config['autocomplete_min_length'] = 3;
+    \$rcmail_config['autocomplete_threads'] = 0;
+    \$rcmail_config['autocomplete_max'] = 15;
+    \$rcmail_config['address_template'] = '{street}<br/>{locality} {zipcode}<br/>{country} {region}';
+    \$rcmail_config['default_charset'] = 'ISO-8859-1';
+    \$rcmail_config['pagesize'] = 40;
+    \$rcmail_config['timezone'] = 'auto';
+    \$rcmail_config['dst_active'] = (bool)date('I');
+    \$rcmail_config['prefer_html'] = true;
+    \$rcmail_config['show_images'] = 0;
+    \$rcmail_config['prettydate'] = true;
+    \$rcmail_config['draft_autosave'] = 300;
+    \$rcmail_config['preview_pane'] = true;
+    \$rcmail_config['preview_pane_mark_read'] = 0;
+    \$rcmail_config['logout_purge'] = false;
+    \$rcmail_config['logout_expunge'] = false;
+    \$rcmail_config['inline_images'] = true;
+    \$rcmail_config['mime_param_folding'] = 1;
+    \$rcmail_config['skip_deleted'] = true;
+    \$rcmail_config['read_when_deleted'] = true;
+    \$rcmail_config['flag_for_deletion'] = true;
+    \$rcmail_config['keep_alive'] = 300;
+    \$rcmail_config['check_all_folders'] = false;
+    \$rcmail_config['display_next'] = true;
+    \$rcmail_config['autoexpand_threads'] = 2;
+    \$rcmail_config['top_posting'] = false;
+    \$rcmail_config['strip_existing_sig'] = true;
+    \$rcmail_config['show_sig'] = 1;
+    \$rcmail_config['sig_above'] = false;
+    \$rcmail_config['force_7bit'] = false;
+    \$rcmail_config['search_mods'] = null;
+    \$rcmail_config['delete_always'] = true;
+    \$rcmail_config['mdn_requests'] = 0;
+    \$rcmail_config['mdn_default'] = false;
+    \$rcmail_config['dsn_default'] = false;
+    \$rcmail_config['reply_same_folder'] = false;
+
+    \$rcmail_config['plugins'] = array(
+            'acl',
+            'archive',
+            'calendar',
+            'compose_addressbook',
+            'http_authentication',
+            'jqueryui',
+            'kolab_addressbook',
+            'kolab_auth',
+            'kolab_core',
+            'kolab_config',
+            'kolab_folders',
+            'kolab_zpush',
+            'listcommands',
+            'managesieve',
+            'newmail_notifier',
+//            'owncloud',
+            'password',
+
+    // Depends on sieverules
+    //        'quickrules',
+
+            'redundant_attachments',
+            'terms',
+            'threading_as_default',
+            // contextmenu must be after kolab_addressbook (#444)
+            'contextmenu',
+        );
+
+
+    if (file_exists(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/main.inc.php')) {
+        include_once(RCMAIL_CONFIG_DIR . '/' . \$_SERVER["HTTP_HOST"] . '/main.inc.php');
+    }
+
+    // Re-apply mandatory settings here.
+
+    \$rcmail_config['debug_level'] = 0;
+    \$rcmail_config['devel_mode'] = false;
+    \$rcmail_config['log_driver'] = 'file';
+    \$rcmail_config['log_date_format'] = 'd-M-Y H:i:s,u O';
+    \$rcmail_config['syslog_id'] = 'roundcube';
+    \$rcmail_config['syslog_facility'] = LOG_USER;
+    \$rcmail_config['smtp_log'] = true;
+    \$rcmail_config['log_logins'] = true;
+    \$rcmail_config['log_session'] = true;
+    \$rcmail_config['sql_debug'] = true;
+    \$rcmail_config['memcache_debug'] = true;
+    \$rcmail_config['imap_debug'] = true;
+    \$rcmail_config['ldap_debug'] = true;
+    \$rcmail_config['smtp_debug'] = true;
+
+    \$rcmail_config['product_name'] = 'Kolab Groupware';
+
+    \$rcmail_config['skin'] = 'kolab';
+    \$rcmail_config['skin_logo'] = 'skins/kolab/images/kolab_logo.png';
+    \$rcmail_config['skin_include_php'] = false;
+    \$rcmail_config['mime_magic'] = '/usr/share/misc/magic';
+    \$rcmail_config['im_identify_path'] = '/usr/bin/identify';
+    \$rcmail_config['im_convert_path'] = '/usr/bin/convert';
+    \$rcmail_config['login_lc'] = true;
+    \$rcmail_config['auto_create_user'] = true;
+    \$rcmail_config['enable_installer'] = false;
+    \$rcmail_config['session_storage'] = 'db';
+    \$rcmail_config['default_port'] = 143;
+    \$rcmail_config['imap_auth_type'] = '';
+    \$rcmail_config['imap_delimiter'] = '/';
+    \$rcmail_config['imap_ns_personal'] = null;
+    \$rcmail_config['imap_ns_other']    = null;
+    \$rcmail_config['imap_ns_shared']   = null;
+    \$rcmail_config['imap_force_caps'] = false;
+    \$rcmail_config['imap_force_lsub'] = true;
+    \$rcmail_config['imap_timeout'] = 0;
+    \$rcmail_config['imap_auth_cid'] = null;
+    \$rcmail_config['imap_auth_pw'] = null;
+    \$rcmail_config['smtp_port'] = 587;
+    \$rcmail_config['smtp_user'] = '%u';
+    \$rcmail_config['smtp_pass'] = '%p';
+    \$rcmail_config['smtp_auth_type'] = '';
+    \$rcmail_config['smtp_auth_cid'] = null;
+    \$rcmail_config['smtp_auth_pw'] = null;
+    \$rcmail_config['smtp_helo_host'] = \$_SERVER["HTTP_HOST"];
+    \$rcmail_config['smtp_timeout'] = 0;
+    \$rcmail_config['log_dir'] = '/var/log/roundcubemail/';
+    \$rcmail_config['temp_dir'] = '\${_tmppath}';
+    \$rcmail_config['message_cache_lifetime'] = '10d';
+
+    \$rcmail_config['archive_mbox'] = 'Archive';
+    \$rcmail_config['drafts_mbox'] = 'Drafts';
+    \$rcmail_config['junk_mbox'] = 'Spam';
+    \$rcmail_config['sent_mbox'] = 'Sent';
+    \$rcmail_config['trash_mbox'] = 'Trash';
+    \$rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Spam', 'Trash');
+    \$rcmail_config['create_default_folders'] = true;
+    \$rcmail_config['protect_default_folders'] = true;
+
+    \$mandatory_plugins = Array(
+            'calendar',
+            'kolab_addressbook',
+            'kolab_auth',
+            'kolab_core',
+            'kolab_config',
+            'kolab_folders',
+            'password',
+            'terms'
+        );
+
+    foreach ( \$mandatory_plugins as \$num => \$plugin ) {
+        if (!in_array(\$plugin, \$rcmail_config['plugins'])) {
+                \$rcmail_config['plugins'][] = \$plugin;
+        }
+    }
+
+    \$rcmail_config['default_host'] = 'tls://localhost';
+    \$rcmail_config['smtp_server'] = 'tls://localhost';
+    \$rcmail_config['session_domain'] = '';
+    \$rcmail_config['des_key'] = 'aTMVSq6lNHg1YbcV6t59uGeZ';
+    \$rcmail_config['username_domain'] = '';
+
+    \$rcmail_config['mail_domain'] = '';
+
+    \$rcmail_config['ldap_public'] = array(
+            'kolab_addressbook' => array(
+                    'name'                      => 'Global Address Book',
+                    'hosts'                     => Array('localhost'),
+                    'port'                      => 389,
+                    'use_tls'                   => false,
+                    'base_dn'                   => '$ldap_user_base_dn',
+                    'user_specific'             => true,
+                    'bind_dn'                   => '%dn',
+                    'bind_pass'                 => '',
+                    'search_base_dn'            => '$ldap_user_base_dn',
+                    'search_bind_dn'            => '$ldap_service_bind_dn',
+                    'search_bind_pw'            => '$ldap_service_bind_pw',
+                    'search_filter'             => '(&(objectClass=inetOrgPerson)(mail=%fu))',
+                    'writable'                  => false,
+                    'LDAP_Object_Classes'       => array("top", "inetOrgPerson"),
+                    'required_fields'           => array("cn", "sn", "mail"),
+                    'LDAP_rdn'                  => 'uid',
+                    'ldap_version'              => 3,       // using LDAPv3
+                    'search_fields'             => array('displayname', 'mail'),
+                    'sort'                      => array('displayname', 'sn', 'givenname', 'cn'),
+                    'scope'                     => 'sub',
+                    'filter'                    => '(objectClass=inetOrgPerson)',
+                    'vlv'                       => false,
+                    'fuzzy_search'              => true,
+                    'sizelimit'                 => '0',
+                    'timelimit'                 => '0',
+                    'fieldmap'                  => Array(
+                            // Roundcube        => LDAP
+                            'name'              => 'displayName',
+                            'surname'           => 'sn',
+                            'firstname'         => 'givenName',
+                            'middlename'        => 'initials',
+                            'prefix'            => 'title',
+                            'email:primary'     => 'mail',
+                            'email:alias'       => 'alias',
+                            'phone:main'        => 'telephoneNumber',
+                            'phone:work'        => 'alternateTelephoneNumber',
+                            'phone:mobile'      => 'mobile',
+                            'phone:work2'       => 'blackberry',
+                            'jobtitle'          => 'title',
+                            'manager'           => 'manager',
+                            'assistant'         => 'secretary',
+                            'photo'             => 'jpegphoto'
+                        ),
+                    'groups'                    => Array(
+                            'base_dn'           => '$ldap_group_base_dn',
+                            'filter'            => '(&' . '$ldap_group_filter' . '(mail=*))',
+                            'object_classes'    => Array("top", "groupOfUniqueNames"),
+                            'member_attr'       => 'uniqueMember',
+                        ),
+                ),
+        );
+
+    \$rcmail_config['autocomplete_addressbooks'] = Array(
+            'kolab_addressbook'
+        );
+
+    \$rcmail_config['htmleditor'] = 0;
+
+?>
diff --git a/share/templates/roundcubemail/managesieve.inc.php.tpl b/share/templates/roundcubemail/managesieve.inc.php.tpl
new file mode 100644
index 0000000..c1a9fa3
--- /dev/null
+++ b/share/templates/roundcubemail/managesieve.inc.php.tpl
@@ -0,0 +1,13 @@
+<?php
+    \$rcmail_config['managesieve_port'] = 4190;
+    \$rcmail_config['managesieve_host'] = '%h';
+    \$rcmail_config['managesieve_auth_type'] = 'PLAIN';
+    \$rcmail_config['managesieve_auth_cid'] = null;
+    \$rcmail_config['managesieve_auth_pw'] = null;
+    \$rcmail_config['managesieve_usetls'] = true;
+    \$rcmail_config['managesieve_default'] = '/etc/dovecot/sieve/global';
+    \$rcmail_config['managesieve_mbox_encoding'] = 'UTF-8';
+    \$rcmail_config['managesieve_replace_delimiter'] = '';
+    \$rcmail_config['managesieve_disabled_extensions'] = array();
+    \$rcmail_config['managesieve_debug'] = true;
+?>
diff --git a/share/templates/roundcubemail/mimetypes.php.tpl b/share/templates/roundcubemail/mimetypes.php.tpl
new file mode 100644
index 0000000..d404c1f
--- /dev/null
+++ b/share/templates/roundcubemail/mimetypes.php.tpl
@@ -0,0 +1,49 @@
+<?php
+
+return array(
+  'xls' => 'application/vnd.ms-excel',
+  'xlm' => 'application/vnd.ms-excel',
+  'xla' => 'application/vnd.ms-excel',
+  'xlc' => 'application/vnd.ms-excel',
+  'xlt' => 'application/vnd.ms-excel',
+  'xlw' => 'application/vnd.ms-excel',
+  'pdf' => 'application/pdf',
+  'ppt' => 'application/vnd.ms-powerpoint',
+  'pps' => 'application/vnd.ms-powerpoint',
+  'pot' => 'application/vnd.ms-powerpoint',
+  'doc' => 'application/msword',
+  'dot' => 'application/msword',
+  'odc' => 'application/vnd.oasis.opendocument.chart',
+  'otc' => 'application/vnd.oasis.opendocument.chart-template',
+  'odf' => 'application/vnd.oasis.opendocument.formula',
+  'otf' => 'application/vnd.oasis.opendocument.formula-template',
+  'odg' => 'application/vnd.oasis.opendocument.graphics',
+  'otg' => 'application/vnd.oasis.opendocument.graphics-template',
+  'odi' => 'application/vnd.oasis.opendocument.image',
+  'oti' => 'application/vnd.oasis.opendocument.image-template',
+  'odp' => 'application/vnd.oasis.opendocument.presentation',
+  'otp' => 'application/vnd.oasis.opendocument.presentation-template',
+  'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
+  'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
+  'odt' => 'application/vnd.oasis.opendocument.text',
+  'otm' => 'application/vnd.oasis.opendocument.text-master',
+  'ott' => 'application/vnd.oasis.opendocument.text-template',
+  'oth' => 'application/vnd.oasis.opendocument.text-web',
+  'docm' => 'application/vnd.ms-word.document.macroEnabled.12',
+  'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+  'dotm' => 'application/vnd.ms-word.template.macroEnabled.12',
+  'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
+  'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
+  'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
+  'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
+  'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
+  'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
+  'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
+  'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+  'xps' => 'application/vnd.ms-xpsdocument',
+  'rar' => 'application/x-rar-compressed',
+  'vcf' => 'text/vcard',
+  'ics' => 'text/calendar',
+);
+
+?>
\ No newline at end of file
diff --git a/share/templates/roundcubemail/owncloud.inc.php.tpl b/share/templates/roundcubemail/owncloud.inc.php.tpl
new file mode 100644
index 0000000..7410a53
--- /dev/null
+++ b/share/templates/roundcubemail/owncloud.inc.php.tpl
@@ -0,0 +1,4 @@
+<?php
+    // ownCloud URL
+    \$rcmail_config['owncloud_url'] = 'http://webmail.klab.cc/owncloud';
+?>
\ No newline at end of file
diff --git a/share/templates/roundcubemail/password.inc.php.tpl b/share/templates/roundcubemail/password.inc.php.tpl
new file mode 100644
index 0000000..992ccc6
--- /dev/null
+++ b/share/templates/roundcubemail/password.inc.php.tpl
@@ -0,0 +1,151 @@
+<?php
+
+// Password Plugin options
+// -----------------------
+// A driver to use for password change. Default: "sql".
+// See README file for list of supported driver names.
+\$rcmail_config['password_driver'] = 'ldap';
+
+// Determine whether current password is required to change password.
+// Default: false.
+\$rcmail_config['password_confirm_current'] = true;
+
+// Require the new password to be a certain length.
+// set to blank to allow passwords of any length
+\$rcmail_config['password_minimum_length'] = 6;
+
+// Require the new password to contain a letter and punctuation character
+// Change to false to remove this check.
+\$rcmail_config['password_require_nonalpha'] = false;
+
+// Enables logging of password changes into logs/password
+\$rcmail_config['password_log'] = true;
+
+
+// LDAP and LDAP_SIMPLE Driver options
+// -----------------------------------
+// LDAP server name to connect to.
+// You can provide one or several hosts in an array in which case the hosts are tried from left to right.
+// Exemple: array('ldap1.exemple.com', 'ldap2.exemple.com');
+// Default: 'localhost'
+\$rcmail_config['password_ldap_host'] = 'localhost';
+
+// LDAP server port to connect to
+// Default: '389'
+\$rcmail_config['password_ldap_port'] = '389';
+
+// TLS is started after connecting
+// Using TLS for password modification is recommended.
+// Default: false
+\$rcmail_config['password_ldap_starttls'] = false;
+
+// LDAP version
+// Default: '3'
+\$rcmail_config['password_ldap_version'] = '3';
+
+// LDAP base name (root directory)
+// Exemple: 'dc=exemple,dc=com'
+\$rcmail_config['password_ldap_basedn'] = '$ldap_user_base_dn';
+
+// LDAP connection method
+// There is two connection method for changing a user's LDAP password.
+// 'user': use user credential (recommanded, require password_confirm_current=true)
+// 'admin': use admin credential (this mode require password_ldap_adminDN and password_ldap_adminPW)
+// Default: 'user'
+\$rcmail_config['password_ldap_method'] = 'user';
+
+// LDAP Admin DN
+// Used only in admin connection mode
+// Default: null
+\$rcmail_config['password_ldap_adminDN'] = null;
+
+// LDAP Admin Password
+// Used only in admin connection mode
+// Default: null
+\$rcmail_config['password_ldap_adminPW'] = null;
+
+// LDAP user DN mask
+// The user's DN is mandatory and as we only have his login,
+// we need to re-create his DN using a mask
+// '%login' will be replaced by the current roundcube user's login
+// '%name' will be replaced by the current roundcube user's name part
+// '%domain' will be replaced by the current roundcube user's domain part
+// '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
+// Exemple: 'uid=%login,ou=people,dc=exemple,dc=com'
+// \$rcmail_config['password_ldap_userDN_mask'] = 'uid=%login,ou=people,dc=exemple,dc=com';
+
+// LDAP search DN
+// The DN roundcube should bind with to find out user's DN
+// based on his login. Note that you should comment out the default
+// password_ldap_userDN_mask setting for this to take effect.
+// Use this if you cannot specify a general template for user DN with
+// password_ldap_userDN_mask. You need to perform a search based on
+// users login to find his DN instead. A common reason might be that
+// your users are placed under different ou's like engineering or
+// sales which cannot be derived from their login only.
+\$rcmail_config['password_ldap_searchDN'] = '$ldap_service_bind_dn';
+
+// LDAP search password
+// If password_ldap_searchDN is set, the password to use for
+// binding to search for user's DN. Note that you should comment out the default
+// password_ldap_userDN_mask setting for this to take effect.
+// Warning: Be sure to set approperiate permissions on this file so this password
+// is only accesible to roundcube and don't forget to restrict roundcube's access to
+// your directory as much as possible using ACLs. Should this password be compromised
+// you want to minimize the damage.
+\$rcmail_config['password_ldap_searchPW'] = '$ldap_service_bind_pw';
+
+// LDAP search base
+// If password_ldap_searchDN is set, the base to search in using the filter below.
+// Note that you should comment out the default password_ldap_userDN_mask setting
+// for this to take effect.
+\$rcmail_config['password_ldap_search_base'] = '$ldap_user_base_dn';
+
+// LDAP search filter
+// If password_ldap_searchDN is set, the filter to use when
+// searching for user's DN. Note that you should comment out the default
+// password_ldap_userDN_mask setting for this to take effect.
+// '%login' will be replaced by the current roundcube user's login
+// '%name' will be replaced by the current roundcube user's name part
+// '%domain' will be replaced by the current roundcube user's domain part
+// '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
+// Example: '(uid=%login)'
+// Example: '(&(objectClass=posixAccount)(uid=%login))'
+\$rcmail_config['password_ldap_search_filter'] = '(&(|(uid=%login)(mail=%login)(mailAlternateAddress=%login)(alias=%login))(objectclass=kolabinetorgperson))';
+
+// LDAP password hash type
+// Standard LDAP encryption type which must be one of: crypt,
+// ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, or clear.
+// Please note that most encodage types require external libraries
+// to be included in your PHP installation, see function hashPassword in drivers/ldap.php for more info.
+// Default: 'crypt'
+\$rcmail_config['password_ldap_encodage'] = 'clear';
+
+// LDAP password attribute
+// Name of the ldap's attribute used for storing user password
+// Default: 'userPassword'
+\$rcmail_config['password_ldap_pwattr'] = 'userPassword';
+
+// LDAP password force replace
+// Force LDAP replace in cases where ACL allows only replace not read
+// See http://pear.php.net/package/Net_LDAP2/docs/latest/Net_LDAP2/Net_LDAP2_Entry.html#methodreplace
+// Default: true
+\$rcmail_config['password_ldap_force_replace'] = true;
+
+// LDAP Password Last Change Date
+// Some places use an attribute to store the date of the last password change
+// The date is meassured in "days since epoch" (an integer value)
+// Whenever the password is changed, the attribute will be updated if set (e.g. shadowLastChange)
+\$rcmail_config['password_ldap_lchattr'] = '';
+
+// LDAP Samba password attribute, e.g. sambaNTPassword
+// Name of the LDAP's Samba attribute used for storing user password
+\$rcmail_config['password_ldap_samba_pwattr'] = '';
+
+// LDAP Samba Password Last Change Date attribute, e.g. sambaPwdLastSet
+// Some places use an attribute to store the date of the last password change
+// The date is meassured in "seconds since epoch" (an integer value)
+// Whenever the password is changed, the attribute will be updated if set
+\$rcmail_config['password_ldap_samba_lchattr'] = '';
+
+?>
diff --git a/share/templates/roundcubemail/recipient_to_contact.inc.php.tpl b/share/templates/roundcubemail/recipient_to_contact.inc.php.tpl
new file mode 100644
index 0000000..f3b8d2f
--- /dev/null
+++ b/share/templates/roundcubemail/recipient_to_contact.inc.php.tpl
@@ -0,0 +1,4 @@
+<?php
+    \$rcmail_config['recipient_to_contact_addressbooks'] = array();
+    \$rcmail_config['recipient_to_contact_enabled_by_default'] = true;
+?>
\ No newline at end of file
diff --git a/share/templates/roundcubemail/terms.html.tpl b/share/templates/roundcubemail/terms.html.tpl
new file mode 100644
index 0000000..4fcabc7
--- /dev/null
+++ b/share/templates/roundcubemail/terms.html.tpl
@@ -0,0 +1,10 @@
+<html>
+    <head>
+    </head>
+    <body>
+        <h1>Welcome to Kolab Groupware</h1>
+        <p>
+            Here could be your Message of the Day.
+        </p>
+    </body>
+</html>
diff --git a/share/templates/roundcubemail/terms.inc.php.tpl b/share/templates/roundcubemail/terms.inc.php.tpl
new file mode 100644
index 0000000..5faa888
--- /dev/null
+++ b/share/templates/roundcubemail/terms.inc.php.tpl
@@ -0,0 +1,18 @@
+<?php
+
+/* terms plugin */
+
+// log accepted terms
+\$rcmail_config['terms_log'] = true;
+
+// renew agreement if older than YYYY-MM-DD HH:MM:SS
+// NOTICE: Must be in past and set accordingly to server Timezone!!!
+\$rcmail_config['terms_date'] = '2011-02-24 00:00:00';
+
+// renew agreement automatically afer x days
+\$rcmail_config['terms_renew'] = 28; // 0 = never
+
+// always request terms agreement after login
+\$rcmail_config['terms_always'] = false;
+
+?>


commit 6764a33c367188f5aa0eb5e9a682797e8cc7b149
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 11:19:42 2012 +0100

    Add cyrus.conf and imapd.conf templates

diff --git a/share/templates/cyrus.conf.tpl b/share/templates/cyrus.conf.tpl
new file mode 100644
index 0000000..9d6ac0f
--- /dev/null
+++ b/share/templates/cyrus.conf.tpl
@@ -0,0 +1,44 @@
+# standard standalone server implementation
+
+START {
+    # do not delete this entry!
+    recover	cmd="ctl_cyrusdb -r"
+
+    # this is only necessary if using idled for IMAP IDLE
+    idled		cmd="idled"
+}
+
+# UNIX sockets start with a slash and are put into /var/lib/imap/sockets
+SERVICES {
+    # add or remove based on preferences
+    imap		cmd="imapd" listen="imap" prefork=5
+    imaps		cmd="imapd -s" listen="imaps" prefork=1
+    pop3		cmd="pop3d" listen="pop3" prefork=3
+    pop3s		cmd="pop3d -s" listen="pop3s" prefork=1
+    sieve		cmd="timsieved" listen="sieve" prefork=0
+
+    ptloader    cmd="ptloader" listen="/var/lib/imap/ptclient/ptsock" prefork=0
+
+    # these are only necessary if receiving/exporting usenet via NNTP
+    #nntp		cmd="nntpd" listen="nntp" prefork=3
+    #nntps		cmd="nntpd -s" listen="nntps" prefork=1
+
+    # at least one LMTP is required for delivery
+    #lmtp		cmd="lmtpd" listen="lmtp" prefork=0
+    lmtpunix	cmd="lmtpd" listen="/var/lib/imap/socket/lmtp" prefork=1
+
+    # this is only necessary if using notifications
+    notify	cmd="notifyd" listen="/var/lib/imap/socket/notify" proto="udp" prefork=1
+}
+
+EVENTS {
+    # this is required
+    checkpoint	cmd="ctl_cyrusdb -c" period=30
+
+    # this is only necessary if using duplicate delivery suppression,
+    # Sieve or NNTP
+    delprune	cmd="cyr_expire -E 3" at=0400
+
+    # this is only necessary if caching TLS sessions
+    tlsprune	cmd="tls_prune" at=0400
+}
diff --git a/share/templates/imapd.conf.tpl b/share/templates/imapd.conf.tpl
new file mode 100644
index 0000000..fc41387
--- /dev/null
+++ b/share/templates/imapd.conf.tpl
@@ -0,0 +1,50 @@
+configdirectory: /var/lib/imap
+partition-default: /var/spool/imap
+admins: $admins
+sievedir: /var/lib/imap/sieve
+sendmail: /usr/sbin/sendmail
+sasl_pwcheck_method: auxprop saslauthd
+sasl_mech_list: PLAIN LOGIN
+allowplaintext: no
+tls_cert_file: /etc/pki/cyrus-imapd/cyrus-imapd.pem
+tls_key_file: /etc/pki/cyrus-imapd/cyrus-imapd.pem
+tls_ca_file: /etc/pki/tls/certs/ca-bundle.crt
+# uncomment this if you're operating in a DSCP environment (RFC-4594)
+# qosmarking: af13
+auth_mech: pts
+pts_module: ldap
+ldap_servers: $ldap_servers
+ldap_sasl: 0
+ldap_base: $ldap_base
+ldap_bind_dn: $ldap_bind_dn
+ldap_password: $ldap_password
+ldap_filter: $ldap_filter
+ldap_user_attribute: $ldap_user_attribute
+ldap_group_base: $ldap_group_base
+ldap_group_filter: $ldap_group_filter
+ldap_group_scope: $ldap_group_scope
+ldap_member_base: $ldap_member_base
+ldap_member_method: $ldap_member_method
+ldap_member_attribute: $ldap_member_attribute
+ldap_restart: 1
+ldap_timeout: 10
+ldap_time_limit: 10
+unixhierarchysep: 1
+virtdomains: userid
+annotation_definitions: /etc/imapd.annotations.conf
+sieve_extensions: fileinto reject vacation imapflags notify envelope include relational regex subaddress copy
+allowallsubscribe: 0
+allowusermoves: 1
+altnamespace: 1
+hashimapspool: 1
+anysievefolder: 1
+fulldirhash: 0
+sieveusehomedir: 0
+sieve_allowreferrals: 0
+lmtp_downcase_rcpt: 1
+lmtp_fuzzy_mailbox_match: 1
+username_tolower: 1
+deletedprefix: DELETED
+delete_mode: delayed
+expunge_mode: delayed
+flushseenstate: 1


commit b152dd98b3a53ae3b91474e36eea50145a2b0649
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu May 3 11:19:12 2012 +0100

    Use templates for as long as Augeas does not ship lenses for /etc/cyrus.conf / /etc/imapd.conf

diff --git a/pykolab/setup/setup_imap.py b/pykolab/setup/setup_imap.py
index a7c4810..df676e7 100644
--- a/pykolab/setup/setup_imap.py
+++ b/pykolab/setup/setup_imap.py
@@ -17,7 +17,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
-from augeas import Augeas
+from Cheetah.Template import Template
 import os
 import subprocess
 
@@ -44,12 +44,7 @@ def execute(*args, **kw):
     """
 
     imapd_settings = {
-            "sasl_pwcheck_method": "auxprop saslauthd",
-            "sasl_mech_list": "PLAIN LOGIN",
-            "auth_mech": "pts",
-            "pts_module": "ldap",
             "ldap_servers": conf.get('ldap', 'ldap_uri'),
-            "ldap_sasl": "0",
             "ldap_base": conf.get('ldap', 'base_dn'),
             "ldap_bind_dn": conf.get('ldap', 'service_bind_dn'),
             "ldap_password": conf.get('ldap', 'service_bind_pw'),
@@ -61,49 +56,56 @@ def execute(*args, **kw):
             "ldap_member_base": conf.get('ldap','user_base_dn'),
             "ldap_member_method": "attribute",
             "ldap_member_attribute": "nsrole",
-            "ldap_restart": "1",
-            "ldap_timeout": "10",
-            "ldap_time_limit": "10",
-            "unixhierarchysep": "1",
-            "virt_domains": "userid",
             "admins": conf.get('cyrus-imap', 'admin_login'),
-            "annotation_definitions": "/etc/imapd.annotations.conf",
-            "sieve_extensions": "fileinto reject vacation imapflags notify envelope include relational regex subaddress copy",
-            "allowallsubscribe": "0",
-            "allowusermoves": "1",
-            "altnamespace": "1",
-            "hashimapspool": "1",
-            "anysievefolder": "1",
-            "fulldirhash": "0",
-            "sieveusehomedir": "0",
-            "sieve_allowreferrals": "0",
-            "lmtp_downcase_rcpt": "1",
-            "lmtp_fuzzy_mailbox_match": "1",
-            "username_tolower": "1",
-            #"normalizeuid": "1",
-            "deletedprefix": "DELETED",
-            "delete_mode": "delayed",
-            "expunge_mode": "delayed",
-            "flushseenstate": "1",
-            "virtdomains": "userid",
         }
 
-    myaugeas = Augeas()
+    template_file = None
 
-    setting_base = '/files/etc/imapd.conf/'
-    for setting_key in imapd_settings.keys():
-        setting = os.path.join(setting_base,setting_key)
-        current_value = myaugeas.get(setting)
+    if os.path.isfile('/etc/kolab/templates/imapd.conf.tpl'):
+        template_file = '/etc/kolab/templates/imapd.conf.tpl'
+    elif os.path.isfile('/usr/share/kolab/templates/imapd.conf.tpl'):
+        template_file = '/usr/share/kolab/templates/imapd.conf.tpl'
+    elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'imapd.conf.tpl'))):
+        template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'imapd.conf.tpl'))
 
-        if current_value == None:
-            insert_paths = myaugeas.match('/files/etc/imapd.conf/*')
-            insert_path = insert_paths[(len(insert_paths)-1)]
-            myaugeas.insert(insert_path, setting_key, False)
+    if not template_file == None:
+        fp = open(template_file, 'r')
+        template_definition = fp.read()
+        fp.close()
 
-        log.debug(_("Setting key %r to %r") % (setting_key, imapd_settings[setting_key]), level=8)
-        myaugeas.set(setting, imapd_settings[setting_key])
+        t = Template(template_definition, searchList=[imapd_settings])
+        fp = open('/etc/imapd.conf', 'w')
+        fp.write(t.__str__())
+        fp.close()
 
-    myaugeas.save()
+    else:
+        log.error(_("Could not write out Cyrus IMAP configuration file /etc/imapd.conf"))
+        return
+
+    cyrus_settings = {}
+
+    template_file = None
+
+    if os.path.isfile('/etc/kolab/templates/cyrus.conf.tpl'):
+        template_file = '/etc/kolab/templates/cyrus.conf.tpl'
+    elif os.path.isfile('/usr/share/kolab/templates/cyrus.conf.tpl'):
+        template_file = '/usr/share/kolab/templates/cyrus.conf.tpl'
+    elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'cyrus.conf.tpl'))):
+        template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'cyrus.conf.tpl'))
+
+    if not template_file == None:
+        fp = open(template_file, 'r')
+        template_definition = fp.read()
+        fp.close()
+
+        t = Template(template_definition, searchList=[cyrus_settings])
+        fp = open('/etc/cyrus.conf', 'w')
+        fp.write(t.__str__())
+        fp.close()
+
+    else:
+        log.error(_("Could not write out Cyrus IMAP configuration file /etc/imapd.conf"))
+        return
 
     annotations = [
             "/vendor/horde/share-params,mailbox,string,backend,value.shared value.priv,a",





More information about the commits mailing list