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

Enable Server Side Encryption with AWS S3-Manged-Keys by default #18

Closed
simonw opened this issue Nov 7, 2021 · 1 comment
Closed

Enable Server Side Encryption with AWS S3-Manged-Keys by default #18

simonw opened this issue Nov 7, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Nov 7, 2021

Originally posted by @zacaytion in #7 (comment)

@simonw simonw added the enhancement New feature or request label Nov 7, 2021
@simonw
Copy link
Owner Author

simonw commented Nov 8, 2021

On further reading in https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingServerSideEncryption.html it looks like there isn't a way to create a bucket and say "everything in this bucket should be server-side encrypted" - instead, that article suggests adding the following policy to the bucket:

{
  "Version": "2012-10-17",
  "Id": "PutObjectPolicy",
  "Statement": [
    {
      "Sid": "DenyIncorrectEncryptionHeader",
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::awsexamplebucket1/*",
      "Condition": {
        "StringNotEquals": {
          "s3:x-amz-server-side-encryption": "AES256"
        }
      }
    },
    {
      "Sid": "DenyUnencryptedObjectUploads",
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::awsexamplebucket1/*",
      "Condition": {
        "Null": {
          "s3:x-amz-server-side-encryption": "true"
        }
      }
    }
  ]
}

This will deny any attempts to PUT an object that fail to specify the x-amz-server-side-encryption: AES256 header.

As such, I'm going to consider this out-of-scope for this project. If I implement bucket policies in #19 I'll include a mechanism similar to --policy from #14 such that people who want to do this can specify their own custom bucket policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant