This rule ensures the presence of a log metric filter and alarm for monitoring route table changes.
Rule | Ensure a log metric filter and alarm exist for route table changes |
Framework | cis_v140 |
Severity | ✔ Low |
Ensuring a Log Metric Filter and Alarm for Route Table Changes (CIS_V1.4.0)
CIS (Center for Internet Security) benchmarks recommend that changes to route tables in cloud environments should be monitored to enable the detection of potentially unauthorized traffic routing. Setting up a log metric filter and alarm for route table changes is essential for maintaining the security and integrity of your VPC (Virtual Private Cloud). Here's a detailed guide on how to ensure that you have proper log monitoring and alerting for route table changes in AWS environments, which is aligned with the CIS AWS Foundations Benchmark v1.4.0 guideline 4.3.
Prerequisites
Step 1: Creating the Log Metric Filter
Create Metric Filter in CloudWatch Logs
Go to the CloudWatch service in the AWS Management Console.
Under Logs, select Log groups and choose the log group that receives CloudTrail logs.
Click on Create metric filter.
In the filter pattern box, enter the following pattern:
{ ($.eventName = CreateRouteTable) || ($.eventName = DeleteRouteTable) || ($.eventName = ReplaceRouteTableAssociation) || ($.eventName = AssociateRouteTable) || ($.eventName = DisassociateRouteTable) }
This pattern captures the relevant API calls that could indicate route table changes.
Choose Assign a metric and define the filter name and metric details:
RouteTableChange
CISBenchmark
RouteTableChangeCount
Set the metric value to
1
(which increments the count each time the pattern is matched).Click on Create Filter.
Step 2: Setting Up the Alarm
Create an Alarm for the Metric Filter
In CloudWatch, navigate to Alarms and then click Create alarm.
Click on Select metric, go to the CISBenchmark namespace, and choose the metric
RouteTableChangeCount
.Click on the metric name and then Select metric.
Set the condition to trigger the alarm. For instance, choose
Statistic
as Sum, set the Period
to say 5 minutes
, and Threshold type
to Static
.Define the threshold value according to your security policy, for example, to trigger the alarm when the route table change is recorded once (
>= 1
).Click on Next and configure actions. Set up a notification to an SNS topic that sends alerts when the alarm state is triggered.
Name the alarm (e.g.,
Alarm_RouteTableChanges
) and add an optional description.Click on Create alarm.
Remediation for Route Table Changes
If you receive an alarm about route table changes, you should validate whether the change was expected, authorized, and compliant with your governance policies. Investigate the CloudTrail logs and identity who made the change, from where, and what change was made. If the change was unauthorized, proceed to revert the changes and analyze the root cause to prevent future occurrences.
AWS CLI Commands
Create Metric Filter
aws logs put-metric-filter \
--log-group-name "<cloudtrail_log_group_name>" \
--filter-name "RouteTableChange" \
--filter-pattern '{ ($.eventName = CreateRouteTable) || ($.eventName = DeleteRouteTable) || ($.eventName = ReplaceRouteTableAssociation) || ($.eventName = AssociateRouteTable) || ($.eventName = DisassociateRouteTable) }' \
--metric-transformations metricName="RouteTableChangeCount",metricNamespace="CISBenchmark",metricValue="1"
Create Alarm
aws cloudwatch put-metric-alarm \ --alarm-name "Alarm_RouteTableChanges" \ --metric-name "RouteTableChangeCount" \ --namespace "CISBenchmark" \ --statistic "Sum" \ --period 300 \ --threshold 1 \ --comparison-operator "GreaterThanOrEqualToThreshold" \ --evaluation-periods 1 \ --alarm-actions "arn:aws:sns:<region>:<account-id>:<sns_topic_name>" \ --unit "Count"
This comprehensive guide ensures a reliable way of setting up alarms to monitor route table changes, which not only satisfies CIS benchmark standards but also optimizes your environment for better security oversight.