Skip to main content

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate the KMS Key Rotation misconfiguration in AWS using the AWS console:
  1. Log in to your AWS Management Console.
  2. Navigate to the AWS Key Management Service (KMS) dashboard.
  3. Select the KMS key that needs to be remediated.
  4. Click on the “Key policy” button to view the key policy.
  5. In the key policy, locate the “KeyRotationEnabled” statement. If it is not present, add it to the key policy.
  6. Set the value of “KeyRotationEnabled” to “true”.
  7. Click on the “Save changes” button to save the updated key policy.
After completing these steps, KMS key rotation will be enabled for the selected key. It is recommended to perform this remediation for all KMS keys used in your AWS environment.

To remediate the misconfiguration “KMS Key Rotation Should Be Enabled” for AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI on your local machine or in the AWS Management Console.
  2. Check if the KMS key rotation is enabled or not using the following command:
Note: Replace <key-id> with the ID of the KMS key for which you want to check the rotation status.
  1. If the key rotation is not enabled, enable it using the following command:
Note: Replace <key-id> with the ID of the KMS key for which you want to enable the rotation.
  1. Verify if the key rotation is enabled using the following command:
Note: Replace <key-id> with the ID of the KMS key for which you want to check the rotation status.
  1. Repeat steps 2-4 for all the KMS keys in your AWS account.
By following these steps, you can remediate the misconfiguration “KMS Key Rotation Should Be Enabled” for AWS using AWS CLI.
To remediate KMS Key Rotation Should Be Enabled in AWS, you can use the following steps in Python:
  1. Import the necessary libraries:
  1. Create a boto3 client for AWS Key Management Service:
  1. Get a list of all KMS keys:
  1. Loop through each key and check if key rotation is enabled:
  1. Save the Python script and run it to enable key rotation for all KMS keys.
Note: Make sure you have appropriate AWS credentials with required permissions to perform this operation.
Replace:
  • THIS_KMS_KEY with your Terraform resource name.
  • PURPOSE_DESCRIPTION with a description of the key’s use.
This setting only applies to customer‑managed symmetric KMS keys and cannot be used on AWS‑managed keys or keys with imported key material (same limitations as the CLI command). Changing enable_key_rotation from false to true is an in‑place update and does not force key replacement.To verify, terraform plan should show a single in‑place update on the aws_kms_key resource with: