Skip to main content

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

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)
  • 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

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.

1. Create (or choose) a Notifications Topic

  1. Sign in to the OCI Console.
  2. In the top-left menu, go to Developer Services > Application Integration > Notifications.
  3. Make sure you’re in the correct region.
  4. Click Create Topic.
    • Name: iam-policy-changes-topic (or any name you prefer)
    • Description: Alerts for IAM policy create/update/delete
  5. Click Create.

Add a Subscription (email/SNS/Slack/etc.)

  1. Open the topic you just created.
  2. Under Subscriptions, click Create Subscription.
  3. Set:
    • Protocol: e.g., Email
    • Endpoint: your email address (or webhook/Slack URL, etc.).
  4. Click Create.
  5. If using Email, check your inbox and confirm the subscription via the link.

2. Create an Event Rule for IAM Policy Changes

  1. In the top-left menu, go to
    Observability & Management > Events Service > Rules.
  2. Make sure you’re in the same region as the resources/policies you care about.
  3. Click Create Rule.

Basic Rule Configuration

  1. Name: iam-policy-changes-rule
  2. Description: Trigger notification when IAM policies are created, updated, or deleted
  3. State: Leave as Enabled.

Define the Event Pattern

You want events from the Identity service when policies change.
  1. Under Rule Conditions, choose:
    • Rule Type: Event Type
  2. 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.
(Names may appear in friendly form; just select all IAM “Policy” related event types.)If you want to scope to a specific compartment:
  • Under Condition (optional), you can add a filter on:
    • data.compartmentId = <OCID of the compartment>
      or
    • data.additionalDetails.compartmentName = <compartment-name>

3. Add the Action: Send to Notifications

  1. Under Actions, click Add Action.
  2. Action Type: Notifications
  3. Topic: select the topic you created earlier
    e.g., iam-policy-changes-topic.
  4. (Optional) Add additional actions if needed (e.g., trigger a Function).
Click Create Rule to save.

4. Test the Alert

  1. Ensure your subscription (email, etc.) is confirmed.
  2. 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.
  3. 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.
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:
  • You already have oci CLI configured (~/.oci/config)
  • You know your compartment OCID and tenancy region

1. Set environment variables

(Optional) Set region in your CLI config or in each command with --region.

2. Create a Notifications topic

Capture the topic OCID from the output:

3. Create a subscription (email example)

Confirm the subscription from your email before testing.

4. Create the IAM Policy Change Event Rule

Create a JSON file iam-policy-change-rule.json:
Replace:
  • OCID_OF_TENANCY_OR_ROOT_COMPARTMENT with your tenancy or root compartment OCID (policies live there).
  • OCID_OF_TOPIC with $TOPIC_OCID.
Then run:
Alternatively, inline:

5. Verify the rule

Check that:
  • isEnabled is true
  • condition contains the three policy event types
  • actions.actions[0].topicId is 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.
Below are the steps and a Python example to ensure OCI has an Event Rule for IAM policy changes and alerts via Monitoring/Notifications.

1. What you need first

  • OCI Tenancy OCID
  • Compartment OCID where you will create the rule
  • Region
  • Configured OCI credentials (config file ~/.oci/config with a profile, or instance/principal auth)
  • An email address (or other channel) for notification
You’ll use:
  • 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):
You can add updatepolicy as needed, depending on your tenancy.

4. Full Python script (create topic, subscription, and event rule)


5. Steps to use

  1. Update the variables at the top of the script:
    • COMPARTMENT_OCID
    • TENANCY_OCID (optional in this script but good to keep)
    • REGION
    • ALERT_EMAIL
  2. Ensure your ~/.oci/config is correctly configured with the given profile.
  3. Run the script:
  4. Open the confirmation email from OCI Notifications and confirm the subscription.
  5. Test by creating/updating/deleting an IAM policy; you should receive an alert.
If you want, I can also add Monitoring alarms on top of this to track a metric for policy changes.
This change does not force replacement of other resources; 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).