Skip to content

Instantly share code, notes, and snippets.

@rohityadavcloud
Last active June 29, 2023 17:02
Show Gist options
  • Save rohityadavcloud/d9bf977ad30bda1de0ea to your computer and use it in GitHub Desktop.
Save rohityadavcloud/d9bf977ad30bda1de0ea to your computer and use it in GitHub Desktop.
vnc-decrypt: CloudStack VNC Password decryption tool
#!/bin/bash
# Usage comment out code that you don't need per your CloudStack version
input=$(mysql -u root -proot -e "select vnc_password from cloud.vm_instance where name='$1'\G;" | grep vnc_password | sed 's/.*vnc_password: //')
# For older ACS versions:
java -classpath /usr/share/cloudstack-common/lib/jasypt-1.9.0.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI decrypt.sh input=$input password=password verbose=true
# For ACS 4.15-17:
java -classpath /usr/share/cloudstack-common/lib/jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI decrypt.sh input=$input password=password verbose=true
# For ACS 4.18+:
java -classpath /usr/share/cloudstack-common/lib/cloudstack-utils.jar com.cloud.utils.crypt.EncryptionCLI -d -e V2 -p password -i $input -v
@andrijapanicsb
Copy link

version atm 1.9.2 :)

@rohityadavcloud
Copy link
Author

well, v1.9.3 is the latest we'll move in 4.14/master. But this shall also work @andrijapanicsb

@andrijapanicsb
Copy link

We would need update for the 4.18+, due to the new encryption scheme

@andrijapanicsb
Copy link

java -classpath /usr/share/cloudstack-common/lib/cloudstack-utils.jar com.cloud.utils.crypt.EncryptionCLI -d -e V2 -p password -i $input -v

@rohityadavcloud
Copy link
Author

This was ages ago I didn't know anybody was using this @andrijapanicsb :) I'll fix this, perhaps @ustcweizhou can review

@weizhouapache
Copy link

looks good !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment