ELB listener security policy needs review

Configure an appropriate AWS security policy and certificate for HTTPS or TLS listeners, and verify the allowed protocols and ciphers.

Description

Set SslPolicy on an HTTPS or TLS listener to an AWS policy supported by that load balancer. ALBs use predefined policies.

Potential impact

A policy with weak ciphers can fall short of your security requirements. Clients with no compatible cipher cannot connect.

Remediation

Select the required protocols and ciphers and verify the certificate’s validity and domain. To terminate TLS on a plain HTTP or TCP listener, configure the appropriate listener protocol and certificate. Test TLS negotiation and check the backend connection separately.

Examples

Supply the security group, subnets in different Availability Zones, certificate ARN and target group. When purge_listeners is enabled, list any other listeners you need to keep.

Before

yaml
- name: elb3
  community.aws.elb_application_lb:
    name: myelb
    security_groups:
      - "{{ alb_security_group_id }}"
    subnets:
      - "{{ alb_subnet_a_id }}"
      - "{{ alb_subnet_b_id }}"
    listeners:
      - Protocol: HTTPS
        Port: 443
        SslPolicy: ELBSecurityPolicy-2016-08
        Certificates:
          - CertificateArn: "{{ certificate_arn }}"
        DefaultActions:
          - Type: forward
            TargetGroupName: "{{ target_group_name }}"
    state: present

After

yaml
- name: elb1
  community.aws.elb_application_lb:
    name: myelb
    security_groups:
      - "{{ alb_security_group_id }}"
    subnets:
      - "{{ alb_subnet_a_id }}"
      - "{{ alb_subnet_b_id }}"
    listeners:
      - Protocol: HTTPS
        Port: 443
        SslPolicy: ELBSecurityPolicy-TLS13-1-2-2021-06
        Certificates:
          - CertificateArn: "{{ certificate_arn }}"
        DefaultActions:
          - Type: forward
            TargetGroupName: "{{ target_group_name }}"
    state: present

Both tasks configure the HTTPS listener on myelb. ELBSecurityPolicy-2016-08 also permits TLS 1.0 and 1.1. ELBSecurityPolicy-TLS13-1-2-2021-06 permits only TLS 1.2 and 1.3.

References