turbot/aws_compliance

Control: 3.8 Ensure that Object-level logging for write events is enabled for S3 buckets

Description

S3 object-level API operations such as GetObject, DeleteObject, and PutObject are called data events. By default, CloudTrail trails don't log data events and so it is recommended to enable Object-level logging for S3 buckets.

Enabling object-level logging will help you meet data compliance requirements within your organization, perform comprehensive security analysis, monitor specific patterns of user behavior in your AWS account or take immediate actions on any object-level API activity within your S3 Buckets using Amazon CloudWatch Events.

Remediation

From Console:

  1. Login to the AWS Management Console and navigate to S3 dashboard at https://console.aws.amazon.com/s3/.
  2. In the left navigation panel, click buckets and then click on the S3 Bucket Name that you want to examine.
  3. Click the Properties tab to see the bucket configuration in detail.
  4. In the AWS CloudTrail data events section, select the trail name for recording activity. You can choose an existing trail or create a new one by clicking the Configure in CloudTrail button or navigating to the CloudTrail console.
  5. Once the trail is selected, select the Data Events check box.
  6. Select S3 from the Data event type drop-down.
  7. Select Log all events from the Log selector template drop-down.
  8. Repeat steps 2-7 to enable object-level logging of write events for other S3 buckets.

From Command Line:

  1. To enable object-level data events logging for S3 buckets within your AWS account, run the put-event-selectors command using the name of the trail that you want to reconfigure as identifier:
aws cloudtrail put-event-selectors --region <region-name> --trail-name <trail-name> --event-selectors '[{ "ReadWriteType": "WriteOnly", "IncludeManagementEvents":true, "DataResources": [{ "Type": "AWS::S3::Object", "Values": ["arn:aws:s3:::<s3-bucket-name>/"] }] }]'
  1. The command output will be object-level event trail configuration.
  2. If you want to enable it for all buckets at once then change Values parameter to ["arn:aws:s3"] in command given above.
  3. Repeat step 1 for each s3 bucket to update object-level logging of write events.
  4. Change the AWS region by updating the --region command parameter and perform the process for other regions.

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.cis_v400_3_8

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_compliance.control.cis_v400_3_8 --share

SQL

This control uses a named query:

cloudtrail_s3_object_write_events_audit_enabled

Tags