summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-22 08:59:13 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-22 08:59:13 +0000
commit08c0dacd3186052739cb7fa2f735a2b77d8c4365 (patch)
treebe77be7c8b82c13066b6986aaaeb25ceadf2e6e2
parent9b0ffad77a623a088d7b6bff62661b2f4cc11248 (diff)
downloadpykolab-08c0dacd3186052739cb7fa2f735a2b77d8c4365.tar.gz
Remove /tmp/kolab-setup-my.cnf after setup, and chmod it 0600 before writing out anything relevant.
-rw-r--r--pykolab/setup/components.py3
-rw-r--r--pykolab/setup/setup_mysql.py5
2 files changed, 6 insertions, 2 deletions
diff --git a/pykolab/setup/components.py b/pykolab/setup/components.py
index f12fe84..d280372 100644
--- a/pykolab/setup/components.py
+++ b/pykolab/setup/components.py
@@ -201,6 +201,9 @@ def execute(component_name, *args, **kw):
components[component_name]['function'](conf.cli_args, kw)
+ if os.path.exists('/tmp/kolab-setup-my.cnf'):
+ os.unlink('/tmp/kolab-setup-my.cnf')
+
def register_group(dirname, module):
components_base_path = os.path.join(os.path.dirname(__file__), module)
diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index c956eeb..0536304 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -56,8 +56,8 @@ def execute(*args, **kw):
subprocess.call(['/usr/sbin/update-rc.d', 'mysql', 'defaults'])
else:
log.error(_("Could not configure to start on boot, the " + \
- "MySQL database service."))
-
+ "MySQL database service."))
+
print >> sys.stderr, utils.multiline_message(
_("""
Please supply a root password for MySQL. This password will
@@ -93,6 +93,7 @@ password='%s'
""" % (mysql_root_password)
fp = open('/tmp/kolab-setup-my.cnf', 'w')
+ os.chmod('/tmp/kolab-setup-my.cnf', 0600)
fp.write(data)
fp.close()