More Info:
An alarm should be configured to trigger on IdentityAuthFailure events. High volumes of authentication failures often indicate brute-force attacks or compromised credentialsRisk 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
- 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
- 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 console-only steps to configure an OCI Monitoring alarm for authentication failures.
If you can share the exact metric namespace/name you see in Metrics Explorer for authentication failures in your tenancy, I can give a concrete query/condition that matches your environment exactly.
1. Prerequisites
-
Permissions
- Your user/group must have policies allowing:
use metrics in compartment <compartment-name>manage alarms in compartment <compartment-name>use ons-topics in compartment <compartment-name>(for notifications)
- Your user/group must have policies allowing:
-
Create a Notification Topic (if you don’t have one)
- In the OCI Console, open the navigation menu.
- Go to Developer Services → Notifications.
- Make sure you’re in the correct compartment.
- Click Create Topic.
- Enter a Name (e.g.,
auth-failure-alerts) and optional Description. - Click Create.
- Open the topic you just created → Create Subscription.
- Choose Protocol (e.g.,
Email), enter your Email address, and click Create. - Confirm the subscription from the email you receive.
2. Identify / Use the Authentication Failure Metric
For most tenants, authentication failures are available via a metric in the Identity / IAM namespace or via custom metrics sourced from Audit/Logging. The most common pattern is:- Namespace: something like
oci_iamoroci_audit(depends on how your environment is set up) - Metric name example:
AuthenticationFailures,AuthFailureCount, or a custom metric name you defined - Dimensions: may include
tenantId,region,identityDomain,userName, etc.
- Go to Observability & Management → Monitoring → Metrics Explorer.
- Select the correct Compartment.
- In Metric Namespace, browse likely namespaces (e.g.,
oci_iam,oci_audit, or your custom namespace). - Check metrics list for a metric related to authentication failures (names often contain
auth,authentication, orlogin). - Once found, note:
- Namespace
- Metric name
- Available dimensions (e.g.,
userName,requestAction,responseCode)
3. Create the Alarm
- In the OCI Console, open the navigation menu.
- Go to Observability & Management → Monitoring → Alarms.
- Select the compartment where you want the alarm defined.
- Click Create alarm.
4. Configure Alarm Details
- Alarm name:
e.g.,authentication-failures-detected - Alarm severity:
Choose e.g., Critical or Warning, depending on your policy. - Alarm body (optional but recommended):
Provide a concise description, e.g.:Triggers when any authentication failures are detected above threshold.
5. Configure the Metric & Trigger
In the Alarm definition section:-
Metric namespace:
Select the namespace you identified, e.g.oci_iamor your custom namespace. -
Metric name:
Select the authentication-failure metric, e.g.AuthenticationFailures(or your actual name). -
Compartment for metric scope:
Choose the compartment that holds the metric (often root compartment/tenancy). -
Dimensions / Filters (optional but recommended):
- You can scope the alarm to a subset, for example:
identityDomain = <your-domain>- Or exclude service accounts, or focus on certain regions.
- In the Dimensions section, set filters as needed (e.g.,
userName != <service-user>if supported).
- You can scope the alarm to a subset, for example:
-
Statistic:
- Typically Sum over the interval is used for counts.
-
Interval:
- Set evaluation interval, e.g. 5 minutes or 1 minute depending on your desired sensitivity and cost.
-
Trigger rule:
- For example:
- Condition:
Sum > 0 - Over: 1 or 2 consecutive periods.
- Condition:
- This means: if there is at least 1 authentication failure in the selected period, alarm fires.
- If you expect occasional benign failures, set a higher threshold, e.g.
Sum > 5in 5 minutes.
- For example:
-
Query Preview:
- Most regions now show an MQL-like expression; confirm that it matches your selected metric and dimensions.
- Use View chart (if available) to verify data is returned and looks correct.
6. Configure Notifications & Lifecycle
-
Destination service:
- Choose Notifications.
-
Topic:
- Select the Notification topic created earlier (e.g.,
auth-failure-alerts).
- Select the Notification topic created earlier (e.g.,
-
Repeat notifications (optional):
- Configure if you want reminders while the alarm remains in
FIRINGstate (e.g., every 60 minutes).
- Configure if you want reminders while the alarm remains in
-
Alarm state:
- Leave as Enabled so it starts evaluating immediately after creation.
- Click Create alarm.
7. Test the Alarm
- Generate a test authentication failure, e.g.:
- Attempt to log in with wrong credentials to OCI Console or an API using bad keys (in a safe/test context).
- Wait one or two evaluation periods (e.g., 5–10 minutes).
- Check:
- Your email (or other endpoint) for a notification.
- The alarm’s state in Monitoring → Alarms (should move to
FIRINGwhen threshold is met and then back toOKwhen failures stop).
8. (Optional) Fine-tune
- If you get too many alerts:
- Increase threshold (e.g.,
Sum > 10). - Increase evaluation period.
- Add filters (e.g., focus on specific identity domain or high-risk regions).
- Increase threshold (e.g.,
- If you miss events:
- Lower the threshold.
- Reduce the period (e.g., from 10 min to 5 min).
If you can share the exact metric namespace/name you see in Metrics Explorer for authentication failures in your tenancy, I can give a concrete query/condition that matches your environment exactly.
Using CLI
Using CLI
Below is one way to configure an OCI Monitoring alarm for authentication failures using the OCI CLI. Adjust the exact metric/namespace to match what you find in your tenancy.
Common patterns you may see (examples; use what you actually find):Note down:
Adjust
Key options:
Check its current state:If needed, update later:This satisfies the requirement that “OCI Monitoring should have authentication failure alarm configured” using OCI CLI.
0. Prerequisites
- OCI CLI configured (
oci setup config) - OCID of:
- Compartment where you want to create the alarm
- Compartment where the metric is emitted (often the root compartment/tenancy)
- An OCI Notifications topic (for email/Slack/etc. alerts)
1. Identify the Authentication Failure Metric
List IAM-related metrics to find the exact name and namespace for authentication failures:- Namespace:
oci_iam - Metric name: e.g.
AuthenticationFailures,AuthFailures,FailedAuthentication
namespace(e.g.oci_iam)name(e.g.AuthenticationFailures)
2. Craft the Alarm Query
Example query to alert if there is at least 1 authentication failure in the last 5 minutes:AuthenticationFailures to the exact metric name you found.You can also filter by dimensions (user, region, etc.) if needed, e.g.:3. Create the Alarm via OCI CLI
Run something like:--compartment-id: where the alarm object lives.--metric-compartment-id: where the metric is emitted (often root/tenancy).--namespace: the metric namespace (e.g.oci_iam).--query-text: the metric expression you built above.--destinations: JSON array of Notifications topic OCIDs.
4. Verify the Alarm
List and inspect the alarm:Using Python
Using Python
Below is how you can set up an OCI Monitoring Alarm for authentication failures using Python and the OCI SDK.Because metric names and namespaces can vary between tenants and regions, you will:
or with filters:Copy this expression.
This creates
- Discover the right metric via CLI/Console.
- Create the alarm via Python using that metric.
1. Discover the Authentication Failure Metric
- Go to OCI Console → Observability & Management → Monitoring → Metrics Explorer.
- Under:
- Compartment: choose the tenancy root (or where IAM/Audit is).
- Service: select your auth-related service (e.g.,
identity,audit, or a custom namespace if you send auth failures as custom metrics).
- Search for metrics that represent authentication failures. Common patterns:
FailedAuthenticationFailedLoginAuthFailure- Anything obviously related to login/auth failures.
- Note:
- Namespace (e.g.,
oci_identity,oci_audit, or your custom namespace). - Metric name (e.g.,
FailedAuthenticationCount). - Dimensions such as
resourceId,region, etc., if present.
- Namespace (e.g.,
2. Python Setup
Install and configure OCI SDK if not done already:~/.oci/config.3. Python Code to Create the Alarm
Below is a full example. Replace the placeholders with the values you found:4. Verifying
- In Console, go to Observability & Management → Monitoring → Alarms.
- Confirm your alarm:
- is Enabled
- has the correct query, threshold, and compartment
- is associated with the correct Notifications topic.
- Trigger a test authentication failure (e.g., deliberate login failure) and confirm:
- the metric increases in Metrics Explorer
- the alarm moves to FIRING and you receive a notification.
5. Hardening Notes
- Use a short evaluation window (e.g.,
metric[1m]ormetric[5m]) for near real-time detection. - Tune thresholds to reduce false positives:
- E.g., multiple failures within 5 minutes.
- Optionally create separate alarms per:
- Region
- Compartment
- Critical users/groups (using metric dimensions in the query).
query_expression line tailored to your environment.Using Terraform
Using Terraform
- Substitute:
OCID_OF_TARGET_COMPARTMENTwith the compartment OCID where the metric is emitted.METRIC_NAMESPACEandMETRIC_NAMEwith the actual namespace/metric that tracksIdentityAuthFailureevents.THRESHOLD_VALUEinside the query with the numeric threshold your policy requires.OCID_OF_OCI_NOTIFICATIONS_TOPICwith an actual Notifications topic OCID.
terraform plan should show a single oci_monitoring_alarm.identity_auth_failure_alarm to be created (or updated in place if you already manage it).
