More Info:
Identify rapid, sustained bursts of IdentityAuthFailure from a single source. Prompt detection of brute force attacks allows automated blocking before credentials can be crackedRisk Level
HighAddress
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 is a straightforward way to implement brute‑force detection via OCI Monitoring + Alarms using the OCI Console. The idea is:
- Use Audit logs (failed logins)
- Pipe them through a Service Connector to a custom Monitoring metric
- Create an Alarm on that metric when failures exceed a threshold in a short time
Prerequisites
-
You have permissions to:
- Read Audit logs
- Create Service Connectors
- Create Metrics in Monitoring
- Create Alarms
- Audit is enabled (it is on by default for all tenancies).
Step 1 – Identify Failed Login Events in Audit
- In the OCI Console, go to Observability & Management → Logging → Log Explorer.
-
In the Log Group filter, choose:
- Compartment: root (or tenancy-level compartment)
- Log Source:
audit
-
Use a basic search filter to see failed authentication events, for example:
or (depending on audit event format):
- Confirm that you see failed login events (console logins / API auth failures).
Step 2 – Create a Custom Metric via Service Connector
- Go to Observability & Management → Service Connector Hub → Service Connectors.
- Click Create service connector.
-
Basic details:
- Name:
brute-force-login-metric-sc - Compartment: choose appropriate security/operations compartment.
- Name:
-
Source:
- Source type: Logging
- Log group: choose the Audit log group for the tenancy.
- Logs: select the Audit log.
-
Filter:
-
Use the same filter you tested in Log Explorer, e.g.:
-
Use the same filter you tested in Log Explorer, e.g.:
-
Task:
- Task type: Logging Analytics / Monitoring → select Monitoring (Create custom metric).
-
Metric configuration:
- Namespace:
security_bruteforce(or another name, but note it). - Metric name:
failed_login_attempts - Dimensions (examples – key/value from log fields):
user→data.requestPrincipalNamesource_ip→data.clientIPregion→data.region
- Value: set to
1(each event = one failed attempt). - Unit:
count.
- Namespace:
- Leave aggregation default (count or sum).
- Click Create.
Step 3 – Verify the Custom Metric
- Go to Observability & Management → Monitoring → Metrics Explorer.
- In Compartment, select the compartment where the Service Connector writes metrics.
- In Metric namespace, choose
security_bruteforce(or your chosen namespace). - For Metric, choose
failed_login_attempts. - Set a time window (e.g., last 1 hour).
- You should see data points when failures occur.
Step 4 – Create the Brute Force Detection Alarm
- Go to Observability & Management → Monitoring → Alarms.
- Click Create alarm.
-
Alarm basic info:
- Name:
Brute-Force Login Detection - Compartment: same as metric.
- Status: Enabled.
- Name:
-
Metric selection:
- Metric namespace:
security_bruteforce - Metric name:
failed_login_attempts - Statistic: Sum.
- Interval: e.g., 5 minutes.
- Dimensions: choose how to group:
- To detect per user: group by
user - To detect per IP: group by
source_ip
- To detect per user: group by
- Metric namespace:
-
Alarm condition (example):
- Operator:
Greater than - Threshold:
5 - So:
Sum(failed_login_attempts)[5m] > 5
→ triggers if > 5 failed logins from same user/IP in 5 minutes.
- Operator:
-
Notifications:
- If you don’t have one, first create a Notification topic:
- Go to Developer Services → Notifications (ONS), create topic (e.g.,
security-alerts), and subscribe an email or HTTPS endpoint.
- Go to Developer Services → Notifications (ONS), create topic (e.g.,
- Back in the alarm creation:
- Notification destination: pick that Topic.
- If you don’t have one, first create a Notification topic:
-
Alarm severity:
- Set to Critical or Error.
- (Optional) Repeat notifications: enable if you want recurring alerts while condition persists.
- Click Create alarm.
Step 5 – Test the Alarm
- Intentionally perform several failed logins from the same user or IP to exceed the threshold in the chosen interval.
- Wait a few minutes:
- Confirm in Metrics Explorer that
failed_login_attemptsincreased. - Confirm in Alarms that alarm state goes to FIRING.
- Check that a notification (email/endpoint) is received.
- Confirm in Metrics Explorer that
Operational Tips
- Tune threshold and interval to reduce noise (e.g., 5 attempts in 5 minutes vs. 10 in 10 minutes).
- You can create multiple alarms, e.g.:
- One per user dimension
- One per source_ip dimension.
- Restrict access to the metrics and alarms to security/ops admins only.
Using CLI
Using CLI
Below is one practical way to satisfy “OCI Monitoring should have Brute Force Detection Alarm configured” using OCI Monitoring + Logging, controlled entirely via OCI CLI.Because OCI has no built‑in “Brute Force” metric, the usual pattern is:
Take note of the
Then each offending IP will generate its own alarm notification.
If you share:
- Use Logging to collect authentication failures (e.g., Identity, IAM, or OS/Auth logs).
- Use a Service Connector to push those logs into a custom Monitoring metric.
- Create an OCI Monitoring alarm on that custom metric via OCI CLI.
Prerequisites
- OCI CLI installed and configured (
~/.oci/config). - Tenancy and compartment OCIDs handy.
- IAM permissions to:
- Read logs
- Manage service-connectors
- Manage metrics / alarms
- Use notification topics (ONS)
Step 1 – (If needed) Route “failed login” logs into a custom metric
-
Identify the log(s) that contain authentication failures
For example, IDCS or IAM logs in a compartment:Then: -
Create a Service Connector that:
- Source: Logging
- Target: Monitoring (Metrics)
- Filter: only failed login / auth events
- Metric: e.g., namespace
security_auth, namefailed_login_count
sc-task.json):Create the Service Connector:Adjust the JSON paths (eventName,userName, etc.) to match your log schema.
Step 2 – Decide your Brute Force detection rule
Example brute-force detection heuristic:- If failed_login_count sum over 5 minutes > 10
(either per user/IP or aggregated)
-
All failed logins:
-
Per IP:
Step 3 – Create a Notification Topic (if you don’t have one)
topic-id from the output.Optionally subscribe an email:Step 4 – Create the Brute Force Detection Alarm via OCI CLI
-
Build the alarm body JSON (
alarm-body.json):Notes:queryandruleare both required:ruleis the Boolean condition;querydefines the metric selection.- Adjust the threshold
> 10and windows5mto your policy.
-
Create the alarm:
-
Verify:
Step 5 – (Optional) Brute Force per IP or per User
If you want the alarm to fire when any IP exceeds a threshold:Inalarm-body.json, use:Step 6 – Test the Alarm
- Generate some failed login attempts (in a test account).
- Wait for the metric to ingest and meet your threshold.
- Confirm notifications from the alarm topic.
If you share:
- Where your authentication logs are (IDCS, IAM, OS logs, etc.)
- How you want to define “brute force” (failed attempts, time window, by IP or user),
oci command + JSON tailored to your environment.Using Python
Using Python
Below is a practical way to remediate this by creating an OCI Monitoring Alarm (using Python + OCI SDK) that fires when a “brute force–like” pattern of failed authentications is detected.Because “brute force detection” isn’t a single built‑in metric in OCI, you usually do this in two stages:
Example brute force style query (replace values as needed):
If you share how your failed login signal is generated (IAM logs, WAF, Linux auth logs, etc.), I can give a concrete metric namespace/name and a more precise query.
- Produce a metric that represents failed login attempts (e.g., from IAM logs, OS logs, or WAF logs).
- Create a Monitoring alarm on that metric with a condition that indicates brute force behavior.
1. Prerequisites
-
Install OCI SDK for Python:
-
Configure OCI CLI credentials (used by the SDK):
This creates
~/.oci/configwith: -
Identify:
- Compartment OCID where:
- Your metric is emitted.
- You want the alarm created.
- Notification topic OCID (OCI Notifications) where alerts will be sent.
- Compartment OCID where:
2. Ensure You Have a Metric for Failed Logins
You must have (or create) a metric that reflects failed logins, for example:- From IAM auth logs → send to Logging, then:
- Use Logging Analytics or Service Connector Hub to transform into a custom metric.
- Or from:
- WAF logs (for web login brute force),
- OS-level auth logs (e.g., SSH) shipped via OCI Logging Agent → then to a custom metric.
- Metric namespace:
custom_security - Metric name:
failed_login_count - Dimension:
source(e.g.,ssh,web, etc.)
3. Decide a Brute Force Threshold
Example logic (tune for your environment):- “Trigger if
failed_login_count≥ 20 in 5 minutes”
4. Build the Monitoring Query
OCI Monitoring uses a query language like:custom_security– your metric namespace.failed_login_count– your metric.[5m]– window for evaluation.{source = "ssh"}– optional filter..sum()– sum of failed logins.>= 20– threshold.
5. Python Code: Create the Alarm
Things you must adapt:
COMPARTMENT_OCIDTOPIC_OCIDnamespaceandALARM_QUERY:namespace="custom_security"- Query string with correct metric name + dimensions.
- Threshold numbers and time window to fit your environment.
6. (Optional) Enforce Organization‑wide
If this is part of a security control, you can:- Turn this into a reusable script or Terraform module.
- Run it as part of CI/CD for each compartment/region.
- Periodically verify via script: list alarms and ensure the brute force one exists and is enabled.
If you share how your failed login signal is generated (IAM logs, WAF, Linux auth logs, etc.), I can give a concrete metric namespace/name and a more precise query.
Using Terraform
Using Terraform
oci_monitoring_alarm in place and does not force replacement of other resources; only this alarm resource is added/updated.Verification: terraform plan should show one oci_monitoring_alarm.identity_bruteforce_detection to add (or to update if it already exists), with the query, pending_duration, and related arguments matching the brute-force detection threshold you require.
