More Info:
KMS keys should be rotated at least every 90 days. Frequent rotation limits the amount of data encrypted under a single key version, reducing exposure from a key compromise.Risk 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)
- GDPR
- HIPAA
- HITRUST CSF
- 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
- Reserve Bank of India (RBI) Cyber Security Framework
- 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 the steps to ensure OCI KMS keys are rotated every 90 days using the OCI Console (Vault service).
1. Navigate to the Vault and Keys
- Sign in to the OCI Console.
- In the left menu, go to:
Identity & Security → Vault. - Select the Compartment where your vault resides.
- Click on the Vault that contains the KMS keys you want to rotate.
2. Enable / Configure Automatic Rotation to 90 Days
- Inside the selected vault, go to the Keys tab.
- Click on the Key you want to configure.
- On the key details page, click Edit (or Edit Key / Edit Key Rotation, depending on UI version).
- Find the Automatic Key Rotation (or Rotation Interval) section.
- Set:
- Enable Automatic Rotation: ON
- Rotation Interval (days): enter 90
- Click Save Changes (or Update).
3. (Optional) Perform Immediate Manual Rotation
If a key is already older than 90 days and needs immediate rotation:- On the same Key Details page, click Create New Key Version (or Rotate Key Now).
- Confirm rotation.
OCI creates a new key version and automatically starts using it for new encrypt operations.
4. Verify Configuration for Monitoring / Compliance
- Go back to Identity & Security → Vault → [Your Vault] → Keys.
- For each key:
- Confirm Automatic rotation is Enabled.
- Confirm Interval is set to 90 days.
- If you use OCI Security Zones, Cloud Guard, or a 3rd-party CSPM:
- Trigger or wait for the next re-scan so that it picks up the new rotation setting and clears the “KMS Keys Should Be Rotated Every 90 Days” finding.
Using CLI
Using CLI
In OCI, “rotating” a KMS key means creating a new key version. Apps keep using the same key OCID; OCI automatically uses the latest active version.Below is how to (1) monitor key age and (2) rotate keys older than 90 days using the OCI CLI.
To get keys whose latest version is older than 90 days, use This prints keys that should be rotated.
Run this script via a scheduled mechanism (cron, OCI Functions, or external scheduler) every day or week to enforce the “rotate every 90 days” requirement.
If you tell me your exact vault and compartment structure, I can tailor the CLI filters or the script to match your environment more precisely.
1. Prerequisites
- Install and configure OCI CLI:
- Have the following:
- Compartment OCID:
ocid1.compartment.oc1... - Vault OCID:
ocid1.vault.oc1...(optional filter) - IAM policy that lets your user/group manage keys:
- Compartment OCID:
2. List Keys and Find Those Older Than 90 Days
Get all keys in the compartment (optionally filter by vault):jq and some shell:3. Rotate a Key (Create New Version) via CLI
To rotate a single key:- This creates a new key version.
- OCI automatically uses the newest version for future crypto operations.
- You typically do not need to change the key OCID in applications.
4. Script: Automatically Rotate Keys Older Than 90 Days
You can combine monitoring and rotation:If you tell me your exact vault and compartment structure, I can tailor the CLI filters or the script to match your environment more precisely.
Using Python
Using Python
Here’s how to enforce “KMS keys rotated every 90 days” in OCI using Python, by:
You can loop over all keys in a vault/tenancy and set this.
You can run this script daily via a scheduled job (e.g., OCI Functions + Service Connector / Events, or a cron job in a VM).
Then you can wire this into:
If you tell me how you’re currently running “OCI Encryption Monitoring” (function, VM, CI job, etc.), I can adapt this into a single ready-to-run script for that environment.
- Enabling automatic rotation (preferred), or
- Implementing your own monitoring + rotation script.
1. Prerequisites
-
Install the OCI Python SDK:
-
Configure OCI CLI/auth (SDK uses same config):
This creates
~/.oci/configwith:tenancyuserfingerprintkey_fileregion
-
Ensure your user or instance principal has permissions:
2. Enabling Automatic Rotation Every 90 Days (Recommended)
If the policy is “every 90 days”, you can set automatic rotation on each key.List all keys in a specific vault and enable rotation
3. Monitoring + Manual Rotation (If Auto-Rotation Not Used/Supported)
You can implement a monitoring script that:- Lists keys.
- Gets the creation time or last key version creation time.
- If older than 90 days, calls
create_key_versionto rotate.
Helper: get age of latest key version
Rotate if older than 90 days
4. Basic “Monitoring” Output / Alerting
To align with “Encryption Monitoring”, you may simply:- Log which keys are:
- Not using auto-rotation, or
- Older than 90 days.
- Export results to:
- OCI Logging
- Email via OCI Notifications
- Any SIEM
- OCI Notifications (publish message)
- Email/slack via separate process.
If you tell me how you’re currently running “OCI Encryption Monitoring” (function, VM, CI job, etc.), I can adapt this into a single ready-to-run script for that environment.
Using Terraform
Using Terraform
Terraform for the Verification in Terraform:
oci_kms_key resource does not expose any argument to configure automatic rotation or a rotation interval, so this finding cannot be remediated purely via Terraform; configure key rotation in the OCI Console (Vault → Keys → select key → Enable/Configure Auto Rotation) or via scheduled OCI CLI/SDK automation instead.terraform plan will not show any field related to rotation interval or automatic rotation for oci_kms_key; rotation must be verified in the OCI Console under the key’s rotation settings.
