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

Unable to set a Block SSL Policy on the logs bucket #191

Open
marcottedan opened this issue Nov 3, 2021 · 0 comments
Open

Unable to set a Block SSL Policy on the logs bucket #191

marcottedan opened this issue Nov 3, 2021 · 0 comments
Labels
bug 🐛 An issue with the system

Comments

@marcottedan
Copy link

marcottedan commented Nov 3, 2021

Describe the Bug

Amazon states that S3 buckets should require requests to use Secure Socket Layer: https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-standards-fsbp-controls.html#s3-5-remediation

Even though the original bucket has the right policy, the log bucket created with the module has no policy attached to it. There seems to be no variable giving the log bucket id & arn in outputs.tf

So, I tried adding the bucket policy myself but I was unable to.

Here's an example of how not possible it is to use the module's output.

resource "aws_s3_bucket_policy" "logs-policy" {
 # logs doesn't offer access to the s3 bucket here
 bucket = module.cdn.logs.s3_bucket

 # logs doesn't offer access to the s3 bucket arn in the Resource block
  policy = jsonencode({
    Version = "2012-10-17"
    Id      = "BUCKET-POLICY"
    Statement = [
      {
        Sid       = "EnforceTls"
        Effect    = "Deny"
        Principal = "*"
        Action    = "s3:*"
        Resource = [
          "${module.cdn.logs.s3_bucket_arn}/*",
          "${module.cdn.logs.s3_bucket_arn}",
        ]
        Condition = {
          Bool = {
            "aws:SecureTransport" = "false"
          }
          NumericLessThan = {
            "s3:TlsVersion": 1.2
          }
        }
      },
    ]
  })
}

Expected Behavior

The log bucket should either follow the same policy the S3 content bucket has or at least provide a way to set it.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn
  2. Copy the example '"cloudposse/cloudfront-s3-cdn/aws"'
  3. Terraform apply
  4. You'll see the log policy is empty.

Screenshots

The content bucket policy is OK:
image

The log bucket policy is empty:
image

Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:

  • OS: OSX BigSur
  • Version 11.6.1

Additional Context

N/A

@marcottedan marcottedan added the bug 🐛 An issue with the system label Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

1 participant