Triage and Remediation
Remediation
Using Console
Using Console
To remediate this misconfiguration in AWS, you can follow the below steps:
- Log in to your AWS console and navigate to the Amazon CloudFront service.
- Click on the distribution ID for which you want to enable HTTPS.
- In the distribution settings, click on the “Behaviors” tab.
- Select the behavior for which you want to enable HTTPS and click on the “Edit” button.
- In the “Edit Behavior” window, scroll down to the “Viewer Protocol Policy” section.
- Select “Redirect HTTP to HTTPS” from the dropdown list.
- Click on the “Yes, Edit” button to save the changes.
- Wait for the changes to propagate. This may take a few minutes.
- Once the changes are propagated, your CloudFront distribution will be configured to use HTTPS for all viewer communications.
Using CLI
Using CLI
To remediate the misconfiguration “Communication With Viewers Should Be Encrypted Using HTTPS” in AWS using AWS CLI, follow these steps:Note: Replace
- Open the AWS CLI on your local machine and run the following command to update the CloudFront distribution configuration:
<distribution-id>
with the ID of your CloudFront distribution and <path_to_config_file>
with the path to your CloudFront distribution configuration file.- In the CloudFront distribution configuration file, add the following JSON code to enable HTTPS encryption for viewer communication:
- Save the configuration file and run the update-distribution command again to apply the changes.
- Wait for the CloudFront distribution to deploy the changes. This may take several minutes.
- Verify that HTTPS encryption is enabled for viewer communication by accessing your CloudFront distribution using HTTPS. You can do this by visiting the domain name of your CloudFront distribution in a web browser and checking that the URL starts with “https://” and has a green padlock icon.
Using Python
Using Python
To remediate the misconfiguration “Communication With Viewers Should Be Encrypted Using HTTPS” for AWS using python, you can follow the below steps:Note: Replace
- Open the AWS console and navigate to the CloudFront service.
- Select the distribution for which you want to enable HTTPS.
- Click on the “Behaviors” tab and select the behavior for which you want to enable HTTPS.
- Click on “Edit” and then select “Yes” for the “Redirect HTTP to HTTPS” option.
- Scroll down to the “Viewer Protocol Policy” option and select “Redirect HTTP to HTTPS”.
- Save the changes.
YOUR_DISTRIBUTION_ID
with the actual distribution ID for which you want to enable HTTPS.