Description
Monitor changes to network ACLs, their entries, and their subnet associations.
Potential impact
An unexpected change can allow unwanted traffic or block legitimate connections.
Remediation
Deliver CloudTrail events to CloudWatch Logs. Set the alarm’s metric name and namespace to the filter’s output and add a notification action for the network team.
Examples
The filter covers ACL creation and deletion, entry creation, replacement and deletion, and subnet reassociation.
Before
hcl
resource "aws_cloudwatch_metric_alarm" "example" {
alarm_name = "CIS-4.11-Changes-NACL"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "OTHER FILTER"
namespace = "CIS_Metric_Alarm_Namespace"
period = "300"
statistic = "Sum"
threshold = "1"
}
resource "aws_cloudwatch_log_metric_filter" "example" {
name = "CIS-4.11-Changes-NACL"
pattern = "{ ($.eventName = CreateNetworkAcl) || ($.eventName = CreateNetworkAclEntry) || ($.eventName = DeleteNetworkAcl) || ($.eventName = DeleteNetworkAclEntry) || ($.eventName = ReplaceNetworkAclEntry) || ($.eventName = ReplaceNetworkAclAssociation) }"
log_group_name = aws_cloudwatch_log_group.CIS_CloudWatch_LogsGroup.name
metric_transformation {
name = "CIS-4.11-Changes-NACL"
namespace = "CIS_Metric_Alarm_Namespace"
value = "1"
}
}
After
hcl
resource "aws_cloudwatch_metric_alarm" "example" {
alarm_name = "CIS-4.11-Changes-NACL"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = aws_cloudwatch_log_metric_filter.example.id
namespace = "CIS_Metric_Alarm_Namespace"
period = "300"
statistic = "Sum"
threshold = "1"
}
resource "aws_cloudwatch_log_metric_filter" "example" {
name = "CIS-4.11-Changes-NACL"
pattern = "{ ($.eventName = CreateNetworkAcl) || ($.eventName = CreateNetworkAclEntry) || ($.eventName = DeleteNetworkAcl) || ($.eventName = DeleteNetworkAclEntry) || ($.eventName = ReplaceNetworkAclEntry) || ($.eventName = ReplaceNetworkAclAssociation) }"
log_group_name = aws_cloudwatch_log_group.CIS_CloudWatch_LogsGroup.name
metric_transformation {
name = "CIS-4.11-Changes-NACL"
namespace = "CIS_Metric_Alarm_Namespace"
value = "1"
}
}