More Info:
Ensure Event Rules capture IAM Policy modifications. Policy changes must trigger events so that security orchestration tools can validate the change against approved infrastructure-as-code deployments.Risk Level
MediumAddress
Compliance, SecurityCompliance 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)
- Essential 8
- 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 CSF
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- PCI
- SOC2
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are step‑by‑step instructions to set up an OCI Event Rule for IAM policy changes and wire it into OCI alerting/monitoring using the OCI Console.
You now have an OCI Event Rule that detects IAM policy changes and pushes alerts via OCI Notifications, which is the standard mechanism used by OCI Monitoring/Alerting for event-based notifications.
1. Create (or choose) a Notifications Topic
- Sign in to the OCI Console.
- In the top-left menu, go to Developer Services > Application Integration > Notifications.
- Make sure you’re in the correct region.
- Click Create Topic.
- Name:
iam-policy-changes-topic(or any name you prefer) - Description:
Alerts for IAM policy create/update/delete
- Name:
- Click Create.
Add a Subscription (email/SNS/Slack/etc.)
- Open the topic you just created.
- Under Subscriptions, click Create Subscription.
- Set:
- Protocol: e.g.,
Email - Endpoint: your email address (or webhook/Slack URL, etc.).
- Protocol: e.g.,
- Click Create.
- If using Email, check your inbox and confirm the subscription via the link.
2. Create an Event Rule for IAM Policy Changes
- In the top-left menu, go to
Observability & Management > Events Service > Rules. - Make sure you’re in the same region as the resources/policies you care about.
- Click Create Rule.
Basic Rule Configuration
- Name:
iam-policy-changes-rule - Description:
Trigger notification when IAM policies are created, updated, or deleted - State: Leave as Enabled.
Define the Event Pattern
You want events from the Identity service when policies change.- Under Rule Conditions, choose:
- Rule Type:
Event Type
- Rule Type:
- Configure:
- Service Name:
Identity - Event Types (select all that are available for IAM policies in your tenancy/region, typically):
- Create Policy
(com.oraclecloud.identitycontrolplane.createpolicy) - Update Policy
(com.oraclecloud.identitycontrolplane.updatepolicy) - Delete Policy
(com.oraclecloud.identitycontrolplane.deletepolicy) - Optionally, Change Policy Compartment
(com.oraclecloud.identitycontrolplane.changepolicycompartment) if listed.
- Create Policy
- Service Name:
- Under Condition (optional), you can add a filter on:
data.compartmentId=<OCID of the compartment>
ordata.additionalDetails.compartmentName=<compartment-name>
3. Add the Action: Send to Notifications
- Under Actions, click Add Action.
- Action Type:
Notifications - Topic: select the topic you created earlier
e.g.,iam-policy-changes-topic. - (Optional) Add additional actions if needed (e.g., trigger a Function).
4. Test the Alert
- Ensure your subscription (email, etc.) is confirmed.
- As a test, perform one of the following in the Identity service:
- Create a new IAM policy.
- Edit an existing IAM policy (e.g., change a statement).
- Delete a test policy.
- Within a short time, you should receive an alert through your Notifications subscription.
You now have an OCI Event Rule that detects IAM policy changes and pushes alerts via OCI Notifications, which is the standard mechanism used by OCI Monitoring/Alerting for event-based notifications.
Using CLI
Using CLI
Below is a minimal, end‑to‑end way to set up an OCI Event Rule for IAM policy changes and send alerts using OCI CLI.Assumptions:
(Optional) Set region in your CLI config or in each command with
Capture the topic OCID from the output:
Confirm the subscription from your email before testing.
Replace:Alternatively, inline:
Check that:
This sets up continuous alerting for OCI IAM policy create/update/delete using Events + Notifications via OCI CLI. Monitoring Alarms are not used here because IAM policy changes are event-driven, not metric-based.
- You already have
ociCLI configured (~/.oci/config) - You know your compartment OCID and tenancy region
1. Set environment variables
--region.2. Create a Notifications topic
3. Create a subscription (email example)
4. Create the IAM Policy Change Event Rule
Create a JSON fileiam-policy-change-rule.json:OCID_OF_TENANCY_OR_ROOT_COMPARTMENTwith your tenancy or root compartment OCID (policies live there).OCID_OF_TOPICwith$TOPIC_OCID.
5. Verify the rule
isEnabledistrueconditioncontains the three policy event typesactions.actions[0].topicIdis your Notification topic
6. Test the alert
Make a small change to an IAM policy (e.g., add/remove a statement) via Console or CLI, then confirm you receive an email from the Notifications topic.This sets up continuous alerting for OCI IAM policy create/update/delete using Events + Notifications via OCI CLI. Monitoring Alarms are not used here because IAM policy changes are event-driven, not metric-based.
Using Python
Using Python
Below are the steps and a Python example to ensure OCI has an Event Rule for IAM policy changes and alerts via Monitoring/Notifications.
You can add
1. What you need first
- OCI Tenancy OCID
- Compartment OCID where you will create the rule
- Region
- Configured OCI credentials (config file
~/.oci/configwith a profile, or instance/principal auth) - An email address (or other channel) for notification
- OCI Events to capture IAM policy changes
- OCI Notifications to send alerts
- Optionally, Monitoring alarms if you want metric-based alerts (but usually Events + Notifications is enough for IAM changes)
2. Install Python SDK
3. Event pattern for IAM policy changes
Use an Events rule with this event pattern (no spaces/newlines when passing as JSON string):updatepolicy as needed, depending on your tenancy.4. Full Python script (create topic, subscription, and event rule)
5. Steps to use
- Update the variables at the top of the script:
COMPARTMENT_OCIDTENANCY_OCID(optional in this script but good to keep)REGIONALERT_EMAIL
- Ensure your
~/.oci/configis correctly configured with the given profile. - Run the script:
- Open the confirmation email from OCI Notifications and confirm the subscription.
- Test by creating/updating/deleting an IAM policy; you should receive an alert.
Using Terraform
Using Terraform
oci_events_rule.iam_policy_change_events will be created or updated in place.Verification: terraform plan should show either a new oci_events_rule.iam_policy_change_events resource being created, or an in-place update where the condition now includes the three IAM policy event types (and the actions block, if added).
