apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
1.99k stars 1.09k forks source link

Find Database key #7626

Closed Hossein4185 closed 1 year ago

Hossein4185 commented 1 year ago
COMPONENT NAME

Cloudstack Management

CLOUDSTACK VERSION

4.13.1

SUMMARY

I use cloudstack Ver 4.13, and unfortunately I have forgotten the database key And now I want to add a new node to management Servers and when using cloudstack-setup-databases I forgot the part about the database key. How Can i Find database key? please guide me Also, the log of this case sent to the attachment. Thanks

cloudstack.txt

boring-cyborg[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the issue template!

rajujith commented 1 year ago

@Hossein4185 for MGMTSECRETKEY : /etc/cloudstack/management/key for DBSECRETKEY : grep secret /etc/cloudstack/management/db.properties

weizhouapache commented 1 year ago

@Hossein4185 for MGMTSECRETKEY : /etc/cloudstack/management/key for DBSECRETKEY : grep secret /etc/cloudstack/management/db.properties

yes @rajujith the database key (db.cloud.encrypt.secret) is encrypted by the management key. You can decrypt by

msKey=$(cat /etc/cloudstack/management/key)
encDbKey=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.encrypt.secret'  | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i | sed 's/^ENC(\(.*\))/\1/')
jasypt=$(ls /usr/share/cloudstack-common/lib/jasypt-*.jar |head -n1)
java -classpath $jasypt org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI decrypt.sh input=$encDbKey password=$msKey
Hossein4185 commented 1 year ago

@weizhouapache Resolved Thank you very much.