Skip to content

Commit

Permalink
force encryption with KMS
Browse files Browse the repository at this point in the history
  • Loading branch information
ab77 committed Feb 12, 2024
1 parent 44ce87c commit c62e8dc
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions security/cloudtrail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,18 @@ Resources:
Condition:
Bool:
'aws:SecureTransport': false
- Sid: EnforceSSERequests
Effect: Deny
Principal: '*'
Action: 's3:PutObject'
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'
- !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': ''
'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

0 comments on commit c62e8dc

Please sign in to comment.