9 commits - conf/kolab.conf pykolab/auth pykolab/cli pykolab/setup pykolab.spec.in pykolab/utils.py setup-kolab.py

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Wed May 16 14:36:36 CEST 2012


 conf/kolab.conf                  |    7 ++-
 pykolab.spec.in                  |    2 
 pykolab/auth/ldap/__init__.py    |    4 -
 pykolab/cli/cmd_add_domain.py    |   88 +++++++++++++++++++++++++++++++++++++++
 pykolab/setup/setup_mta.py       |   18 +++++++
 pykolab/setup/setup_roundcube.py |    2 
 pykolab/utils.py                 |   38 +++++++---------
 setup-kolab.py                   |    2 
 8 files changed, 133 insertions(+), 28 deletions(-)

New commits:
commit 1bb67edadd665af35366a07d60d61ef966c15d22
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed May 16 13:29:16 2012 +0100

    24 characters is not the same as 25 characters (#715, #770)

diff --git a/pykolab/setup/setup_roundcube.py b/pykolab/setup/setup_roundcube.py
index 30a2aa9..ad23d6c 100644
--- a/pykolab/setup/setup_roundcube.py
+++ b/pykolab/setup/setup_roundcube.py
@@ -68,7 +68,7 @@ def execute(*args, **kw):
                             hashlib.md5("%s" % random.random()).digest().encode("base64"),
                             hashlib.md5("%s" % random.random()).digest().encode("base64")
                         )
-                )[:25],
+                )[:24],
 
             'imap_admin_login': conf.get('cyrus-imapd', 'admin_login'),
             'imap_admin_password': conf.get('cyrus-imapd', 'admin_password'),


commit 095c5745e6d51508dd91848d2d9b85276a8cfeb3
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 16:17:39 2012 +0100

    Do not print entry_id and entry_dn for get_entry_attributes() (#775)

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 08b4e66..d1ece6f 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -277,9 +277,9 @@ class LDAP(pykolab.base.Base):
             Get multiple attributes for an entry.
         """
 
-        print entry_id
+        #print entry_id
         entry_dn = self.entry_dn(entry_id)
-        print entry_dn
+        #print entry_dn
 
         _search = self.ldap.search_ext(
                 entry_dn,


commit a71fdfdd17cdbf1e9ef17e074ab27407ed627b5e
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 16:08:05 2012 +0100

    Make sure all services are started and configured to start on boot (#772)

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 93db617..c86e57c 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -251,5 +251,21 @@ result_attribute = mail
 
     subprocess.call(['/etc/pki/tls/certs/make-dummy-cert', '/etc/pki/tls/private/localhost.pem'])
 
-    subprocess.call(['service', 'postfix', 'restart'])
+    if os.path.isfile('/bin/systemctl'):
+        subprocess.call(['systemctl', 'restart', 'postfix.service'])
+        subprocess.call(['systemctl', 'enable', 'postfix.service'])
+        subprocess.call(['systemctl', 'restart', 'amavisd.service'])
+        subprocess.call(['systemctl', 'enable', 'amavisd.service'])
+        subprocess.call(['systemctl', 'restart', 'clamd.amavisd.service'])
+        subprocess.call(['systemctl', 'enable', 'clamd.amavisd.service'])
+    elif os.path.isfile('/sbin/service'):
+        subprocess.call(['service', 'postfix', 'restart'])
+        subprocess.call(['chkconfig', 'postfix', 'on'])
+        subprocess.call(['service', 'amavisd', 'restart'])
+        subprocess.call(['chkconfig', 'amavisd', 'on'])
+        subprocess.call(['service', 'clamd.amavisd', 'restart'])
+        subprocess.call(['chkconfig', 'clamd.amavisd', 'on'])
+    else:
+        log.error(_("Could not start and configure to start on boot, the " + \
+                "postfix, clamav.amavisd and amavisd services."))
 


commit 479cbbfa20736b44d5bcf75b0ccf150801738d1e
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 12:39:12 2012 +0100

    Include a copy of the default kolab.conf as documentation

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


commit f34bb8e3e0b37fa5f815af559a948a11b3890b24
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 12:35:10 2012 +0100

    Set by default the ssl_verify_peer and ssl_verify_host settings to false (#751, #c19)

diff --git a/conf/kolab.conf b/conf/kolab.conf
index 84511a1..03bfd06 100644
--- a/conf/kolab.conf
+++ b/conf/kolab.conf
@@ -142,8 +142,11 @@ sql_uri = mysql://user:pass@localhost/database
 
 ; Configure SSL should you want to have the web admin panel (client interface)
 ; use the API over HTTPS.
-;ssl_verify_peer = false
-;ssl_verify_host = false
+;
+; By default, httpd and coconspirators are setup to use self-signed certificates,
+; so the following two settings are set to false by default.
+ssl_verify_peer = false
+ssl_verify_host = false
 ;ssl_cafile = /path/to/ca/file
 ;ssl_capath = /path/to/ca/dir
 ;ssl_local_cert = /path/to/local/cert


commit 76981d741b1ae89b93dad85e32223d88ac3a82ab
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 09:09:29 2012 +0100

    Add command add-domain

diff --git a/pykolab/cli/cmd_add_domain.py b/pykolab/cli/cmd_add_domain.py
new file mode 100644
index 0000000..f3d5d97
--- /dev/null
+++ b/pykolab/cli/cmd_add_domain.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
+#
+# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 3 or, at your option, any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+import sys
+
+import commands
+
+import pykolab
+
+from pykolab import utils
+from pykolab.translate import _
+
+log = pykolab.getLogger('pykolab.cli')
+conf = pykolab.getConf()
+
+def __init__():
+    commands.register('add_domain', execute, description=description())
+
+def cli_options():
+    my_option_group = conf.add_cli_parser_option_group(_("CLI Options"))
+    my_option_group.add_option(
+            '--alias-for',
+            dest    = "parent_domain",
+            action  = "store",
+            default = None,
+            help    = _("Add domain as alias for DOMAIN"),
+            metavar = "DOMAIN",
+        )
+
+def description():
+    return _("Add a new domain or domain alias.")
+
+def execute(*args, **kw):
+    from pykolab import wap_client
+
+    # Use uber-administrative privileges
+    username = conf.get('ldap', 'bind_dn')
+    if username == None:
+        log.error(_("Could not find credentials with sufficient permissions" + \
+                "to add a domain name space."))
+
+        sys.exit(1)
+
+    wap_client.authenticate(username=username)
+    domains = wap_client.domains_list()
+
+    dna = conf.get('ldap', 'domain_name_attribute')
+
+    if not conf.parent_domain == None:
+        parent_found = False
+        if isinstance(domains['list'], dict):
+            for _domain in domains['list'].keys():
+                if parent_found:
+                    continue
+
+                if isinstance(domains['list'][_domain][dna], basestring):
+                    if conf.parent_domain == domains['list'][_domain][dna]:
+                        parent_found = True
+                elif isinstance(domains['list'][_domain], list):
+                    if conf.parent_domain in domains['list'][_domain][dna]:
+                        parent_found = True
+
+        if not parent_found:
+            log.error(_("Invalid parent domain"))
+            sys.exit(1)
+
+    try:
+        domain = conf.cli_args.pop(0)
+    except IndexError, errmsg:
+        domain = utils.ask_question(_("Domain name"))
+
+    wap_client.domain_add(domain, conf.parent_domain)


commit 00388ab258f74bc0bdfab72560a6505851471334
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 09:08:56 2012 +0100

    Prepand our paths rather then appending them

diff --git a/setup-kolab.py b/setup-kolab.py
index 34818a7..7794e99 100755
--- a/setup-kolab.py
+++ b/setup-kolab.py
@@ -24,7 +24,7 @@ import os
 import sys
 
 # For development purposes
-sys.path.extend(['.', '..'])
+sys.path = ['.'] + sys.path
 
 import pykolab
 


commit e72a028338f99ffde982f583cdc2f506c974d534
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 09:08:21 2012 +0100

    Fix confirmation dialog
    Fix ask_question() with confirm=True

diff --git a/pykolab/utils.py b/pykolab/utils.py
index 0da1664..f0fa30a 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -52,15 +52,9 @@ def ask_question(question, default="", password=False, confirm=False):
             answer_confirmed = False
             while not answer_confirmed:
                 if password:
-                    if default == "" or default == None:
-                        answer = getpass.getpass(_("Confirm %s: ") % (question))
-                    else:
-                        answer = getpass.getpass(_("Confirm %s [%s]: ") % (question, default))
+                    answer_confirm = getpass.getpass(_("Confirm %s: ") % (question))
                 else:
-                    if default == "" or default == None:
-                        answer = raw_input(_("Confirm %s: ") % (question))
-                    else:
-                        answer = raw_input(_("Confirm %s [%s]: ") % (question, default))
+                    answer_confirm = raw_input(_("Confirm %s: ") % (question))
 
                 if not answer_confirm == answer:
                     print >> sys.stderr, _("Incorrect confirmation. " + \
@@ -68,14 +62,14 @@ def ask_question(question, default="", password=False, confirm=False):
 
                     if password:
                         if default == "" or default == None:
-                            answer = getpass.getpass(_("Confirm %s: ") % (question))
+                            answer = getpass.getpass(_("%s: ") % (question))
                         else:
-                            answer = getpass.getpass(_("Confirm %s [%s]: ") % (question, default))
+                            answer = getpass.getpass(_("%s [%s]: ") % (question, default))
                     else:
                         if default == "" or default == None:
-                            answer = raw_input(_("Confirm %s: ") % (question))
+                            answer = raw_input(_("%s: ") % (question))
                         else:
-                            answer = raw_input(_("Confirm %s [%s]: ") % (question, default))
+                            answer = raw_input(_("%s [%s]: ") % (question, default))
 
                 else:
                     answer_confirmed = True
@@ -91,12 +85,14 @@ def ask_confirmation(question, default="y", all_inclusive_no=True):
         and a "yes" or "no" parsing that can either require an explicit, full
         "yes" or "no", or take the default or any YyNn answer.
     """
+    default_answer = None
+
     if default in [ "y", "Y" ]:
         default_answer = True
         default_no = "n"
         default_yes = "Y"
     elif default in [ "n", "N" ]:
-        default_answer = True
+        default_answer = False
         default_no = "N"
         default_yes = "y"
     else:
@@ -110,20 +106,20 @@ def ask_confirmation(question, default="y", all_inclusive_no=True):
         answer = raw_input("%s [%s/%s]: " % (question,default_yes,default_no))
         # Parse answer and set back to False if not appropriate
         if all_inclusive_no:
-            if not answer in [ "y", "Y", "yes" ]:
-                return False
-            else:
-                return True
-        else:
-            if answer in [ "y", "Y", "yes" ]:
+            if answer == "" and not default_answer == None:
+                return default_answer
+            elif answer in [ "y", "Y", "yes" ]:
                 return True
             elif answer in [ "n", "N", "no" ]:
                 return False
-            elif answer == "" and not default_answer == None:
-                return default_answer
             else:
                 answer = False
                 print >> sys.stderr, _("Please answer 'yes' or 'no'.")
+        else:
+            if not answer in [ "y", "Y", "yes" ]:
+                return False
+            else:
+                return True
 
 def generate_password():
     import subprocess


commit a0a600b02e705b5f822ca3434e9934f4c99ad963
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue May 15 09:07:20 2012 +0100

    Require cyrus-sasl-plain (#763)

diff --git a/pykolab.spec.in b/pykolab.spec.in
index 8f8e56c..0903d47 100644
--- a/pykolab.spec.in
+++ b/pykolab.spec.in
@@ -68,6 +68,7 @@ Summary:            Kolab SASL Authentication Daemon
 Group:              Applications/System
 BuildRequires:      intltool, gettext, python
 Requires:           %{name} = %{version}-%{release}
+Requires:           cyrus-sasl-plain
 
 %description -n kolab-saslauthd
 Kolab SASL Authentication Daemon for multi-domain, multi-authn database deployments





More information about the commits mailing list