Projects
Kolab:16:TestingLinked
pykolab
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 45
View file
0001-Fix-settting-up-new-MySQL-servers-with-root-password.patch
Added
@@ -0,0 +1,300 @@ +From 0515774829661080010492539335f2f84967ddea Mon Sep 17 00:00:00 2001 +From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> +Date: Mon, 29 Jul 2019 13:35:10 +0200 +Subject: PATCH 1/2 Fix settting up new MySQL servers with root passwords + rather than auth sockets. + +--- + pykolab/setup/setup_mysql.py | 197 ++++++++++++++++++++++++----------- + 1 file changed, 137 insertions(+), 60 deletions(-) + +diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py +index 2b3e17c..ec9e6d4 100644 +--- a/pykolab/setup/setup_mysql.py ++++ b/pykolab/setup/setup_mysql.py +@@ -33,30 +33,34 @@ from pykolab.translate import _ + log = pykolab.getLogger('pykolab.setup') + conf = pykolab.getConf() + ++ + def __init__(): + components.register('mysql', execute, description=description()) + ++ + def cli_options(): + ldap_group = conf.add_cli_parser_option_group(_("MySQL Options")) + + ldap_group.add_option( +- "--mysqlserver", +- dest = "mysqlserver", +- action = "store", +- help = _("Specify whether to use an (existing) or (new) MySQL server.") +- ) ++ "--mysqlserver", ++ dest="mysqlserver", ++ action="store", ++ help=_("Specify whether to use an (existing) or (new) MySQL server.") ++ ) ++ + + def description(): + return _("Setup MySQL.") + +-def execute(*args, **kw): ++ ++def execute(*args, **kw): # noqa: C901 + + socket_paths = +- "/var/lib/mysql/mysql.sock", +- "/var/run/mysqld/mysqld.sock", +- "/var/run/mysql/mysql.sock", +- "/var/run/mysqld/mysqld.pid" +- ++ "/var/lib/mysql/mysql.sock", ++ "/var/run/mysqld/mysqld.sock", ++ "/var/run/mysql/mysql.sock", ++ "/var/run/mysqld/mysqld.pid" ++ + + # on CentOS7, there is MariaDB instead of MySQL + mysqlservice = 'mysqld.service' +@@ -73,7 +77,7 @@ def execute(*args, **kw): + elif os.path.isfile('/sbin/service'): + subprocess.call('/sbin/service', 'mysqld', 'restart') + elif os.path.isfile('/usr/sbin/service'): +- subprocess.call('/usr/sbin/service','mysql','restart') ++ subprocess.call('/usr/sbin/service', 'mysql', 'restart') + else: + log.error(_("Could not start the MySQL database service.")) + +@@ -84,8 +88,9 @@ def execute(*args, **kw): + elif os.path.isfile('/usr/sbin/update-rc.d'): + subprocess.call('/usr/sbin/update-rc.d', 'mysql', 'defaults') + else: +- log.error(_("Could not configure to start on boot, the " + \ +- "MySQL database service.")) ++ log.error( ++ _("Could not configure to start on boot, the MySQL database service.") ++ ) + + log.info(_("Waiting for at most 30 seconds for MySQL/MariaDB to settle...")) + max_wait = 30 +@@ -99,9 +104,9 @@ def execute(*args, **kw): + time.sleep(1) + + options = { +- 1: "Existing MySQL server (with root password already set).", +- 2: "New MySQL server (needs to be initialized)." +- } ++ 1: "Existing MySQL server (with root password already set).", ++ 2: "New MySQL server (needs to be initialized)." ++ } + + answer = 0 + if len(x for x in socket_paths if os.path.exists(x)) > 0: +@@ -115,37 +120,76 @@ def execute(*args, **kw): + + if answer == "1" or answer == 1: + print >> sys.stderr, utils.multiline_message( +- _(""" +- Please supply the root password for MySQL, so we can set +- up user accounts for other components that use MySQL. +- """) +- ) ++ _(""" ++ Please supply the root password for MySQL, so we can set ++ up user accounts for other components that use MySQL. ++ """) ++ ) + + mysql_root_password = utils.ask_question( +- _("MySQL root password"), +- password=True +- ) ++ _("MySQL root password"), ++ password=True ++ ) + + else: + print >> sys.stderr, utils.multiline_message( +- _(""" +- Please supply a root password for MySQL. This password +- will be the administrative user for this MySQL server, +- and it should be kept a secret. After this setup process +- has completed, Kolab is going to discard and forget +- about this password, but you will need it for +- administrative tasks in MySQL. +- """) +- ) ++ _(""" ++ Please supply a root password for MySQL. This password ++ will be the administrative user for this MySQL server, ++ and it should be kept a secret. After this setup process ++ has completed, Kolab is going to discard and forget ++ about this password, but you will need it for ++ administrative tasks in MySQL. ++ """) ++ ) + + mysql_root_password = utils.ask_question( +- _("MySQL root password"), +- default=utils.generate_password(), +- password=True, +- confirm=True +- ) ++ _("MySQL root password"), ++ default=utils.generate_password(), ++ password=True, ++ confirm=True ++ ) ++ ++ p1 = subprocess.Popen( ++ ++ 'echo', ++ 'UPDATE mysql.user SET Password=PASSWORD(\'%s\') WHERE User=\'root\';' % ( ++ mysql_root_password ++ ) ++ , ++ stdout=subprocess.PIPE ++ ) ++ ++ p2 = subprocess.Popen('mysql', stdin=p1.stdout) ++ p1.stdout.close() ++ p2.communicate() ++ ++ p1 = subprocess.Popen( ++ ++ 'echo', ++ "UPDATE mysql.user SET authentication_string=PASSWORD('%s') WHERE User='root';" % ( ++ mysql_root_password ++ ) ++ , ++ stdout=subprocess.PIPE ++ ) ++ ++ p2 = subprocess.Popen('mysql', stdin=p1.stdout) ++ p1.stdout.close() ++ p2.communicate() ++ ++ p1 = subprocess.Popen( ++ ++ 'echo', ++ """ ++ UPDATE mysql.user ++ SET plugin='mysql_native_password' ++ WHERE User='root' AND plugin='auth_socket'; ++ """ ++ , ++ stdout=subprocess.PIPE ++ ) + +- p1 = subprocess.Popen('echo', 'UPDATE mysql.user SET Password=PASSWORD(\'%s\') WHERE User=\'root\';' % (mysql_root_password), stdout=subprocess.PIPE) + p2 = subprocess.Popen('mysql', stdin=p1.stdout) + p1.stdout.close() + p2.communicate() +@@ -162,7 +206,7 @@ password='%s' + """ % (mysql_root_password) + + fp = open('/tmp/kolab-setup-my.cnf', 'w') +- os.chmod('/tmp/kolab-setup-my.cnf', 0600) ++ os.chmod('/tmp/kolab-setup-my.cnf', 600) + fp.write(data) + fp.close() + +@@ -174,41 +218,74 @@ password='%s' + if filename.endswith('oracle.sql'): + continue + +- schema_file = os.path.join(root,filename) ++ schema_file = os.path.join(root, filename) + +- if not schema_file == None: ++ if schema_file is not None: + p1 = subprocess.Popen('echo', 'create database kolab;', stdout=subprocess.PIPE) + p2 = subprocess.Popen('mysql', '--defaults-file=/tmp/kolab-setup-my.cnf', stdin=p1.stdout) + p1.stdout.close() + p2.communicate() + + print >> sys.stderr, utils.multiline_message( +- _(""" +- Please supply a password for the MySQL user 'kolab'. +- This password will be used by Kolab services, such as +- the Web Administration Panel. +- """) +- ) ++ _(""" ++ Please supply a password for the MySQL user 'kolab'. ++ This password will be used by Kolab services, such as ++ the Web Administration Panel. ++ """) ++ ) + + mysql_kolab_password = utils.ask_question( +- _("MySQL kolab password"), +- default=utils.generate_password(), +- password=True, +- confirm=True +- ) ++ _("MySQL kolab password"), ++ default=utils.generate_password(), ++ password=True, ++ confirm=True ++ ) ++ ++ p1 = subprocess.Popen( ++ ++ 'echo', ++ "GRANT ALL PRIVILEGES ON kolab.* TO 'kolab'@'localhost' IDENTIFIED BY '%s';" % ( ++ mysql_kolab_password ++ ) ++ , ++ stdout=subprocess.PIPE ++ ) ++ ++ p2 = subprocess.Popen( ++ ++ 'mysql', ++ '--defaults-file=/tmp/kolab-setup-my.cnf' ++ , ++ stdin=p1.stdout ++ ) + +- p1 = subprocess.Popen('echo', 'GRANT ALL PRIVILEGES ON kolab.* TO \'kolab\'@\'localhost\' IDENTIFIED BY \'%s\';' % (mysql_kolab_password), stdout=subprocess.PIPE) +- 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', '--defaults-file=/tmp/kolab-setup-my.cnf', '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://kolab:%s@localhost/kolab' % (mysql_kolab_password)) +- conf.command_set('kolab_smtp_access_policy', 'cache_uri', 'mysql://kolab:%s@localhost/kolab' % (mysql_kolab_password)) ++ conf.command_set( ++ 'kolab_wap', ++ 'sql_uri', ++ 'mysql://kolab:%s@localhost/kolab' % (mysql_kolab_password) ++ ) ++ ++ conf.command_set( ++ 'kolab_smtp_access_policy', ++ 'cache_uri', ++ 'mysql://kolab:%s@localhost/kolab' % (mysql_kolab_password) ++ ) ++ + else: + log.warning(_("Could not find the MySQL Kolab schema file")) +- +-- +2.20.1 +
View file
0002-Work-around-out-dated-augeas-on-Xenial.patch
Added
@@ -0,0 +1,150 @@ +From 5e23af6c1d6e11135bb977afd92acb9c8c1a9155 Mon Sep 17 00:00:00 2001 +From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> +Date: Mon, 29 Jul 2019 14:15:32 +0200 +Subject: PATCH 2/2 Work around out-dated augeas on Xenial + +--- + pykolab/setup/setup_php.py | 103 ++++++++++++++++++++++--------------- + 1 file changed, 62 insertions(+), 41 deletions(-) + +diff --git a/pykolab/setup/setup_php.py b/pykolab/setup/setup_php.py +index 942d09f..f27dd3f 100644 +--- a/pykolab/setup/setup_php.py ++++ b/pykolab/setup/setup_php.py +@@ -35,50 +35,60 @@ from pykolab.translate import _ + log = pykolab.getLogger('pykolab.setup') + conf = pykolab.getConf() + ++ + def __init__(): + components.register('php', execute, description=description()) + ++ + def cli_options(): + php_group = conf.add_cli_parser_option_group(_("PHP Options")) + + php_group.add_option( +- "--timezone", +- dest = "timezone", +- action = "store", +- default = None, +- help = _("Specify the timezone for PHP.") +- ) ++ "--timezone", ++ dest="timezone", ++ action="store", ++ default=None, ++ help=_("Specify the timezone for PHP.") ++ ) + + php_group.add_option( +- "--with-php-ini", +- dest = "php_ini_path", +- action = "store", +- default = None, +- help = _("Specify the path to the php.ini file used with the webserver.") +- ) ++ "--with-php-ini", ++ dest="php_ini_path", ++ action="store", ++ default=None, ++ help=_("Specify the path to the php.ini file used with the webserver.") ++ ) ++ + + def description(): + return _("Setup PHP.") + ++ + def execute(*args, **kw): +- if conf.timezone == None: ++ if conf.timezone is None: + print >> sys.stderr, utils.multiline_message( +- _(""" +- Please supply the timezone PHP should be using. +- You have to use a Continent or Country / City locality name +- like 'Europe/Berlin', but not just 'CEST'. +- """) +- ) ++ _(""" ++ Please supply the timezone PHP should be using. ++ You have to use a Continent or Country / City locality name ++ like 'Europe/Berlin', but not just 'CEST'. ++ """) ++ ) + + conf.timezone = utils.ask_question( +- _("Timezone ID"), +- default="UTC" +- ) ++ _("Timezone ID"), ++ default="UTC" ++ ) + +- if not conf.php_ini_path == None: ++ if conf.php_ini_path is not None: + if not os.path.isfile(conf.php_ini_path): +- log.error(_("Cannot configure PHP through %r (No such file or directory)") % (conf.php_ini_path)) ++ log.error( ++ _("Cannot configure PHP through %r (No such file or directory)") % ( ++ conf.php_ini_path ++ ) ++ ) ++ + return ++ + php_ini = conf.php_ini_path + + else: +@@ -98,20 +108,31 @@ def execute(*args, **kw): + log.error(_("Could not find PHP configuration file php.ini")) + return + +- myaugeas = Augeas() +- +- setting_base = '/files%s/' % (php_ini) +- +- setting = os.path.join(setting_base, 'Date', 'date.timezone') +- current_value = myaugeas.get(setting) +- +- if current_value == None: +- insert_paths = myaugeas.match('/files%s/Date/*' % (php_ini)) +- insert_path = insert_paths(len(insert_paths)-1) +- myaugeas.insert(insert_path, 'date.timezone', False) +- +- log.debug(_("Setting key %r to %r") % ('Date/date.timezone', conf.timezone), level=8) +- myaugeas.set(setting, conf.timezone) +- +- myaugeas.save() +- ++ try: ++ myaugeas = Augeas() ++ ++ setting_base = '/files%s/' % (php_ini) ++ ++ setting = os.path.join(setting_base, 'Date', 'date.timezone') ++ current_value = myaugeas.get(setting) ++ ++ if current_value is None: ++ insert_paths = myaugeas.match('/files%s/Date/*' % (php_ini)) ++ insert_path = insert_paths(len(insert_paths) - 1) ++ myaugeas.insert(insert_path, 'date.timezone', False) ++ ++ log.debug(_("Setting key %r to %r") % ('Date/date.timezone', conf.timezone), level=8) ++ myaugeas.set(setting, conf.timezone) ++ ++ myaugeas.save() ++ except IndexError: ++ subprocess.Popen( ++ ++ 'sed', ++ '-i', ++ '-r', ++ '-e', ++ r's|^(;*)date\.timezone.*$|date.timezone = %s|g' % (conf.timezone), ++ php_ini ++ ++ ) +-- +2.20.1 +
View file
debian.changelog
Changed
@@ -1,3 +1,11 @@ +pykolab (0.8.13-0~kolab4) unstable; urgency=low + + * Require both python-pymysql and python-mysqldb + * Fix PHP setup on Xenial + * Fix MySQL setup on Bionic + + -- Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Mon, 29 Jul 2019 01:49:00 +0100 + pykolab (0.8.13-0~kolab3) unstable; urgency=low * Release of version 0.8.13
View file
debian.control
Changed
@@ -41,6 +41,7 @@ python-ldap, python-pyasn1, python-pyasn1-modules, + python-pymysql, python-sqlalchemy, ${misc:Depends}, ${shlibs:Depends},
View file
debian.series
Changed
@@ -1,1 +1,3 @@ cyrus-imapd.conf-cert-paths.patch -p1 +0001-Fix-settting-up-new-MySQL-servers-with-root-password.patch -p1 +0002-Work-around-out-dated-augeas-on-Xenial.patch -p1
View file
pykolab.dsc
Changed
@@ -2,7 +2,7 @@ Source: pykolab Binary: pykolab, kolab-cli, kolab-conf, kolab-saslauthd, kolab-server, kolab-telemetry, kolab-xml, wallace Architecture: all -Version: 0.8.13-0~kolab3 +Version: 0.8.13-0~kolab4 Maintainer: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Uploaders: Paul Klos <kolab@klos2day.nl> Homepage: http://www.kolab.org
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.