Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions setup/bindir/cloud-setup-databases.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import os
import sys
import subprocess
import glob
import shlex
from random import choice
import string
from optparse import OptionParser
Expand Down Expand Up @@ -418,8 +419,13 @@ for example:

def processEncryptionStuff(self):
def encrypt(value):
cmd = ['java','-classpath','"' + self.encryptionJarPath + '"','com.cloud.utils.crypt.EncryptionCLI','-i','"' + value + '"', '-p', '"' +
self.mgmtsecretkey + '"', self.encryptorVersion]
# runCmd() joins this list with spaces and runs it through a shell, so each
# dynamic value must be shell-escaped with shlex.quote() rather than hand-wrapped
# in double quotes: double quotes still let the shell expand "$..." in the value
# (e.g. a password of pa$sword is truncated to pa), silently corrupting it.
cmd = ['java', '-classpath', shlex.quote(self.encryptionJarPath),
'com.cloud.utils.crypt.EncryptionCLI', '-i', shlex.quote(value),
'-p', shlex.quote(self.mgmtsecretkey), self.encryptorVersion]
return str(runCmd(cmd)).strip('\r\n')

def saveMgmtServerSecretKey():
Expand Down