cloudstack-setup-databases doesn't parse password input properly
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- databases, infrastructure
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Java
- Sterne
- 3.1k
- Forks
- 1.4k
- Ø Merge
- 7 T. 5 Std.
- Gemergte PRs (30 T.)
- 28
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus apache/cloudstack
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
apache/cloudstack#14222 ·
-
create-kubernetes-binaries-iso.sh builds the ISO without setting a volume ID on EL8 based os's Offenbug component:kubernetes
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
apache/cloudstack#14180 ·
-
bug component:projects component:UI
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
apache/cloudstack#14070 · 5 Kommentare ·
-
component:backup
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
apache/cloudstack#14013 ·
-
KVM agent fails to connect to Ceph RBD storage pool after upgrading Ceph client to Tentacle 20.2.4 Offenbug component:ceph
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
apache/cloudstack#13989 · 3 Kommentare ·
Alle Issues in apache/cloudstack
Ähnliche Issues
-
[BUG]茶杯方块在取茶时会引发崩溃 Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
1.0.0-alpha2 Type/Improvement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
wso2/dpdp-accelerator#272 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100