Created
March 13, 2024 19:25
-
-
Save kfosaaen/a3df93f1416f5c0934492cacf7544d15 to your computer and use it in GitHub Desktop.
Dump Azure Linux VM Extension Protected Settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Find all ".settings" files in "/var/lib/waagent/" subdirectories | |
find /var/lib/waagent/ -type f -name "*.settings" -print0 | while IFS= read -r -d $'\0' file; do | |
thumbprint=$(jq -r '.runtimeSettings[].handlerSettings.protectedSettingsCertThumbprint' $file) | |
protectedSettingsDecrypted=$(jq -r '.runtimeSettings[].handlerSettings.protectedSettings' $file | base64 --decode | openssl smime -inform DER -decrypt -recip /var/lib/waagent/$thumbprint.crt -inkey /var/lib/waagent/$thumbprint.prv | jq .) | |
echo "File: $file" | |
echo "Public Settings: $publicSettings" | |
echo "Decrypted Protected Settings: $protectedSettingsDecrypted" | |
echo "--------------------------------------------" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment