59 lines
2.3 KiB
YAML
59 lines
2.3 KiB
YAML
id: azure-db-mysql-delete-unalerted
|
|
info:
|
|
name: Azure MySQL Database Delete Alert Not Configured
|
|
author: princechaddha
|
|
severity: high
|
|
description: |
|
|
Ensure that a Microsoft Azure activity log alert is fired whenever a "Delete MySQL Database" event is triggered within your cloud account. An Azure activity log alert fires each time the action event that matches the condition specified in the alert configuration is triggered. The alert condition that this conformity rule checks for is "Whenever the Activity Log has an event with Category='Administrative', Signal name='Delete MySQL Database (servers/databases)'"
|
|
impact: |
|
|
Failing to configure alerts for "Delete MySQL Database" events can allow unauthorized or accidental deletions to go unnoticed, potentially leading to significant data loss and compliance issues.
|
|
remediation: |
|
|
Configure an activity log alert to fire on "Delete MySQL Database" events with the condition set to "Microsoft.DBforMySQL/servers/databases/delete" and ensure that an action group is attached to manage notifications.
|
|
reference:
|
|
- https://docs.microsoft.com/en-us/azure/azure-monitor/platform/alerts-activity-log
|
|
tags: cloud,devops,azure,microsoft,mysql,azure-cloud-config
|
|
|
|
flow: |
|
|
code(1);
|
|
for (let AlertData of iterate(template.alertList)) {
|
|
set("id", AlertData);
|
|
code(2);
|
|
}
|
|
|
|
self-contained: true
|
|
code:
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
az monitor activity-log alert list --output json --query '[?(enabled==`true`)].id'
|
|
|
|
extractors:
|
|
- type: json
|
|
name: alertList
|
|
internal: true
|
|
json:
|
|
- '.[]'
|
|
|
|
- engine:
|
|
- sh
|
|
- bash
|
|
source: |
|
|
az monitor activity-log alert show --ids "$id" --query 'condition'
|
|
|
|
matchers-condition: and
|
|
matchers:
|
|
- type: word
|
|
words:
|
|
- '"field": "operationName"'
|
|
|
|
- type: word
|
|
words:
|
|
- "Microsoft.DBforMySQL/servers/databases/delete"
|
|
negative: true
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- 'id + " does not have the correct alert configuration for Delete MySQL Database events"'
|
|
# digest: 4b0a00483046022100d4e4fcf7f8b13ed82699f398ebcf6dc75ba0f60a8b94f4cf76264b652e6bad43022100b7baa8c27193431429bd62d848f5deedfd6347564c0a840f7fa72ed64cc10c9d:922c64590222798bb761d5b6d8e72950 |