Skip to main content

More Info:

NetworkSecurityGroupChange events should be monitored. NSGs govern granular instance-level access, and unapproved modifications can compromise micro-segmentation boundaries.

Risk Level

Medium

Address

Compliance, Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • AWS Well Architected Framework
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS AWS
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • HIPAA
  • HITRUST CSF
  • ISO 27001
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST
  • NIST CSF
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

Below are concise, step‑by‑step instructions to configure an alarm/alert for NSG (Network Security Group) changes in OCI using the console. In OCI, this is done with Events + Notifications (which is still “alerting/monitoring,” but event‑driven rather than metric‑driven).

1. Create a Notifications Topic

  1. In the OCI Console, open the Navigation menu (☰).
  2. Go to Developer ServicesApplication IntegrationNotifications.
  3. Make sure you’re in the correct compartment.
  4. Click Create Topic.
  5. Enter:
    • Name: e.g. nsg-change-alerts-topic
    • Description: e.g. Alerts for OCI NSG configuration changes
  6. Click Create.

2. Add a Subscription (Email or Other)

  1. After the topic is created, click the topic name (nsg-change-alerts-topic).
  2. Under Subscriptions, click Create Subscription.
  3. Choose Protocol (e.g. Email).
  4. Enter Endpoint (e.g. your email address).
  5. Click Create.
  6. Check your email and confirm the subscription via the confirmation link.

3. Create an Event Rule for NSG Changes

You want to fire an alert whenever a Network Security Group is created, updated, or deleted.
  1. In the console, go to Observability & ManagementEvents ServiceRules.
  2. Ensure you are in the compartment where NSGs exist (or a higher-level compartment if you want broader scope).
  3. Click Create Rule.
  4. Fill in:
    • Name: nsg-change-event-rule
    • Description: Trigger notification on NSG create, update, or delete
    • Status: leave as Enabled.
  5. Under Rule Conditions:
    • Choose Event Type:
      • Click Edit or + Another Condition as needed.
      • In Service Name, select Virtual Cloud Network (VCN) (sometimes labeled just Virtual Networking).
      • In Event Type, select events related to NSG:
        • CreateNetworkSecurityGroup
        • UpdateNetworkSecurityGroup
        • DeleteNetworkSecurityGroup
        • UpdateNetworkSecurityGroupSecurityRules (very important for rule changes)
      • If you cannot choose multiple explicitly, create multiple event type conditions combined with “Any” (OR) or create multiple rules (one per event type).
  6. Under Actions, choose:
    • Action Type: Notifications
    • Topic: select nsg-change-alerts-topic.
  7. Click Create Rule.

4. (Optional) Narrow Down with Additional Filters

If you only want events for certain compartments or tags:
  1. Edit the rule you just created.
  2. Under Condition, add a Custom Event Filter using Event JSON (Advanced) or UI filters such as:
    • Compartment OCID
    • Defined tags / freeform tags
  3. Save the rule.

5. Test the Configuration

  1. Go to NetworkingVirtual Cloud NetworksNetwork Security Groups.
  2. In the target compartment, pick an NSG.
  3. Perform a change, for example:
    • Add or remove an NSG security rule, or
    • Create a new NSG.
  4. Within a few minutes, you should receive an email (or selected protocol) indicating an NSG change event.

This setup ensures OCI monitoring/alerting is in place for any NSG configuration changes via the Events service integrated with Notifications.
In OCI, configuration-change “alarms” for NSGs are implemented with Events + Notifications, not Monitoring metrics. Below are the exact steps using the OCI CLI.

1. Prerequisites

Make sure your CLI is configured and you have:

2. Create a Notifications Topic


3. Create a Subscription (e.g., Email)

Then confirm the subscription from the email you receive.

4. Create an Events Rule for NSG Changes

This rule triggers when NSGs are created/updated/deleted or when rules change.Prepare the condition JSON (you can inline it or put it in a file nsg-change-condition.json):
If in a file, create the rule:
(If you want a global rule, you can omit the compartmentId filter from additionalDetails.)

5. Test the Alert

Perform any NSG change in the compartment (e.g., add a security rule) and verify that you receive an email notification.If you specifically need this expressed as a “Monitoring alarm,” you would still rely on this Events + Notifications pattern, since NSG configuration changes are not exposed as a standard Monitoring metric.
In OCI, configuration changes (including NSG changes) are exposed via Events, not Monitoring metrics.
To “alarm” on NSG changes you create:
  1. A Notifications topic
  2. An Events rule that matches Network Security Group change events and sends them to the topic
  3. (Optionally) subscribe email/Slack/etc. to the topic
Below are step‑by‑step instructions and a Python example using the OCI SDK.

1. Prerequisites

  1. Install OCI Python SDK
  1. Configure OCI CLI profile (used by SDK)
~/.oci/config:
  1. IAM Policies
In the compartment (or tenancy) where you’ll create the rule and topic, add policies like:

2. Create Notifications Topic and Subscription (Python)

You must confirm the subscription from the email that OCI sends.

3. Create Events Rule for NSG Changes (Python)

NSG (Network Security Group) change events come from the Virtual Network service.
We match event types like:
  • com.oraclecloud.virtualnetwork.createNetworkSecurityGroup
  • com.oraclecloud.virtualnetwork.updateNetworkSecurityGroup
  • com.oraclecloud.virtualnetwork.deleteNetworkSecurityGroup
You can use a condition that matches all three:

4. Validate

  1. Create or modify an NSG in the same compartment:
    • e.g., add/remove a security rule.
  2. Wait a few minutes.
  3. You should receive an email notification from the topic you created.

5. Key Points

  • NSG change “alarms” are implemented via Events + Notifications, not standard Monitoring metrics.
  • The Python SDK uses:
    • oci.ons.NotificationControlPlaneClient for topics/subscriptions.
    • oci.events.EventsClient for rules.
  • Make sure the service events is allowed to use the ONS topic via IAM policy.
This change does not force replacement of any existing Network Security Groups; it only creates or updates an alarm resource.To verify, terraform plan should show either:
  • + oci_monitoring_alarm.nsg_change_alarm (if new), or
  • ~ oci_monitoring_alarm.nsg_change_alarm with updates only to fields like namespace, query, destinations, is_enabled, or severity.