More Info:
Ensure that HTTPS is enabled for the load balancer associated with your Amazon Elastic Beanstalk application environment in order to handle encrypted web traffic. By default, the load balancer handles unencrypted traffic requests (HTTP) through port 80. To enable HTTPS traffic over port 443, you must create and configure an HTTPS listener for the associated load balancer.Risk Level
HighAddress
SecurityCompliance Standards
SOC2, GDPR, PCIDSS, NIST, HITRUST, NISTCSFTriage and Remediation
Remediation
Using Console
Using Console
Sure, here are the step by step instructions to remediate the misconfiguration “Enforce HTTPS for Elastic Beanstalk Load Balancers” for AWS using AWS console:
- Log in to your AWS Management Console.
- Navigate to the Elastic Beanstalk service.
- Select the environment that you want to remediate.
- Click on the “Configuration” tab in the left-hand menu.
- Scroll down to the “Load Balancer” section and click on “Edit”.
- In the “Listeners” section, click on the “Add listener” button.
- Select “HTTPS” as the protocol and enter the appropriate port number (usually 443).
- Choose the SSL certificate that you want to use from the drop-down list.
- In the “Rules” section, click on the “Add rule” button.
- Choose “Redirect HTTP to HTTPS” from the drop-down list.
- Click on the “Apply” button to save the changes.
- Wait for the environment to update and the changes to take effect.
Using CLI
Using CLI
To enforce HTTPS for Elastic Beanstalk Load Balancers in AWS, you can follow the below steps using AWS CLI:Step 1: Open the AWS CLI on your local machine.Step 2: Run the following command to update the Elastic Beanstalk environment to use HTTPS:Note: Replace Note: Replace
<your-environment-name>
with the name of your Elastic Beanstalk environment and <your-ssl-certificate-id>
with the ID of your SSL certificate.Step 3: Run the following command to verify that HTTPS is now enforced:<your-environment-name>
with the name of your Elastic Beanstalk environment.This command will return the URL of the Elastic Beanstalk Load Balancer with HTTPS protocol.By following the above steps, you can enforce HTTPS for Elastic Beanstalk Load Balancers in AWS using AWS CLI.Using Python
Using Python
To remediate the misconfiguration “Enforce HTTPS for Elastic Beanstalk Load Balancers” in AWS using Python, you can follow the below steps:Note: Replace the placeholders in the code with your own values. Also, make sure that you have installed the Boto3 library before running the code.
- Open the AWS Management Console and navigate to the Elastic Beanstalk environment that needs to be remediated.
- Click on the “Configuration” tab and then click on the “Load Balancer” section.
- Under the “Listeners” section, click on the “Edit” button.
- In the “Add listener” dialog box, select “HTTPS” from the “Protocol” dropdown menu.
- Select the SSL certificate that you want to use from the “SSL certificate ID” dropdown menu.
- Click on the “Add” button to add the HTTPS listener.
- Under the “Rules” section, click on the “Edit” button.
- In the “Add rule” dialog box, select “HTTPS” from the “Protocol” dropdown menu.
- In the “Path” field, enter ”/*”.
- In the “Redirect to” field, enter “https://#:#/#?#”.
- Click on the “Add” button to add the HTTPS redirect rule.
- Click on the “Apply” button to save the changes.