Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cloudfront): Set MinimumProtocolVersion and SslSupportMethod when specifying distribution certificate #9200

Merged
merged 6 commits into from Jul 22, 2020
Merged

fix(cloudfront): Set MinimumProtocolVersion and SslSupportMethod when specifying distribution certificate #9200

merged 6 commits into from Jul 22, 2020

Conversation

tneely
Copy link
Contributor

@tneely tneely commented Jul 21, 2020

Per the CloudFormation documentation, if you specify an ACM certificate ARN, you must also specify values for
MinimumProtocolVersion and SslSupportMethod in AWS::CloudFront::Distribution ViewerCertificate. We are using
the recommended SslSupportMethod of "sni-only" and MinimumProtocolVersion of "TLSv1.2_2018."

Fixes: #9193


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…when specifying distribution certificate

Per the CloudFormation documentation, if you specify an ACM certificate ARN, you must also specify values for
MinimumProtocolVersion and SslSupportMethod in AWS::CloudFront::Distribution ViewerCertificate. We are using
the recommended SslSupportMethod of "sni-only" and default MinimumProtocolVersion of "TLSv1."

Fixes: #9193
Copy link
Contributor

@njlynch njlynch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!

@@ -221,6 +222,14 @@ export class Distribution extends Resource implements IDistribution {
});
}

private addViewerCertificate(certificate: acm.ICertificate): CfnDistribution.ViewerCertificateProperty {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 'render' to match the other similar methods.

Suggested change
private addViewerCertificate(certificate: acm.ICertificate): CfnDistribution.ViewerCertificateProperty {
private renderViewerCertificate(certificate: acm.ICertificate): CfnDistribution.ViewerCertificateProperty {

return {
acmCertificateArn: certificate.certificateArn,
sslSupportMethod: SSLMethod.SNI,
minimumProtocolVersion: SecurityPolicyProtocol.TLS_V1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Nit) - I'd prefer we opt for a higher standard by default, per the docs:

We recommend that you specify TLSv1.2_2018 unless your viewers are using browsers or devices that don’t support TLSv1.2.

Given TLSv1.2 is supported now by all major browsers, I think it's a sane default here.

@@ -3,6 +3,7 @@ import { Construct, IResource, Lazy, Resource, Stack, Token, Duration } from '@a
import { CfnDistribution } from './cloudfront.generated';
import { Origin } from './origin';
import { CacheBehavior } from './private/cache-behavior';
import { SSLMethod, SecurityPolicyProtocol } from './web_distribution';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing -- I've been incrementally moving these sorts of common enums from './web_distribution' to this file, as the (very long-term) plan is to deprecate web_distribution in favor of this construct. Bonus points if you move these two over as part of this change. :D

@njlynch njlynch self-assigned this Jul 22, 2020
@njlynch njlynch added the @aws-cdk/aws-cloudfront Related to Amazon CloudFront label Jul 22, 2020
@njlynch njlynch changed the title fix(aws-cloudfront): Set MinimumProtocolVersion and SslSupportMethod when specifying distribution certificate fix(cloudfront): Set MinimumProtocolVersion and SslSupportMethod when specifying distribution certificate Jul 22, 2020
Copy link
Contributor

@njlynch njlynch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: a2f6581
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Jul 22, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit f99c327 into aws:master Jul 22, 2020
Chriscbr pushed a commit to Chriscbr/aws-cdk that referenced this pull request Jul 23, 2020
… specifying distribution certificate (aws#9200)

Per the CloudFormation documentation, if you specify an ACM certificate ARN, you must also specify values for
MinimumProtocolVersion and SslSupportMethod in AWS::CloudFront::Distribution ViewerCertificate. We are using
the recommended SslSupportMethod of "sni-only" and MinimumProtocolVersion of "TLSv1.2_2018."

Fixes: aws#9193

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@tneely tneely deleted the tneely/fix-viewer-certificate-properties branch July 27, 2020 15:00
curtiseppel pushed a commit to curtiseppel/aws-cdk that referenced this pull request Aug 11, 2020
… specifying distribution certificate (aws#9200)

Per the CloudFormation documentation, if you specify an ACM certificate ARN, you must also specify values for
MinimumProtocolVersion and SslSupportMethod in AWS::CloudFront::Distribution ViewerCertificate. We are using
the recommended SslSupportMethod of "sni-only" and MinimumProtocolVersion of "TLSv1.2_2018."

Fixes: aws#9193

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[aws-cloudfront] Distribution Does Not Set ViewerCertificate SslSupportMethod When Using Certificate
4 participants