Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “CloudFront Distributions Should Have Field-Level Encryption Enabled” in AWS using AWS console, follow the below steps:
  1. Login to AWS Management Console.
  2. Go to the CloudFront service.
  3. Select the CloudFront distribution for which you want to enable field-level encryption.
  4. Click on the “Edit” button in the top menu.
  5. Scroll down to the “Security and Privacy” section.
  6. In the “Field-level Encryption Config” section, click on the “Create Field-level Encryption Config” button.
  7. In the “Create Field-level Encryption Config” dialog box, enter a name for the configuration and click on the “Create” button.
  8. In the “Field-level Encryption Config” section, select the newly created configuration from the dropdown list.
  9. Click on the “Yes, Edit” button to save the changes.
  10. Finally, click on the “Save Changes” button to complete the remediation.
By following these steps, you have successfully enabled Field-level Encryption for the selected CloudFront distribution in AWS.

To remediate the misconfiguration of CloudFront distributions not having field-level encryption enabled in AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI on your local machine and run the following command to enable field-level encryption for your CloudFront distribution:
Replace DISTRIBUTION_ID with the ID of your CloudFront distribution and FIELD_LEVEL_ENCRYPTION_ID with the ID of the field-level encryption configuration that you want to use.
  1. Verify that field-level encryption is enabled for your CloudFront distribution by running the following command:
This command will return the current configuration for your CloudFront distribution. Verify that the FieldLevelEncryptionId parameter is set to the ID of the field-level encryption configuration that you specified in step 1.
  1. Test your CloudFront distribution to ensure that field-level encryption is working as expected.
Congratulations! You have now successfully remediated the misconfiguration of CloudFront distributions not having field-level encryption enabled in AWS using AWS CLI.
To remediate the misconfiguration “CloudFront Distributions Should Have Field-Level Encryption Enabled” in AWS using Python, you can follow the below steps:
  1. Import the Boto3 library:
  1. Create a CloudFront client object:
  1. Get the list of CloudFront distributions:
  1. Loop through each distribution and check if field-level encryption is enabled:
  1. If field-level encryption is not enabled, enable it by adding a field-level encryption configuration:
  1. Replace the unique_reference_string, profile_name, public_key_id, provider_id, profile_id, content_type, example.com, unique_id, and bucket_name with the appropriate values for your CloudFront distribution.
  2. Save the Python script and execute it to remediate the “CloudFront Distributions Should Have Field-Level Encryption Enabled” misconfiguration in AWS.
Changing field_level_encryption_id on an existing aws_cloudfront_distribution updates the distribution in place and does not force replacement, though CloudFront will take time to fully deploy the change globally.To verify, terraform plan should show:
  • + creation of aws_cloudfront_public_key.FLE_PUBLIC_KEY
  • + creation of aws_cloudfront_field_level_encryption_profile.SENSITIVE_PROFILE
  • + creation of aws_cloudfront_field_level_encryption_config.SENSITIVE_FIELDS
  • ~ an in-place update to aws_cloudfront_distribution.WEB_DISTRIBUTION with field_level_encryption_id set on the relevant cache behavior(s).