Check if all S3 buckets are configured to log S3 data events in CloudTrail for compliance.
Rule | All S3 buckets should log S3 data events in CloudTrail |
Framework | CISA-cyber-essentials |
Severity | ✔ Medium |
Rule Description: All S3 buckets should have S3 data events logging enabled in CloudTrail as per CISA Cyber Essentials standards.
Overview:
The rule mandates that all S3 buckets within an organization should have S3 data events logging enabled in CloudTrail. This logging provides visibility into the actions performed on S3 buckets, enabling organizations to meet CISA Cyber Essentials requirements related to monitoring and auditing.
Troubleshooting Steps:
If an S3 bucket does not have S3 data events logging enabled, follow the steps below to troubleshoot the issue:
Necessary Code:
To enable S3 data events logging for an S3 bucket in CloudTrail, perform the following steps:
aws cloudtrail create-trail --name <trail-name> --s3-bucket-name <bucket-name> --include-global-service-events
Replace
<trail-name>
with a suitable name for your trail, and <bucket-name>
with the name of the S3 bucket you want to enable logging for.aws cloudtrail describe-trails --trail-name-list <trail-name>
This command will return the details of the trail to confirm that it has been successfully created.
aws s3api put-bucket-logging --bucket <bucket-name> --bucket-logging-status file://logging.json
Ensure you have a JSON file (e.g., logging.json) with the appropriate logging configuration. Replace
<bucket-name>
with the name of the S3 bucket to be configured.Remediation Steps:
If an S3 bucket fails to comply with the rule, follow the steps below to remediate:
By following these steps, you can ensure that all S3 buckets within your organization adhere to the CISA Cyber Essentials requirement of enabling S3 data events logging in CloudTrail.