Skip to content

Commit 4367a9f

Browse files
committed
enforce KMS-SSE requests to CloudTrail bucket
1 parent ccb3f45 commit 4367a9f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

security/cloudtrail.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,20 @@ Resources:
215215
Condition:
216216
Bool:
217217
'aws:SecureTransport': false
218+
- !If
219+
- HasParentKmsKeyStack
220+
- Sid: EnforceSSERequests
221+
Principal: '*'
222+
Action: 's3:PutObject*'
223+
Effect: Deny
224+
Resource: !If [HasLogFilePrefix, !Sub 'arn:aws:s3:::${TrailBucket}/${LogFilePrefix}/AWSLogs/${AWS::AccountId}/*', !Sub 'arn:aws:s3:::${TrailBucket}/AWSLogs/${AWS::AccountId}/*']
225+
Condition:
226+
StringNotEquals:
227+
's3:x-amz-server-side-encryption':
228+
- 'AES256'
229+
- 'aws:kms'
230+
's3:x-amz-server-side-encryption-aws-kms-key-id': {'Fn::ImportValue': !Sub '${ParentKmsKeyStack}-KeyArn'}
231+
- !Ref 'AWS::NoValue'
218232
TrailLogGroup:
219233
Type: 'AWS::Logs::LogGroup'
220234
Properties:

security/kms-key.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ Resources:
188188
Service: 'cloudtrail.amazonaws.com'
189189
Action:
190190
- 'kms:GenerateDataKey*'
191+
- 'kms:DescribeKey'
191192
Resource: '*'
192193
Condition:
193194
StringLike:

0 commit comments

Comments
 (0)