More Info:
Unauthorized API calls, especially by root or admin-level entities, must trigger alerts. This is a critical indicator of privilege escalation or internal reconnaissance by a threat actor.Risk Level
HighAddress
Compliance, SecurityCompliance Standards
- APRA CPS 234 (Australia)
- AWS Startup Security Baseline
- 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
- 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 concise, console-based steps to configure an alarm for root activity in OCI Monitoring. This uses:
If you share exactly how you identify the “root account” in your tenancy (user OCID, group, or specific IAM conditions), I can give you a more precise filter expression for the Service Connector.
- Audit → Logs
- Service Connector → Custom Metric in Monitoring
- Alarm → Notification to email/Slack/etc.
1. Prerequisites
-
Make sure:
- Audit is enabled (it is on by default for all compartments).
- You have permissions for:
audit,logging,sch(Service Connector Hub),metrics, andons(Notifications).
-
Decide:
- Which compartment to monitor (often the root compartment/tenancy).
- Where to put:
- The Service Connector
- The Custom Metric compartment (often same as tenancy or a central ops compartment)
- The Alarm and Notification topics
2. Confirm Audit Logs Are Flowing to Logging
- In OCI Console, open the navigation menu.
- Go to Observability & Management → Logging.
- Under Logs, select the compartment where Audit logs should appear.
- Ensure there is a log group such as
Default Audit Logsand that Audit logs exist (filter byService = Auditor check for recent events).
- Go to Identity & Security → Audit.
- Choose your compartment (root / tenancy).
- Confirm events exist. By default, they are exported to the Logging service for 90 days; if not, configure a log as needed.
3. Create a Service Connector to Turn Root Activity into a Custom Metric
You will create a Service Connector that:- Source: Audit Logs
- Target: Monitoring custom metrics
- Filter: Only events where the actor is the tenancy’s root user (OCID of root user) or equivalent high-privilege user.
-
Find the root user OCID:
- Go to Identity & Security → Users.
- Locate the tenancy root user (often the first user or the user associated with the tenancy).
- Copy the root User OCID.
- Go to Observability & Management → Service Connector Hub.
- Click Create service connector.
-
Basics:
- Name: e.g.,
Root-Activity-to-Metrics - Compartment: choose your central ops / security compartment.
- Name: e.g.,
-
Source:
- Select Logging.
- Choose:
- Log group containing your Audit logs (e.g.,
Default Audit Logs). - Log: the Audit log.
- Log group containing your Audit logs (e.g.,
-
Filter (important):
- Under Stream logs by specifying filters, add a filter to match Audit events where:
data.identity.principalId = "<ROOT_USER_OCID>"
(replace with the OCID you copied)
- Example filter (JSON filter expression, depending on UI version):
- If
principalEmailoruserNameis easier to filter on in your environment, adjust the field accordingly (e.g.,data.identity.userName).
- Under Stream logs by specifying filters, add a filter to match Audit events where:
-
Target:
- Choose Monitoring.
- Metric namespace: e.g.,
security_root_activity. - Metric name: e.g.,
root_actions_count. - Dimensions (recommended):
compartmentId,eventName,requestAction,requestResource, etc.
- Value: typically
1per event (the target UI usually defaults to counting occurrences).
- Save and Activate the service connector.
4. Verify the Custom Metric
- Go to Observability & Management → Monitoring → Metrics Explorer.
- In Compartment, pick the compartment where metrics are stored.
- Under Namespace, select
security_root_activity(or the namespace you used). - Under Metric Name, select
root_actions_count. - Adjust time range (e.g., last 1–24 hours).
- Confirm you see metric data when you know root has done an action (you can do a trivial root action to test, like listing resources).
5. Create a Notification Topic (If Not Already)
- Go to Application Integration → Notifications.
- Click Create topic:
- Name: e.g.,
Root-Activity-Alerts. - Compartment: security / ops.
- Name: e.g.,
- Open the topic; click Create subscription.
- Choose Protocol (e.g., Email, HTTPS, Slack via webhook, PagerDuty, etc.).
- Enter the endpoint (email address, webhook URL).
- For email, confirm via the link sent to your email.
6. Create an Alarm on the Root Activity Metric
- Go to Observability & Management → Monitoring → Alarms.
- Click Create alarm.
-
Alarm basics:
- Name:
Root-Activity-Alarm. - Compartment: same as your metrics (or your monitoring compartment).
- Name:
-
Alarm query (example):
- Namespace:
security_root_activity - Metric:
root_actions_count - Statistic:
sum - Interval:
1 minuteor5 minutes. - Use a Monitoring query like:
- This means: trigger if any root activity occurs in the last 5 minutes.
- Namespace:
- Severity: choose Critical (recommended).
-
Destination:
- Select the Notification topic
Root-Activity-Alerts.
- Select the Notification topic
-
Alarm trigger settings:
- Trigger rule: Greater than threshold (as defined above).
- Specify how many consecutive periods should breach before triggering (e.g.,
1period for immediate alert).
- Optional: Suppress (to avoid alert storms) if needed, e.g., auto-resolve or cooldown period.
- Click Create alarm.
7. Test the Alarm
- Perform a test action as root (e.g., view or modify a resource).
- Wait for the monitoring interval (e.g., 5 minutes).
- Confirm:
- The metric updated in Metrics Explorer.
- The alarm enters FIRING.
- You receive the notification via your configured channel.
If you share exactly how you identify the “root account” in your tenancy (user OCID, group, or specific IAM conditions), I can give you a more precise filter expression for the Service Connector.
Using CLI
Using CLI
Below is a CLI-based way to configure an OCI Monitoring alarm for root activity. Because metric names and dimensions can differ between tenancies, the steps first discover the exact Audit metric and then create the alarm.
You can avoid repeating
Inspect the output for a metric that clearly represents root/tenant-level activity (for example, you may see metrics like
Example (you must adapt or, with a dimension (example only):Test your query interactively in the OCI Console (Monitoring → Metrics Explorer) to confirm it returns data when you simulate or view historical root activity.
Replace or:
If you paste the output of step 2 (the relevant metric snippet), I can help you craft the exact
1. Set your common variables
--region by exporting:2. Discover available Audit metrics (to locate root-activity metric)
List metrics for theoci_audit namespace in the root compartment:root_activity, audit_events, etc., with dimensions such as userName, principalId, or flags indicating root usage).Identify:metricName(e.g.root_activity)- Any dimension(s) that distinguish root user or root-compartment actions (e.g.
userName = "ocid1.tenancy.oc1..."orprincipalId = "<root-principal-id>")
3. Build the Monitoring query for “root activity”
A typical query pattern:metricName, dimensionKey, and value based on step 2):4. Create the alarm via OCI CLI
Use the query from step 3 in--query-text.<YOUR_QUERY_TEXT_HERE> with your tested query, for example:5. Verify the alarm
-
List alarms:
-
Describe the alarm to confirm configuration:
- Trigger a controlled root action (if possible) and confirm a notification is sent to the topic.
If you paste the output of step 2 (the relevant metric snippet), I can help you craft the exact
--query-text for your tenancy.Using Python
Using Python
Below is a practical way to remediate this in OCI using Python by creating a Monitoring Alarm that fires whenever there is root user activity (using Audit metrics).
Look for a metric that represents root activity (e.g.,
Adjust:
1. Prerequisites
- Enable Audit in the tenancy (it’s on by default).
- Install OCI Python SDK:
- Configure your
~/.oci/configwith appropriatetenancy,user,fingerprint,key_file,regionand a profile (e.g.DEFAULT). - Have:
- Compartment OCID where you want the alarm created.
- Notification Topic OCID (for OCI Notifications) to receive alerts.
2. Find / Confirm Root Activity Metric
Oracle provides Audit-related metrics in namespaceoci_audit. You should confirm what’s available in your tenancy:auditrootactioncount or similar) or a way to filter on principalId or identity.domain.id/identity.user.name indicating root or tenancy-level identity.Suppose you identified:- Namespace:
oci_audit - Metric:
auditrootactioncount - Dimension for root activity:
principalid = "ocid1.tenancy.oc1..root"(example – adjust to what you actually see).
3. Define the Alarm Query
A typical Monitoring query for “any root action in last minute” might look like:- Metric name
- Dimension key/value (whatever you confirmed in step 2)
- Window
[1m],[5m], etc. - Aggregation
.sum()/.rate()as appropriate.
4. Create the Alarm with Python
5. Validate
- In the OCI Console:
Monitoring → Alarms → locate “Root Activity Alarm”. - Confirm:
- Namespace:
oci_audit. - Query matches what you tested.
- Notification destination is correct.
- Namespace:
- Trigger a test (if possible) or temporarily lower the threshold to confirm a notification is sent.
6. Summary of Remediation
- Identify / confirm the metric(s) representing root activity in
oci_audit. - Craft a Monitoring query that detects non-zero root activity in a small time window.
- Programmatically create an Alarm using the OCI Python SDK with:
namespace="oci_audit"- The root-activity query
- A Notifications topic as the destination.
list_metrics, I can give you a fully tailored query string.Using Terraform
Using Terraform
OCID_OF_ALARM_COMPARTMENTwith the compartment OCID where you manage alarms.OCID_OF_METRIC_COMPARTMENTwith the compartment OCID where the metric is emitted.OCID_OF_OCI_NOTIFICATIONS_TOPICwith your Notifications topic OCID used for alerting.CUSTOM_NAMESPACE_FOR_ROOT_ACTIVITY_METRICSandCUSTOM_METRIC_NAMEwith the actual namespace/metric you publish for unauthorized root/admin API calls, and adjust the dimension filters (userType,responseCode) to match your metric schema.
oci_monitoring_alarm resource.Verification: terraform plan should show one oci_monitoring_alarm.root_unauthorized_api_calls to be created (or updated) with the query condition using your root-activity metric and a threshold of > 0.
