Skip to content

Commit

Permalink
enforce KMS-SSE requests to CloudTrail bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
ab77 committed Feb 13, 2024
1 parent f8d787f commit ac04ad2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions security/cloudtrail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,20 @@ Resources:
Condition:
Bool:
'aws:SecureTransport': false
- !If
- HasParentKmsKeyStack
- Sid: EnforceSSERequests
Principal: '*'
Action: 's3:PutObject*'
Effect: Deny
Resource: !If [HasLogFilePrefix, !Sub 'arn:aws:s3:::${TrailBucket}/${LogFilePrefix}/AWSLogs/${AWS::AccountId}/*', !Sub 'arn:aws:s3:::${TrailBucket}/AWSLogs/${AWS::AccountId}/*']
Condition:
StringNotEquals:
's3:x-amz-server-side-encryption':
- 'AES256'
- 'aws:kms'
's3:x-amz-server-side-encryption-aws-kms-key-id': {'Fn::ImportValue': !Sub '${ParentKmsKeyStack}-KeyArn'}
- !Ref 'AWS::NoValue'
TrailLogGroup:
Type: 'AWS::Logs::LogGroup'
Properties:
Expand Down
1 change: 1 addition & 0 deletions security/kms-key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ Resources:
Service: 'cloudtrail.amazonaws.com'
Action:
- 'kms:GenerateDataKey*'
- 'kms:DescribeKey'
Resource: '*'
Condition:
StringLike:
Expand Down

0 comments on commit ac04ad2

Please sign in to comment.