diff --git a/infrastructure/cloudtrail_bucket_policy.tpl b/infrastructure/cloudtrail_bucket_policy.tpl index 5bbd3dc62..68aa047ba 100644 --- a/infrastructure/cloudtrail_bucket_policy.tpl +++ b/infrastructure/cloudtrail_bucket_policy.tpl @@ -2,7 +2,7 @@ "Version": "2012-10-17", "Statement": [ { - "Sid": "AWSCloudTrailAclCheck20150319", + "Sid": "Get CloudTrail Bucket ACL", "Effect": "Allow", "Principal": { "Service": "cloudtrail.amazonaws.com" @@ -11,18 +11,34 @@ "Resource": ["arn:aws:s3:::${bucketName}"] }, { - "Sid": "AWSCloudTrailWrite20150319", + "Sid": "Grant CloudTrail Permission to Write Logs", "Effect": "Allow", "Principal": { "Service": "cloudtrail.amazonaws.com" }, "Action": ["s3:PutObject"], - "Resource": ["arn:aws:s3:::${bucketName}/AWSLogs/${accountId}/*"], + "Resource": [ + "arn:aws:s3:::${bucketName}/AWSLogs/${accountId}", + "arn:aws:s3:::${bucketName}/AWSLogs/${accountId}/*" + ], "Condition": { "StringEquals": { "s3:x-amz-acl": "bucket-owner-full-control" } } + }, + { + "Sid": "Require SSL for Requests", + "Effect": "Deny", + "Resource": [ + "arn:aws:s3:::${bucketName}", + "arn:aws:s3:::${bucketName}/*" + ], + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + } } ] } diff --git a/infrastructure/cloudwatch.tf b/infrastructure/cloudwatch.tf index 1f4d16603..51e64a42d 100644 --- a/infrastructure/cloudwatch.tf +++ b/infrastructure/cloudwatch.tf @@ -38,12 +38,28 @@ resource "aws_s3_bucket_policy" "cloudwatch_bucket" { "Service" : "logs.amazonaws.com" }, "Action" : "s3:PutObject", - "Resource" : "arn:aws:s3:::${var.cloudwatch_bucket_name}/*", + "Resource" : [ + "arn:aws:s3:::${var.cloudwatch_bucket_name}", + "arn:aws:s3:::${var.cloudwatch_bucket_name}/*" + ], "Condition" : { "StringEquals" : { "s3:x-amz-acl" : "bucket-owner-full-control" } } + }, + { + "Sid" : "Require SSL for requests", + "Effect" : "Deny", + "Resource" : [ + "arn:aws:s3:::${var.cloudwatch_bucket_name}", + "arn:aws:s3:::${var.cloudwatch_bucket_name}/*" + ], + "Condition" : { + "Bool" : { + "aws:SecureTransport" : "false" + } + }, } ] })