Skip to content

Commit

Permalink
Merge pull request #85 from nikpivkin/aws-cloudfront
Browse files Browse the repository at this point in the history
fix(aws): don't check SSLSupportMethod in AVD-AWS-0013
  • Loading branch information
simar7 authored Feb 27, 2024
2 parents 4d9470f + 06d36f2 commit 2dcf5c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions checks/cloud/aws/cloudfront/use_secure_tls_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var CheckUseSecureTlsPolicy = rules.Register(
Resolution: "Use the most modern TLS/SSL policies available",
Explanation: `You should not use outdated/insecure TLS versions for encryption. You should be using TLS v1.2+.
Note: that setting *minimum_protocol_version = "TLSv1.2_2021"* is only possible when *cloudfront_default_certificate* is false (eg. you are not using the cloudfront.net domain name) and *ssl_support_method* is *sni-only*.
Note: that setting *minimum_protocol_version = "TLSv1.2_2021"* is only possible when *cloudfront_default_certificate* is false (eg. you are not using the cloudfront.net domain name).
If *cloudfront_default_certificate* is true then the Cloudfront API will only allow setting *minimum_protocol_version = "TLSv1"*, and setting it to any other value will result in a perpetual diff in your *terraform plan*'s.
The only option when using the cloudfront.net domain name is to ignore this rule.`,
Links: []string{
Expand All @@ -45,7 +45,6 @@ The only option when using the cloudfront.net domain name is to ignore this rule
for _, dist := range s.AWS.Cloudfront.Distributions {
vc := dist.ViewerCertificate
if vc.CloudfrontDefaultCertificate.IsFalse() &&
vc.SSLSupportMethod.EqualTo("sni-only") &&
vc.MinimumProtocolVersion.NotEqualTo(cloudfront.ProtocolVersionTLS1_2) {
results.Add(
"Distribution allows unencrypted communications.",
Expand Down
4 changes: 2 additions & 2 deletions checks/cloud/aws/cloudfront/use_secure_tls_policy.tf.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var terraformUseSecureTlsPolicyGoodExamples = []string{
`
resource "aws_cloudfront_distribution" "good_example" {
viewer_certificate {
cloudfront_default_certificate = aws_acm_certificate.example.arn
cloudfront_default_certificate = false
minimum_protocol_version = "TLSv1.2_2021"
}
}
Expand All @@ -15,7 +15,7 @@ var terraformUseSecureTlsPolicyBadExamples = []string{
`
resource "aws_cloudfront_distribution" "bad_example" {
viewer_certificate {
cloudfront_default_certificate = aws_acm_certificate.example.arn
cloudfront_default_certificate = false
minimum_protocol_version = "TLSv1.0"
}
}
Expand Down
2 changes: 1 addition & 1 deletion checks/cloud/aws/cloudfront/use_secure_tls_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestCheckUseSecureTlsPolicy(t *testing.T) {
},
},
},
expected: false,
expected: true,
},
}
for _, test := range tests {
Expand Down

0 comments on commit 2dcf5c8

Please sign in to comment.