CloudFront viewer certificate settings need review

A CloudFront certificate must cover the domain in use and be paired with the required TLS policy.

Description

The default CloudFront domain supports HTTPS with its default certificate. A custom domain needs a certificate covering its name.

Potential impact

A name mismatch can break HTTPS connections. The default certificate’s TLSv1 policy can also fall short of a stricter minimum TLS requirement.

Remediation

Add the custom domain to the distribution and specify an ACM certificate ARN from us-east-1. Set ssl_support_method: sni-only and a minimum_protocol_version policy that meets your requirements. Restrict private content with signed URLs or cookies as needed.

Examples

The second task selects SNI and TLSv1.2_2018. Supply the actual certificate ARN, point DNS at the distribution and check the certificate name when connecting to the domain.

Before

yaml
- name: Create a CloudFront distribution
  community.aws.cloudfront_distribution:
    state: present
    default_origin_domain_name: www.my-cloudfront-origin.com
    viewer_certificate:
      cloudfront_default_certificate: true

After

yaml
- name: Create a CloudFront distribution
  community.aws.cloudfront_distribution:
    state: present
    default_origin_domain_name: www.my-cloudfront-origin.com
    viewer_certificate:
      acm_certificate_arn: arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
      ssl_support_method: sni-only
      minimum_protocol_version: TLSv1.2_2018

References