diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2023-03-21 16:52:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 16:52:51 +0200 |
commit | cbdf236f0e62655a468fe07e2f3c00037bff327c (patch) | |
tree | 685480d146701c70b21d92c1b6d04b6a31fa362d /daemon | |
parent | 9385b062f649fd197e7ba411120516fb5f9f46d7 (diff) |
add validation step before using Azure metadata (AZURE_IMDS_DATA) (#14775)
Diffstat (limited to 'daemon')
-rwxr-xr-x | daemon/system-info.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/daemon/system-info.sh b/daemon/system-info.sh index b7cec086b0..09a8ef2872 100755 --- a/daemon/system-info.sh +++ b/daemon/system-info.sh @@ -474,7 +474,7 @@ if [ "${VIRTUALIZATION}" != "none" ] && command -v curl > /dev/null 2>&1; then # Try Azure IMDS if [ "${CLOUD_TYPE}" = "unknown" ]; then AZURE_IMDS_DATA="$(curl --fail -s --connect-timeout 1 -m 3 -H "Metadata: true" --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2021-10-01")" - if [ -n "${AZURE_IMDS_DATA}" ]; then + if [ -n "${AZURE_IMDS_DATA}" ] && echo "${AZURE_IMDS_DATA}" | grep -sq azEnvironment; then CLOUD_TYPE="Azure" CLOUD_INSTANCE_TYPE="$(curl --fail -s --connect-timeout 1 -m 3 -H "Metadata: true" --noproxy "*" "http://169.254.169.254/metadata/instance/compute/vmSize?api-version=2021-10-01&format=text")" CLOUD_INSTANCE_REGION="$(curl --fail -s --connect-timeout 1 -m 3 -H "Metadata: true" --noproxy "*" "http://169.254.169.254/metadata/instance/compute/location?api-version=2021-10-01&format=text")" |