Skip to main content

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

High

Address

Compliance, Security

Compliance 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

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

  1. Sign in to the OCI Console.
  2. In the left menu, go to:
    Identity & Security → Vault.
  3. Select the Compartment where your vault resides.
  4. Click on the Vault that contains the KMS keys you want to rotate.

2. Enable / Configure Automatic Rotation to 90 Days

  1. Inside the selected vault, go to the Keys tab.
  2. Click on the Key you want to configure.
  3. On the key details page, click Edit (or Edit Key / Edit Key Rotation, depending on UI version).
  4. Find the Automatic Key Rotation (or Rotation Interval) section.
  5. Set:
    • Enable Automatic Rotation: ON
    • Rotation Interval (days): enter 90
  6. Click Save Changes (or Update).
Repeat this for every customer-managed key that must comply with the 90-day rotation requirement.

3. (Optional) Perform Immediate Manual Rotation

If a key is already older than 90 days and needs immediate rotation:
  1. On the same Key Details page, click Create New Key Version (or Rotate Key Now).
  2. Confirm rotation.
    OCI creates a new key version and automatically starts using it for new encrypt operations.

4. Verify Configuration for Monitoring / Compliance

  1. Go back to Identity & Security → Vault → [Your Vault] → Keys.
  2. For each key:
    • Confirm Automatic rotation is Enabled.
    • Confirm Interval is set to 90 days.
  3. 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.
This configuration will satisfy the “OCI Encryption KMS Keys Should Be Rotated Every 90 Days” requirement using only the OCI Console.
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.

1. Prerequisites

  1. Install and configure OCI CLI:
  2. Have the following:
    • Compartment OCID: ocid1.compartment.oc1...
    • Vault OCID: ocid1.vault.oc1... (optional filter)
    • IAM policy that lets your user/group manage keys:
Set some environment variables to simplify commands:

2. List Keys and Find Those Older Than 90 Days

Get all keys in the compartment (optionally filter by vault):
To get keys whose latest version is older than 90 days, use jq and some shell:
This prints keys that should be rotated.

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.
Verify versions:

4. Script: Automatically Rotate Keys Older Than 90 Days

You can combine monitoring and rotation:
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.
Here’s how to enforce “KMS keys rotated every 90 days” in OCI using Python, by:
  1. Enabling automatic rotation (preferred), or
  2. Implementing your own monitoring + rotation script.

1. Prerequisites

  1. Install the OCI Python SDK:
  2. Configure OCI CLI/auth (SDK uses same config):
    This creates ~/.oci/config with:
    • tenancy
    • user
    • fingerprint
    • key_file
    • region
  3. Ensure your user or instance principal has permissions:

If the policy is “every 90 days”, you can set automatic rotation on each key.
You can loop over all keys in a vault/tenancy and set this.

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:
  1. Lists keys.
  2. Gets the creation time or last key version creation time.
  3. If older than 90 days, calls create_key_version to rotate.

Helper: get age of latest key version

Rotate if older than 90 days

You can run this script daily via a scheduled job (e.g., OCI Functions + Service Connector / Events, or a cron job in a VM).

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
Example: print report of non-compliant keys:
Then you can wire this into:
  • 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.
Terraform for the 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.
Verification in Terraform: 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.