forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aws-cloudfront): Support Security Policy
Adds support for changing the default Security Policy (minimumProtocolVersion) with logic to ensure the proper one is being set for your SSLMethod. Fixes aws#795
- Loading branch information
Blake Price
committed
Sep 28, 2018
1 parent
c23230e
commit a02555a
Showing
3 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"Resources": { | ||
"AnAmazingWebsiteProbablyCFDistribution47E3983B": { | ||
"Type": "AWS::CloudFront::Distribution", | ||
"Properties": { | ||
"DistributionConfig": { | ||
"CacheBehaviors": [], | ||
"DefaultCacheBehavior": { | ||
"AllowedMethods": [ | ||
"GET", | ||
"HEAD" | ||
], | ||
"CachedMethods": [ | ||
"GET", | ||
"HEAD" | ||
], | ||
"ForwardedValues": { | ||
"Cookies": { | ||
"Forward": "none" | ||
}, | ||
"QueryString": false | ||
}, | ||
"TargetOriginId": "origin1", | ||
"ViewerProtocolPolicy": "redirect-to-https" | ||
}, | ||
"DefaultRootObject": "index.html", | ||
"Enabled": true, | ||
"HttpVersion": "http2", | ||
"IPV6Enabled": true, | ||
"Origins": [ | ||
{ | ||
"CustomOriginConfig": { | ||
"HTTPPort": 80, | ||
"HTTPSPort": 443, | ||
"OriginKeepaliveTimeout": 5, | ||
"OriginProtocolPolicy": "https-only", | ||
"OriginReadTimeout": 30, | ||
"OriginSSLProtocols": [ | ||
"TLSv1.2" | ||
] | ||
}, | ||
"DomainName": "brelandm.a2z.com", | ||
"Id": "origin1", | ||
"OriginCustomHeaders": [ | ||
{ | ||
"HeaderName": "X-Custom-Header", | ||
"HeaderValue": "somevalue" | ||
} | ||
] | ||
} | ||
], | ||
"PriceClass": "PriceClass_100", | ||
"ViewerCertificate": { | ||
"AcmCertificateArn": "testACM", | ||
"MinimumProtocolVersion": "TLSv1", | ||
"SslSupportMethod": "sni-only" | ||
}, | ||
"Aliases": [ | ||
"test.test.com" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
import cdk = require('@aws-cdk/cdk'); | ||
import cloudfront = require('../lib'); | ||
|
||
const app = new cdk.App(process.argv); | ||
|
||
const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); | ||
|
||
new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { | ||
originConfigs: [ | ||
{ | ||
originHeaders: { | ||
"X-Custom-Header": "somevalue", | ||
}, | ||
customOriginSource: { | ||
domainName: "brelandm.a2z.com", | ||
}, | ||
behaviors: [ | ||
{ | ||
isDefaultBehavior: true, | ||
} | ||
] | ||
} | ||
], | ||
aliasConfiguration: { | ||
acmCertRef: 'testACM', | ||
names: ['test.test.com'], | ||
sslMethod: cloudfront.SSLMethod.SNI, | ||
securityPolicy: cloudfront.SecurityPolicyProtocol.TLSv1 | ||
} | ||
}); | ||
|
||
process.stdout.write(app.run()); |