This rule ensures the presence of a log metric filter and alarm for network gateway changes.
Rule | Ensure a log metric filter and alarm exist for changes to network gateways |
Framework | cis_v150 |
Severity | ✔ Low |
Rule Description
This rule ensures that a log metric filter and alarm are created to detect any changes to network gateways according to the CIS Amazon Web Services Foundations v1.5.0 (cis_v150) benchmark.
Troubleshooting Steps
If the log metric filter and alarm are not present or not functioning correctly, follow these troubleshooting steps:
Code
Below is an example of the CloudFormation template code that can be used to create the log metric filter and alarm for changes to network gateways. Modify it according to your specific requirements.
Resources:
NetworkGatewayLogMetricFilter:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Ref CloudTrailLogGroup
FilterPattern: "{($.eventName = CreateCustomerGateway) || ($.eventName = CreateVpnGateway) || ($.eventName = DeleteCustomerGateway) || ($.eventName = DeleteVpnGateway)}"
MetricTransformations:
- MetricValue: "1"
MetricNamespace: "CIS/NetworkGatewayChanges"
MetricName: "NetworkGatewayChanges"
NetworkGatewayAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: "NetworkGatewayChangesAlarm"
AlarmDescription: "Alarm triggered when network gateway changes are detected"
AlarmActions:
- !Ref SnsTopic
MetricName: "NetworkGatewayChanges"
Namespace: "CIS/NetworkGatewayChanges"
Statistic: "SampleCount"
Period: 300
EvaluationPeriods: 1
Threshold: 1
ComparisonOperator: "GreaterThanOrEqualToThreshold"
Remediation
Follow these steps to remediate the issue:
By following these steps, you can ensure a log metric filter and alarm exist for changes to network gateways as outlined in the CIS Amazon Web Services Foundations v1.5.0 (cis_v150) benchmark.