Skip to content

Instantly share code, notes, and snippets.

@kfosaaen
Created March 13, 2024 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfosaaen/a3df93f1416f5c0934492cacf7544d15 to your computer and use it in GitHub Desktop.
Save kfosaaen/a3df93f1416f5c0934492cacf7544d15 to your computer and use it in GitHub Desktop.
Dump Azure Linux VM Extension Protected Settings
#!/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