Control: 4.11 Ensure a notification is configured for network security group changes
Description
It is recommended to setup an Event Rule and Notification that gets triggered when network security groups are created, updated or deleted. Event Rules are compartment scoped and will detect events in child compartments, it is recommended to create the Event rule at the root compartment level.
Network Security Groups control traffic flowing between Virtual Network Cards attached to Compute instances. Monitoring and alerting on changes to Network Security Groups will help in identifying changes these security controls.
Remediation
From Console
- Go to the Events Service page.
- Select the
compartment
that should host the rule. - Click
Create Rule
. - Provide a
Display Name
andDescription
. - Create a
Rule Condition
by selectingNetworking
in theService Name
Drop-down and selectingNetwork Security Group – Change Compartment
,Network Security Group – Create
,Network Security Group - Delete
andNetwork Security Group – Update
. - In the
Actions
section selectNotifications
asAction Type
. - Select the
Compartment
that hosts theTopic
to be used. - Select the
Topic
to be used. - Optionally add
Tags
to theRule
. - Click
Create Rule
.
From CLI
- Find the
topic-id
of theEvent Rule
which should be used for sending Notifications by using thetopic name
andCompartment OCID
.
oci ons topic list --compartment-id=<compartment OCID> --all --query "data [?name=='<topic_name>']".{"name:name,topic_id:\"topic-id\""} --output table
- Create a JSON file to be used when creating the
Event Rule
. Replacetopic id
,display name
,description
andcompartment OCID
.
{ "actions": { "actions": [ { "actionType": "ONS", "isEnabled": true, "topicId": "<topic id>" }] }, "condition": { "eventType": ["com.oraclecloud.virtualnetwork.changenetworksecuritygroupcompartment", "com.oraclecloud.virtualnetwork.createnetworksecuritygroup", "com.oraclecloud.virtualnetwork.deletenetworksecuritygroup", "com.oraclecloud.virtualnetwork.updatenetworksecuritygroup"], "data":{} }, "displayName": "<display name>", "description": "<description>", "isEnabled": true, "compartmentId": "compartment OCID"}
- Create the actual
event rule
.
oci events rule create --from-json file://event_rule.json
- Note in the JSON returned that it lists the parameters specified in the JSON file provided and that there is an
OCID
provided for theEvent Rule
.
Usage
Run the control in your terminal:
powerpipe control run oci_compliance.control.cis_v200_4_11
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run oci_compliance.control.cis_v200_4_11 --share
SQL
This control uses a named query:
events_rule_notification_network_security_list_changes