Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Ensure a Log Metric Filter and Alarm Rule for NACL Changes

This rule ensures the existence of a log metric filter and alarm for changes to Network Access Control Lists (NACL).

RuleEnsure a log metric filter and alarm exist for changes to Network Access Control Lists (NACL)
Frameworkcis_v130
Severity
Low

Rule Description:

This rule ensures that a log metric filter and alarm exist for changes made to Network Access Control Lists (NACL) in accordance with the CIS AWS Foundations Benchmark version 1.3.0 (cis_v130).

The aim of this rule is to proactively monitor and alert any modifications or updates made to NACLs, aiding in the detection of potential security breaches or unauthorized changes.

Troubleshooting Steps:

  1. 1.

    Ensure that the specified NACLs are properly configured and associated with the relevant subnets and VPCs.

  2. 2.

    Verify that the necessary VPC flow logs are enabled to capture the required network traffic.

  3. 3.

    Check CloudWatch Logs for any errors related to the log metric filter.

  4. 4.

    Ensure that the IAM roles and permissions are correctly configured to allow the creation and management of log metric filters and alarms.

Necessary Codes:

Below are the necessary codes to define a log metric filter and alarm for NACL changes:

  1. 1.
    Log Metric Filter:
{
    "Filters": [
        {
            "Pattern": "{($.eventName = AuthorizeSecurityGroupEgress) || ($.eventName = AuthorizeSecurityGroupIngress) || ($.eventName = RevokeSecurityGroupEgress) || ($.eventName = RevokeSecurityGroupIngress) || ($.eventName = CreateNetworkAcl) || ($.eventName = ReplaceNetworkAcl) || ($.eventName = DeleteNetworkAcl)) && (($.requestParameters == \"null\")
            {
                "logGroupName": "your-log-group-name",
                "metricTransformations": [
                    {
                        "metricNamespace": "CloudTrailMetrics",
                        "metricValue": "1",
                        "metricName": "NACLChanges"
                    }
                ]
            }
        }
    ],
    "LogGroupName": "your-log-group-name"
}
  1. 1.
    CloudWatch Alarm:
{
    "AlarmName": "NACLChangesAlarm",
    "MetricName": "NACLChanges",
    "Namespace": "CloudTrailMetrics",
    "Statistic": "Sum",
    "Period": 300,
    "EvaluationPeriods": 1,
    "Threshold": 1,
    "ComparisonOperator": "GreaterThanOrEqualToThreshold",
    "AlarmDescription": "Alarm triggered when any changes occur in Network Access Control Lists (NACLs).",
    "TreatMissingData": "notBreaching",
    "Metrics": [
        {
            "Id": "m1",
            "Expression": "SUM(METRICS('CloudTrailMetrics', 'NACLChanges', 'LogGroupName', 'your-log-group-name'), 300)"
        }
    ],
    "ActionsEnabled": true,
    "AlarmActions": [
        "your-sns-topic-arn"
    ]
}

Remediation Steps:

Follow the step-by-step guide below to remediate any issues related to the log metric filter and alarm for NACL changes:

  1. 1.

    Validate Log Metric Filter:

    • Check if the log metric filter JSON is correctly configured and valid.
    • Open the CloudWatch console.
    • Go to "Metrics" and select the "Log groups" tab.
    • Locate and select the log group associated with your NACL logs.
    • Click on the "Filter" dropdown and choose "Metric Filters".
    • Verify that the log metric filter for NACL changes is present and has the correct filter pattern.
  2. 2.

    Validate CloudWatch Alarm:

    • Open the CloudWatch console.
    • Go to "Alarms" and search for the "NACLChangesAlarm" alarm.
    • Ensure that the alarm exists and is in an "OK" state.
    • Verify that the alarm notification is correctly configured to send alerts to the desired SNS topic.
  3. 3.

    Troubleshoot Log Metric Filter (if necessary):

    • If there are no logs being captured or the filter does not work as expected, review the filter pattern and ensure it matches the events related to NACL changes.
    • Check the CloudTrail logs to verify if the expected events are being recorded.
    • Make sure the log group is correctly configured and associated with the CloudTrail logs.
    • Ensure the IAM role used by CloudTrail has sufficient permissions to access the log group.
  4. 4.

    Troubleshoot CloudWatch Alarm (if necessary):

    • If the CloudWatch alarm is not triggering as expected, review the alarm configuration.
    • Confirm that the metric transformation is correctly set up and sending the metric data to the CloudTrailMetrics namespace.
    • Double-check the alarm threshold, period, and comparison operator.
    • Verify that the alarm actions are properly configured and pointing to the correct SNS topic.

By following these steps, you can ensure the log metric filter and alarm for changes to Network Access Control Lists (NACLs) are successfully implemented and functioning as intended.

Is your System Free of Underlying Vulnerabilities?
Find Out Now