Control: 4.2.1 Ensure Block Volumes are encrypted with Customer Managed Keys (CMK)
Description
Oracle Cloud Infrastructure Block Volume service lets you dynamically provision and manage block storage volumes. By default, the Oracle service manages the keys that encrypt this block volume. Block Volumes can also be encrypted using a customer managed key.
Remediation
From Console
- Login into the OCI Console.
- Click in the search bar, top of the screen.
- Type
Advanced Resource Query
and click enter. - Click the
Advanced Resource Query
button in the upper right of the screen. - Enter the following query in the query box:
query volume resources
- For each block volume returned click on the link under
Display name
. - Ensure
Encryption Key
does not sayOracle managed key
. - Repeat for other subscribed regions.
- For each Block Volume in the returned results, click the Block Volume name.
- Click
Assign
next toEncryption Key
. - Select the
Vault Compartment
andVault
. - Select the
Master Encryption Key Compartment
andMaster Encryption key
. - Click
Assign
.
From Command Line
Execute the following command:
for region in `oci iam region list | jq -r '.data[] | .name'`; do for compid in `oci iam compartment list --compartment-id-in-subtree TRUE 2>/dev/null | jq -r '.data[] | .id'` do for bvid in `oci bv volume list --compartment-id $compid --region $region 2>/dev/null | jq -r '.data[] | select(."kms-key-id" == null).id'` do output=`oci bv volume get --volume-id $bvid --region $region --query=data.{"name:\"display-name\","id:id""} --output table 2>/dev/null` if [ ! -z "$output" ]; then echo $output; fi done done done
Ensure query returns no results,
For each
boot volume
identified get its OCID. Execute the following command.
oci bv volume-kms-key update –volume-id <volume OCID> --kms-key-id <kms key OCID>
Usage
Run the control in your terminal:
powerpipe control run oci_compliance.control.cis_v120_4_2_1
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run oci_compliance.control.cis_v120_4_2_1 --share
SQL
This control uses a named query:
blockstorage_block_volume_cmk_encryption_enabled