From 192be12821ad6b6b29a35056668cfe255a66b477 Mon Sep 17 00:00:00 2001 From: Darrin Husselmann Date: Thu, 29 Apr 2021 16:09:08 +0200 Subject: [PATCH 1/2] Fixed error when passing shell reserved charaters to setup databases script for dbsecret --- setup/bindir/cloud-setup-databases.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup/bindir/cloud-setup-databases.in b/setup/bindir/cloud-setup-databases.in index bd23c2ba6add..f321d6eee0dd 100755 --- a/setup/bindir/cloud-setup-databases.in +++ b/setup/bindir/cloud-setup-databases.in @@ -26,6 +26,7 @@ import string from optparse import OptionParser import subprocess import shutil +import shlex import socket # squelch mysqldb spurious warnings @@ -443,7 +444,7 @@ for example: self.encryptiontype = self.options.encryptiontype self.mgmtsecretkey = self.options.mgmtsecretkey - self.dbsecretkey = self.options.dbsecretkey + self.dbsecretkey = shlex.quote(self.options.dbsecretkey) self.isDebug = self.options.debug if self.options.dbConfPath: self.dbConfPath = self.options.dbConfPath From 30c9298dd6dab5aea6bbf01c9a59fdfd903dcf55 Mon Sep 17 00:00:00 2001 From: Darrin Husselmann Date: Mon, 3 May 2021 11:33:36 +0200 Subject: [PATCH 2/2] Moved quote to encrypt method --- setup/bindir/cloud-setup-databases.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/bindir/cloud-setup-databases.in b/setup/bindir/cloud-setup-databases.in index f321d6eee0dd..b2ed74ade9fa 100755 --- a/setup/bindir/cloud-setup-databases.in +++ b/setup/bindir/cloud-setup-databases.in @@ -400,7 +400,7 @@ for example: return 'ENC(%s)'%value def encryptDBSecretKey(): - self.putDbProperty('db.cloud.encrypt.secret', formatEncryptResult(encrypt(self.dbsecretkey))) + self.putDbProperty('db.cloud.encrypt.secret', formatEncryptResult(encrypt(shlex.quote(self.dbsecretkey)))) def encryptDBPassword(): dbPassword = self.getDbProperty('db.cloud.password') @@ -444,7 +444,7 @@ for example: self.encryptiontype = self.options.encryptiontype self.mgmtsecretkey = self.options.mgmtsecretkey - self.dbsecretkey = shlex.quote(self.options.dbsecretkey) + self.dbsecretkey = self.options.dbsecretkey self.isDebug = self.options.debug if self.options.dbConfPath: self.dbConfPath = self.options.dbConfPath