pykolab/setup

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Wed Apr 24 16:57:39 CEST 2013


 pykolab/setup/setup_ldap.py |   64 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 51 insertions(+), 13 deletions(-)

New commits:
commit 64661dba08874578b4fa91b86ba7ceee9f669726
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 24 16:50:21 2013 +0200

    Add --without-ldap and --with-openldap
    
        These command-line options are now available to setup-kolab.
    
        --without-ldap will simply skip the entire step setting up LDAP.
    
        --with-openldap will set configuration options compatible with
        OpenLDAP (as opposed to Netscape-based directory services),
        including but not limited to 'unique_attribute' ('nsuniqueid'
        for Netscape-based directory services, 'entryuuid' for
        OpenLDAP).
    
        It is assumed deployments that use OpenLDAP:
    
            - Set up OpenLDAP themselves,
    
            - Provide, within this LDAP tree, a bind DN for Kolab to
              use, that is authorized to use syncrepl,
    
            - Provide the equivalent of a cyrus-admin login account,
    
            - Set the ldap_uri, base_dn, bind_dn, bind_pw,
              service_bind_dn, service_bind_pw, user_base_dn,
              group_base_dn, resource_base_dn, sharedfolder_base_dn,
              and other options in the [ldap] section in a file other
              then /etc/kolab/kolab.conf, to then specify this file
              to setup-kolab with the "-c" command-line option. This is
              seeding setup-kolab with an answer file.
    
            - Modify imapd.conf to not use roles for group authorization,
    
            - Are careful using the Kolab Web Administration Panel
              because of its dependency on effectiveRights controls.

diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index 2650fa8..de371b4 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -60,15 +60,48 @@ def cli_options():
             help    = _("Allow anonymous binds (default: no).")
         )
 
+    ldap_group.add_option(
+            "--without-ldap",
+            dest    = "without_ldap",
+            action  = "store_true",
+            default = False,
+            help    = _("Skip setting up the LDAP server.")
+        )
+
+    ldap_group.add_option(
+            "--with-openldap",
+            dest    = "with_openldap",
+            action  = "store_true",
+            default = False,
+            help    = _("Setup configuration for OpenLDAP compatibility.")
+        )
+
 def description():
     return _("Setup LDAP.")
 
 def execute(*args, **kw):
+
     ask_questions = True
 
     if not conf.config_file == conf.defaults.config_file:
         ask_questions = False
 
+    if conf.without_ldap:
+        print >> sys.stderr, _("Skipping setup of LDAP, as specified")
+        return
+
+    _input = {}
+
+    if conf.with_openldap:
+
+        conf.command_set('ldap', 'unique_attribute', 'entryuuid')
+
+        fp = open(conf.defaults.config_file, "w+")
+        conf.cfg_parser.write(fp)
+        fp.close()
+
+        return
+
     # Pre-execution checks
     for path, directories, files in os.walk('/etc/dirsrv/'):
         for direct in directories:
@@ -150,19 +183,7 @@ def execute(*args, **kw):
 
     # TODO: Verify the user and group exist.
 
-    # TODO: This takes the system fqdn, domainname and hostname, rather then
-    # the desired fqdn, domainname and hostname.
-    #
-    # TODO^2: This should be confirmed.
-
-    if conf.fqdn:
-        _input['fqdn'] = conf.fqdn
-        _input['hostname'] = conf.fqdn.split('.')[0]
-        _input['domain'] = '.'.join(conf.fqdn.split('.')[1:])
-    else:
-        _input['fqdn'] = fqdn
-        _input['hostname'] = hostname.split('.')[0]
-        _input['domain'] = domainname
+    _input = request_kolab_domain(_input)
 
     _input['nodotdomain'] = _input['domain'].replace('.','_')
 
@@ -608,3 +629,20 @@ ServerAdminPwd = %(admin_pass)s
     else:
         log.error(_("Could not start and configure to start on boot, the " + \
                 "directory server admin service."))
+
+def request_kolab_domain(_input):
+    # TODO: This takes the system fqdn, domainname and hostname, rather then
+    # the desired fqdn, domainname and hostname.
+    #
+    # TODO^2: This should be confirmed.
+
+    if conf.fqdn:
+        _input['fqdn'] = conf.fqdn
+        _input['hostname'] = conf.fqdn.split('.')[0]
+        _input['domain'] = '.'.join(conf.fqdn.split('.')[1:])
+    else:
+        _input['fqdn'] = fqdn
+        _input['hostname'] = hostname.split('.')[0]
+        _input['domain'] = domainname
+
+





More information about the commits mailing list