turbot/steampipe-mod-aws-compliance

Control: 3.6 Ensure rotation for customer-created symmetric CMKs is enabled

Description

AWS Key Management Service (KMS) allows customers to rotate the backing key, which is key material stored within the KMS that is tied to the key ID of the customer-created customer master key (CMK). The backing key is used to perform cryptographic operations such as encryption and decryption. Automated key rotation currently retains all prior backing keys so that decryption of encrypted data can occur transparently. It is recommended that CMK key rotation be enabled for symmetric keys. Key rotation cannot be enabled for any asymmetric CMK.

Rotating encryption keys helps reduce the potential impact of a compromised key, as data encrypted with a new key cannot be accessed with a previous key that may have been exposed. Keys should be rotated every year or upon an event that could result in the compromise of that key.

Remediation

From Console

  1. Sign in to the AWS Management Console and open the KMS console at: https://console.aws.amazon.com/kms.
  2. In the left navigation pane, click Customer-managed keys.
  3. Select a key with Key spec = SYMMETRIC_DEFAULT that does not have automatic rotation enabled.
  4. Select the Key rotation tab.
  5. Check the Automatically rotate this KMS key every year box.
  6. Click Save.
  7. Repeat steps 3–6 for all customer-managed CMKs that do not have automatic rotation enabled.

From Command Line

  1. Run the following command to enable key rotation:
aws kms enable-key-rotation --key-id <kms-key-id>

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.cis_v400_3_6

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_compliance.control.cis_v400_3_6 --share

SQL

This control uses a named query:

select
arn as resource,
case
when origin = 'EXTERNAL' then 'skip'
when key_state = 'PendingDeletion' then 'skip'
when key_state = 'Disabled' then 'skip'
when not key_rotation_enabled then 'alarm'
else 'ok'
end as status,
case
when origin = 'EXTERNAL' then title || ' has imported key material.'
when key_state = 'PendingDeletion' then title || ' is pending deletion.'
when key_state = 'Disabled' then title || ' is disabled.'
when not key_rotation_enabled then title || ' key rotation disabled.'
else title || ' key rotation enabled.'
end as reason
, region, account_id
from
aws_kms_key
where
key_manager = 'CUSTOMER';

Tags