More Info:
All active IAM users should have Multi-Factor Authentication (MFA) enabled. MFA significantly reduces the risk of account compromise from phishing, credential stuffing, and password reuse attacks.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
- GDPR
- 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
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- PCI
- Reserve Bank of India (RBI) Master Direction – Information Technology Framework
- SOC2
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are concise, console-based steps to remediate “OCI IAM Users Should Have MFA Enabled” by enforcing MFA for users, so that any IAM Monitoring/Cloud Guard detector for non‑MFA users will clear.
Note: OCI now uses Identity Domains for IAM. Steps differ slightly for “local users” (older model) vs identity-domain users. I’ll outline both; use the one that matches what you see in your console.
1. For Identity Domains (Most Current Tenancies)
A. Enroll Users in MFA
- Sign in to the OCI Console as an administrator.
- Open the Navigation menu → Identity & Security → Domains.
- Click the Identity Domain where your users reside (often the default domain).
- In the domain left menu, go to User Management → Users.
- Click a user you want to remediate.
- Scroll to or open the Security / Multi-Factor Authentication section:
- If “MFA Devices” or “Factors” are present, ensure at least one factor is configured (e.g., TOTP/Authenticator app, SMS if available).
- If not configured, inform the user to:
- Sign in to OCI.
- Click their user avatar (top right) → Profile.
- Under Multi-Factor Authentication, click Add Device or similar.
- Register an authenticator app (Google Authenticator, Microsoft Authenticator, etc.) following the QR code + 6‑digit code steps.
Users must complete this themselves; you can only enforce MFA and, in some cases, reset MFA.
B. Enforce MFA with Sign‑On Policy (Tenancy‑Wide / Group‑Based)
- Still in the Identity Domain, in the left menu go to Security → Sign-on Policies.
- Either:
- Edit the Default Sign-on Policy, or
- Click Create sign-on policy to make a new one (recommended if you want gradual rollout).
- In the policy:
- Add a Rule (or edit an existing one) that applies to:
- Users: all users, or target a specific Group (e.g., admins) using conditions.
- In the Actions section, set Prompt for second factor (MFA) = Required.
- Optionally, configure:
- Conditions like IP range, device, network, etc. if you want conditional MFA.
- Add a Rule (or edit an existing one) that applies to:
- Click Save or Create and ensure the policy is Enabled.
- Test with a non‑admin test account:
- Log out, log in with the test user.
- Confirm that, after password, the user is required to set up or use MFA.
2. For Older “Local Users” (No Identity Domains UI)
If your tenancy still shows Identity → Users directly, use these steps:A. Enroll MFA for Local Users
- In the OCI Console, click your user avatar (top right) → User Settings.
- Under Multi-Factor Authentication, click Enable Multi-Factor Authentication or Add Device.
- Follow the prompts to set up:
- An authenticator app (scan QR code, enter 6‑digit code).
- Each local user must repeat these steps for their own account.
Admins cannot completely finish MFA setup on behalf of users; users must scan and confirm.
B. Monitor / Enforce (Cloud Guard / IAM Monitoring)
To support the “OCI IAM Users Should Have MFA Enabled” rule:- Go to Navigation menu → Identity & Security → Cloud Guard.
- Ensure Cloud Guard is Enabled in your region.
- Open your Detector Recipe (or create one) and verify that:
- The relevant detector for IAM user without MFA (names vary; look under IAM / Authentication) is Enabled and Attached to your target (tenancy / compartment).
- For any flagged user in Cloud Guard → Problems:
- Notify the user to follow the MFA enablement steps above.
- After they enable MFA and re‑authenticate, the problem will eventually move to Resolved state.
3. Quick Checklist
- MFA enrollment instructions sent to all affected users.
- Identity Domain Sign-on Policy created/updated to require MFA.
- Policy tested with a non‑admin test user.
- Cloud Guard / IAM Monitoring detector recipe enabled for “Users without MFA”.
- Confirm that previously flagged users show as compliant after MFA enrollment.
Using CLI
Using CLI
Below is how you can remediate “OCI IAM Users Should Have MFA Enabled” using OCI CLI, focused on monitoring and identifying non‑MFA users (which is what Cloud Guard / IAM monitoring rules usually need).Enabling MFA itself always requires a user interaction (scanning QR / entering OTP), so you cannot fully enable MFA purely by CLI; you can only prepare and enforce it and monitor which users are non‑compliant.
If this returns compartments, CLI is working.
Filter for active users only:This gives you a list of IAM users that do not have an MFA TOTP device associated.You can store that list:
Pick the domain id:(If
Look for Adjust JSON to match your existing rules rather than overwriting blindly.
If you share whether you’re using classic IAM or identity domains, I can adjust the exact CLI and
1. Prerequisites
- OCI CLI installed and configured (
oci setup configdone). - Permissions to:
inspect/readusers in the tenancy.inspect/readMFA devices (for non–identity-domain IAM).- Or
readidentity domains and users (for identity domains).
2. Detect IAM Users Without MFA (Traditional “local IAM” Tenancy)
2.1. List all IAM users
2.2. For each user, check whether a TOTP MFA device exists
3. Detect Users Without MFA in an Identity Domain
If your tenancy uses identity domains (recommended modern setup):3.1. List identity domains
3.2. List users in the identity domain
3.3. Check MFA factor enrollment per user
In identity domains, MFA status is reflected inurn:ietf:params:scim:schemas:oracle:idcs:extension:user:User or factor-related attributes. A simple way is to fetch per user:mfaEnabled is not present in your domain, you may need to inspect the idcs extension schema for factors like mfaFactors/devices and adapt the jq filter.)4. Enforce MFA Requirement via Policies (Preventive Control)
You cannot “flip” MFA on for a user via CLI, but you can enforce that interactive sign‑ins use MFA:4.1. For identity domains – enable MFA requirement on sign‑on policy
- Identify the sign‑on policy:
mfaSettings or similar. If your domain has specific sign-on policies, list them:- Update the sign-on policy to require MFA (example only – structure can vary):
5. Link This to “OCI IAM Monitoring” (Cloud Guard / Security Zones)
In Cloud Guard or IAM Security posture checks:-
Use the above CLI scripts in a scheduled job (e.g. OCI Functions, OCI DevOps, or an external system) to:
- Generate a list of users without MFA.
- Push metrics to OCI Monitoring / logs to Logging or send notifications via Notifications service.
-
Create alarms or Cloud Guard custom detectors that trigger on:
- Logs (e.g. “user_without_mfa” entries).
- Or a metric you emit (e.g.
iam.non_mfa_users.count).
If you share whether you’re using classic IAM or identity domains, I can adjust the exact CLI and
jq filters to match your environment.Using Python
Using Python
Below is a step‑by‑step approach to detect and remediate IAM users without MFA in OCI, using Python.
1. Prerequisites
-
Install OCI Python SDK:
-
Configure OCI CLI credentials (SDK uses the same config):
Note the tenancy_ocid, user_ocid, fingerprint, key_file, and region.
-
The user/instance you use for this script must have IAM permissions like:
2. What You Can Do via API
For each IAM user:- Inspect MFA status via
user.capabilities.mfa_activated. - Allow/force the ability to use MFA via
can_use_mfa(but the user must still enroll using an authenticator).
- Detect users with
mfa_activated == False. - Ensure
can_use_mfa == Truefor them. - Optionally: notify or disable users who still don’t enroll after a grace period.
3. Basic Python Script – Detect & Enable MFA Capability
This script:- Lists all users in the tenancy.
- Filters to those that are ACTIVE and do not have MFA activated.
- Sets
can_use_mfa = Truefor those users.
4. Turn This Into “Monitoring”
Option A – Cron / Scheduled Job
- Put this script on a bastion host or CI runner.
-
Run periodically via cron, e.g.:
-
Keep
dry_run=Trueif you only want monitoring and logging, orFalsefor auto‑remediation.
Option B – Log / Notification Integration
Extend the script to:- Send an email/Slack message when users without MFA are found.
- Or write JSON output to a file/stream that another system ingests.
5. Recommended Policy Approach (Optional)
For stricter enforcement:- Use IAM policies and conditional access (in identity domains) to require MFA for console access.
- Combine with the script above to ensure
can_use_mfa=Truefor all users and then disable or quarantine users who don’t enroll in MFA after some time.
Using Terraform
Using Terraform
Terraform cannot enable or enforce MFA on an
oci_identity_user; MFA enrollment in OCI is a per-user, interactive operation that is not exposed as an argument on oci_identity_user or any related Terraform resource.To remediate, you must:- In the OCI Console, go to Identity & Security → Users → [TARGET_USER].
- Use Multi-Factor Authentication (or Manage MFA) to enroll an MFA device for that user and complete the second‑factor setup flow.

