Skip to content

Commit

Permalink
[Improvement] security/cloudtrail - Recording S3 data events
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaswittig committed May 28, 2019
1 parent b0b8a89 commit 2727d86
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions security/cloudtrail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,18 @@ Parameters:
Description: 'Optional The log file prefix.'
Type: String
Default: ''
S3DataEvents:
Description: 'Record data events of all S3 buckets? (Warning: additional charges apply.)'
Type: String
Default: 'false'
AllowedValues:
- 'true'
- 'false'
Conditions:
InternalBucket: !Equals [!Ref ExternalTrailBucket, '']
ExternalBucket: !Not [!Equals [!Ref ExternalTrailBucket, '']]
HasLogFilePrefix: !Not [!Equals [!Ref LogFilePrefix, '']]
IsS3DataEvents: !Equals [!Ref S3DataEvents, 'true']
Resources:
TrailBucket:
Condition: InternalBucket
Expand Down Expand Up @@ -121,8 +129,10 @@ Resources:
IncludeGlobalServiceEvents: true
IsLogging: true
IsMultiRegionTrail: true
EventSelectors: !If [IsS3DataEvents, [{DataResources: [{Type: 'AWS::S3::Object', Values: ['arn:aws:s3:::']}], IncludeManagementEvents: true, ReadWriteType: All}], !Ref 'AWS::NoValue']
S3BucketName: !Ref TrailBucket
S3KeyPrefix: !Ref LogFilePrefix
EnableLogFileValidation: true
CloudWatchLogsLogGroupArn: !GetAtt 'TrailLogGroup.Arn'
CloudWatchLogsRoleArn: !GetAtt 'TrailLogGroupRole.Arn'
SnsTopicName: !GetAtt 'TrailTopic.TopicName'
Expand All @@ -135,8 +145,10 @@ Resources:
IncludeGlobalServiceEvents: true
IsLogging: true
IsMultiRegionTrail: true
EventSelectors: !If [IsS3DataEvents, [{DataResources: [{Type: 'AWS::S3::Object', Values: ['arn:aws:s3:::']}], IncludeManagementEvents: true, ReadWriteType: All}], !Ref 'AWS::NoValue']
S3BucketName: !Ref ExternalTrailBucket
S3KeyPrefix: !Ref LogFilePrefix
EnableLogFileValidation: true
CloudWatchLogsLogGroupArn: !GetAtt 'TrailLogGroup.Arn'
CloudWatchLogsRoleArn: !GetAtt 'TrailLogGroupRole.Arn'
SnsTopicName: !GetAtt 'TrailTopic.TopicName'
Expand Down

0 comments on commit 2727d86

Please sign in to comment.