More Info:
Track interactive console logons via Event Rules. For highly automated environments, interactive human console access should be rare and heavily scrutinized for anomalies.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
- 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 concise, console‑only steps to set up an OCI Event Rule and alerting for interactive (console) logins.
This remediates the issue by ensuring all interactive (console) logins generate an OCI Event which triggers a Notification alert.
1. Prerequisites
-
You must have:
- Permission to manage
events-rulesandons(Notifications) in the compartment. - An email (or other channel) you can subscribe with.
- Permission to manage
- Sign in to the OCI Console.
2. Create a Notification Topic
- In the OCI Console, open the Navigation Menu.
- Go to Developer Services → Application Integration → Notifications.
- Click Create Topic.
- Enter:
- Name: e.g.,
interactive-login-alerts - Compartment: choose the compartment where you want to manage alerts.
- Name: e.g.,
- Click Create.
Add a Subscription
- On the topic details page, under Subscriptions, click Create Subscription.
- Select Protocol (e.g.,
Email). - Enter Endpoint (e.g., your email address).
- Click Create.
- Check your email and confirm the subscription.
3. Create an Event Rule for Interactive Logins
- Open the Navigation Menu.
- Go to Developer Services → Application Integration → Events Service.
- Make sure you’re in the correct Compartment.
- Click Create Rule.
Rule Details
- Name:
interactive-console-login-events - (Optional) Description:
Rule to capture interactive (console) login events - State: leave as Enabled.
Define the Event Pattern
You can do this in either Basic mode (if available) or Advanced (JSON) mode. To be explicit, use Advanced (JSON):- Select Advanced editor for the event pattern.
-
Use a filter similar to:
Notes:
accept= successful interactive login.reject= failed interactive login.- If your tenancy uses slightly different event types, use the Events → Event Logs page to inspect a recent login event and adjust the
eventTypevalues accordingly.
- Click Show preview (if present) to validate, then Save or Next.
Add an Action (Send Notification)
- Under Actions, click Add Action.
- Action Type:
Notifications. - Topic: choose the topic you created earlier (e.g.,
interactive-login-alerts). - (Optional) Add free-form tags or defined tags as needed.
- Click Create (or Save).
4. Verify the Rule
- Log out of OCI.
- Log back in via the web console (an interactive login).
- Check:
- Notifications: email (or other protocol) message should arrive.
- Events Service → Event Logs: confirm login events are being captured and match your rule’s
eventType.
This remediates the issue by ensuring all interactive (console) logins generate an OCI Event which triggers a Notification alert.
Using CLI
Using CLI
Below is a concrete, CLI‑only way to fix this by creating:
Save the topic OCID from the output:
Go to your email inbox and confirm the subscription (OCI won’t send messages until confirmed).
Now create the rule (Events service):This remediates the “no event rule for interactive logins” gap by at least ensuring all login events generate notifications.
Update the rule:
This gives you an OCI Events rule (monitored via Notifications) that alerts on interactive/console logins, created and managed entirely with the OCI CLI.
- An Events rule that watches for interactive (console) logins
- A Notifications topic + subscription so you actually get alerted
<...>) with your values.1. Set some reusable variables
2. Create a Notifications topic
3. Create a subscription (email example)
4. Create an Events rule for interactive (console) logins
OCI emits IAM login events like:com.oraclecloud.identitycontrolplane.login.acceptcom.oraclecloud.identitycontrolplane.login.reject(orlogin.failuredepending on tenancy/region)
data.additionalDetails.authenticationMechanism or similar fields. Because the exact field can vary, here is a broad but safe starting filter that watches all logins; you can then narrow it down after you inspect a few sample events.4.1: Broad login rule (accept + failure)
Create a filelogin_rule_condition.json:5. (Optional but recommended) Refine to “interactive / console” only
After a few events arrive, take one event payload (from the email or from the Events history in the console) and note the fields that identify a console/interactive login, for example:data.additionalDetails.authTypeordata.additionalDetails.authenticationMechanism- or similar field with value like
"UI","console", or"password"
login_rule_condition.json to be more specific. Example (you must adapt the field names/values to what you actually see):This gives you an OCI Events rule (monitored via Notifications) that alerts on interactive/console logins, created and managed entirely with the OCI CLI.
Using Python
Using Python
Below is a concise, practical way to remediate this in OCI using Python and the OCI SDK:Goal:
Create an Event Rule that triggers on interactive logins (Audit events) and sends alerts (Notifications / Monitoring).
A common pattern for user sign‑in is:or a broader pattern (if you need to match more than one event type):Adjust this expression to match exactly what your environment produces (you can inspect recent Audit logs in the Console → Audit).
Wait for the subscription confirmation email and confirm it.
Notes:
Create an Event Rule that triggers on interactive logins (Audit events) and sends alerts (Notifications / Monitoring).
0. Prereqs
-
Install OCI SDK:
-
Configure OCI CLI profile (used by SDK):
This creates
~/.oci/configwith a profile (e.g.DEFAULT). -
Make sure:
- You have permission to manage
events-rules,ons-topics,ons-subscriptions. - Audit is enabled (it is by default in OCI tenants).
- You have permission to manage
1. Decide the “Interactive Login” Event Filter
Audit events come fromcom.oraclecloud.identitycontrolplane (sign‑in, token, etc.).A common pattern for user sign‑in is:
eventTypecontainingLoginor similar identity events.data.identity.type = "user"data.subjectordata.identity.principalNameis the username.
2. Python Script – Create Notification Topic & Subscription
This creates a Notifications topic and subscribes your email to it. The Event Rule will publish to this topic.3. Python Script – Create Event Rule for Interactive Logins
This rule will listen to Audit events and send them to the Notifications topic.conditionmust match the Audit event schema in your tenancy.- If your audit events use a slightly different event type, query Audit logs (Console) and adjust accordingly.
4. Validate
- Perform an interactive login (or have a test user log in).
- Check:
- Audit: event is logged.
- Events: Event Rule is
ACTIVE. - Notifications: email alert is received.
5. Optional – Turn This into “Monitoring Alarm”
If you must use Monitoring Alarms (metrics-based) instead of only Events:- Create a custom metric that increments on each login via an OCI Function or Stream/Log pipeline invoked by the Event Rule.
- Create an Alarm on that metric using the Monitoring service (via Python
oci.monitoring.MonitoringClient).
condition JSON to use.Using Terraform
Using Terraform
oci_events_rule this way, Terraform will update it in place (no replacement/outage), unless you change immutable attributes like compartment_id, which would force recreation.To verify, run terraform plan and ensure it shows an in-place update (or creation) of oci_events_rule.interactive_console_logins with the new condition JSON and the desired actions block.
