Skip to main content

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

High

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • AWS Startup Security Baseline
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • GDPR
  • HITRUST CSF
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST
  • NIST CSF
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • PCI
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

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:
  1. Log in to your AWS Management Console.
  2. Navigate to the Elastic Beanstalk service.
  3. Select the environment that you want to remediate.
  4. Click on the “Configuration” tab in the left-hand menu.
  5. Scroll down to the “Load Balancer” section and click on “Edit”.
  6. In the “Listeners” section, click on the “Add listener” button.
  7. Select “HTTPS” as the protocol and enter the appropriate port number (usually 443).
  8. Choose the SSL certificate that you want to use from the drop-down list.
  9. In the “Rules” section, click on the “Add rule” button.
  10. Choose “Redirect HTTP to HTTPS” from the drop-down list.
  11. Click on the “Apply” button to save the changes.
  12. Wait for the environment to update and the changes to take effect.
Once these steps are completed, your Elastic Beanstalk Load Balancer will enforce HTTPS and redirect all HTTP traffic to HTTPS.

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 <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:
Note: Replace <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.
To remediate the misconfiguration “Enforce HTTPS for Elastic Beanstalk Load Balancers” in AWS using Python, you can follow the below steps:
  1. Open the AWS Management Console and navigate to the Elastic Beanstalk environment that needs to be remediated.
  2. Click on the “Configuration” tab and then click on the “Load Balancer” section.
  3. Under the “Listeners” section, click on the “Edit” button.
  4. In the “Add listener” dialog box, select “HTTPS” from the “Protocol” dropdown menu.
  5. Select the SSL certificate that you want to use from the “SSL certificate ID” dropdown menu.
  6. Click on the “Add” button to add the HTTPS listener.
  7. Under the “Rules” section, click on the “Edit” button.
  8. In the “Add rule” dialog box, select “HTTPS” from the “Protocol” dropdown menu.
  9. In the “Path” field, enter ”/*”.
  10. In the “Redirect to” field, enter “https://#{host}:#{port}/#{path}?#{query}”.
  11. Click on the “Add” button to add the HTTPS redirect rule.
  12. Click on the “Apply” button to save the changes.
To automate the above steps using Python, you can use the AWS SDK for Python (Boto3). Here’s an example code snippet to enforce HTTPS for an Elastic Beanstalk Load Balancer:
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.
This change updates the existing Elastic Beanstalk environment in place and will trigger an environment update, which may cause downtime depending on your deployment policy, but it does not force recreation of the environment resource itself.Verification: terraform plan should show three new/updated setting blocks on aws_elastic_beanstalk_environment.EB_ENVIRONMENT with namespace = "aws:elbv2:listener:443" and name values Protocol, SSLCertificateArns, and DefaultProcess set as above.

Additional Reading: