56 lines
2.5 KiB
YAML
56 lines
2.5 KiB
YAML
id: azure-vmss-termination-notif-disabled
|
|
info:
|
|
name: Azure VMSS Instance Termination Notifications Disabled
|
|
author: princechaddha
|
|
severity: medium
|
|
description: |
|
|
Ensure that your Microsoft Azure virtual machine scale sets are configured to receive instance termination notifications through the Azure Metadata service and have a predefined delay timeout configured for the "Terminate" operation (event). The termination notifications are delivered through Scheduled Events, an Azure Metadata feature which sends termination notifications, and can also be used to delay impactful operations such as reboots and redeployments. The delay associated with the "Terminate" event will depend on the delay limit specified in the VM scale set model configuration.
|
|
impact: |
|
|
Failing to enable instance termination notifications can lead to insufficient preparation time for termination events, potentially disrupting operations and leading to data loss.
|
|
remediation: |
|
|
Configure the termination notification feature for all your Azure VM scale sets to receive proper alerts and set a reasonable delay for the termination events.
|
|
reference:
|
|
- https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-terminate-notification
|
|
tags: cloud,devops,azure,microsoft,vmss,azure-cloud-config
|
|
|
|
flow: |
|
|
code(1);
|
|
for (let ScaleSetData of iterate(template.scaleSetList)) {
|
|
ScaleSetData = JSON.parse(ScaleSetData);
|
|
set("name", ScaleSetData.name);
|
|
set("resourceGroup", ScaleSetData.resourceGroup);
|
|
code(2);
|
|
}
|
|
|
|
self-contained: true
|
|
code:
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
az vmss list --output json --query '[*].{"name":name,"resourceGroup":resourceGroup}'
|
|
|
|
extractors:
|
|
- type: json
|
|
name: scaleSetList
|
|
internal: true
|
|
json:
|
|
- '.[]'
|
|
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
az vmss show --name "$name" --resource-group "$resourceGroup" --query '{"TerminateNotificationProfileStatus": virtualMachineProfile.scheduledEventsProfile.terminateNotificationProfile.enable}'
|
|
|
|
matchers-condition: and
|
|
matchers:
|
|
- type: word
|
|
words:
|
|
- '"TerminateNotificationProfileStatus": null'
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- 'name + " in " + resourceGroup + " does not have termination notifications enabled."'
|
|
# digest: 4b0a00483046022100ed62c1eb90f6b157fbee83c0e2ce66e5b95c199edb4686e894fd66578f88944b022100cd8fa2dce7fd609e23ae5ab43f184ab842d0095bc35342b5ad0a0b9d471587d3:922c64590222798bb761d5b6d8e72950 |