Skip to main content

Triage and Remediation

Remediation

Using Console

Here are the step-by-step instructions to remediate the “Secret Manager Secrets Should Be Encrypted With CMKs” misconfiguration in AWS using the AWS console:
  1. Log in to the AWS Management Console and navigate to the AWS Secrets Manager service.
  2. Click on the secret that needs to be remediated.
  3. Under the “Encryption” section, click on the “Edit” button.
  4. Select the “AWS KMS customer master key (CMK)” option.
  5. Choose the appropriate CMK from the list or create a new one.
  6. Click on the “Save” button to save the changes.
  7. Ensure that the secret is now encrypted with the selected CMK by checking the “Encryption” section.
That’s it! Following these steps should remediate the “Secret Manager Secrets Should Be Encrypted With CMKs” misconfiguration in AWS.

To remediate the misconfiguration “Secret Manager Secrets Should Be Encrypted With CMKs” for AWS using AWS CLI, you can follow the below steps:
  1. Open the AWS CLI on your local machine or EC2 instance.
  2. Run the following command to list all the secrets in the Secret Manager:
  3. Note down the ARN of the secret that needs to be encrypted with a CMK.
  4. Create a new KMS customer managed key (CMK) by running the following command:
  5. Note down the ARN of the newly created CMK.
  6. Run the following command to update the secret to use the newly created CMK:
    Replace <ARN-of-secret> with the ARN of the secret that needs to be encrypted with a CMK, and <ARN-of-new-CMK> with the ARN of the newly created CMK.
  7. Verify that the secret is now encrypted with the new CMK by running the following command:
    This command should return the details of the secret, including the KMS key ID.
By following the above steps, you can remediate the misconfiguration “Secret Manager Secrets Should Be Encrypted With CMKs” for AWS using AWS CLI.
To remediate the misconfiguration “Secret Manager Secrets Should Be Encrypted With CMKs” in AWS using Python, you can follow the below steps:
  1. Create a Customer Managed Key (CMK) in AWS Key Management Service (KMS) if not already created.
  1. Enable Key Rotation for the CMK created in step 1.
  1. Update the Secrets in AWS Secret Manager to use the CMK created in step 1 for encryption.
Note: Replace CMK_ARN with the ARN of the CMK created in step 1 and SECRET_NAME with the name of the Secret in AWS Secret Manager that needs to be updated.By following these steps, you can remediate the misconfiguration “Secret Manager Secrets Should Be Encrypted With CMKs” for AWS using Python.
Substitute:
  • NEW_SECRET_NAME_FOR_ASSET_LABEL with the new secret name you want.
  • KMS_CMK_KEY_ARN with the ARN of your customer-managed KMS key.
You must separately supply the secret value (e.g., via aws_secretsmanager_secret_version, external data source, or a module variable) and update all applications to use the new secret’s ARN. The original secret must then be deleted/scheduled for deletion (you can import it as a separate aws_secretsmanager_secret resource and remove it from configuration to let Terraform call DeleteSecret with the configured recovery_window_in_days).Changing kms_key_id on an existing aws_secretsmanager_secret forces replacement, so terraform plan should show the old secret being destroyed and a new CMK-encrypted secret created (with a different ARN) or, if you model both, the old secret being scheduled for deletion and the new CMK-encrypted secret being created.