cloudstack-setup-databases doesn't parse password input properly
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 72/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Domaine
- databases, infrastructure
Piste de recherche
Start at the cloudstack-setup-databases entry point and trace how the password is assembled for EncryptionCLI and passed through /bin/sh. Reproduce with the provided password containing $, then verify that the decrypted value remains intact and that other special characters mentioned in the issue are handled correctly.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
problem
While running cloudstack-setup-databases, if it is called with any password containing a $, the password gets truncated at the $ before being passed to EncryptionCLI, thus storing an incorrect encrypted password in db.properties.
versions
This was discovered while executing cloudstack-setup-databases on a clean install of 4.23.
The steps to reproduce the bug
- Call
cloudstack-setup-databases cloud:'pa$sword'@localhost --deploy-as=root:'pa$sword' - Decrypt what was stored in db.properties and note the output is only
pa:
# java -classpath /usr/share/cloudstack-common/lib/cloudstack-utils.jar com.cloud.utils.crypt.EncryptionCLI -d -i "4dfIlH8M/ydVp+mYjIBr7S1plQDzsOzmKt2jAeGW" -p "password"
pa
What to do about it?
This seems to be a parsing issue in cloudstack-setup-databases. The password is getting to the script correctly because it is able to us it in mysql with mysqlCmds.append('--password=\'%s\''%kwargs['passwd']) and this part of the script succeeds.
But then when it assembles the encrypt command to go to the CLI, it wraps that password in double quotes:
cmd = ['java','-classpath','"' + self.encryptionJarPath + '"','com.cloud.utils.crypt.EncryptionCLI','-i','"' + value + '"', '-p', '"' + self.mgmtsecretkey + '"', self.encryptorVersion]
and then sends it through /bin/sh here (shell=True):
subprocess.Popen(' '.join(cmds), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
In doing so, sh will expand the variable $sword to nothing. I haven't tested, but presumably things like \, ", and ' might also be a problem.
- Langage dominant
- Java
- Étoiles
- 3.1k
- Forks
- 1.4k
- Merge moyen
- 6 j 8 h
- PR mergées (30 j)
- 20
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/cloudstack
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
apache/cloudstack#14248 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
apache/cloudstack#14244 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
apache/cloudstack#14222 ·
Les mainteneurs répondent en général sous 1 jour
-
create-kubernetes-binaries-iso.sh builds the ISO without setting a volume ID on EL8 based os'sOuvertebug component:kubernetes
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
apache/cloudstack#14180 ·
Les mainteneurs répondent en général sous 1 jour
-
bug component:projects component:UI
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
apache/cloudstack#14070 · 5 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de apache/cloudstack
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
apache/rocketmq-dashboard#5358 ·
Les mainteneurs répondent en général sous 3 jours
-
area:cpan-port area:database bug
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
fglock/PerlOnJava#1605 ·
Les mainteneurs répondent en général sous 1 jour
-
1.0.0-rc2
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
wso2/dpdp-accelerator#377 ·
Les mainteneurs répondent en général sous 1 jour
-
area/dependencies backport/26.4 kind/cve severity/high source/scan-dependencies status/triage
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour