More Info:
Ensures object logging is enabled on storage buckets. Storage bucket logging helps maintain an audit trail of access that can be used in the event of a security incident.Risk Level
LowAddress
Reliability, SecurityCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- DPDPA
- Digital Operational Resilience Act (EU)
- Essential 8
- FedRAMP
- GDPR
- HIPAA
- HITRUST CSF
- ISO 27001
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST
- NIST CSF
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- PCI
- Reserve Bank of India (RBI) Cyber Security Framework
- SOC2
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
To remediate the bucket logging misconfiguration in GCP using the GCP console, follow these steps:
- Open the GCP console and navigate to the Storage section.
- Select the bucket for which you want to enable logging.
- Click on the “Edit bucket details” button at the top of the page.
- Scroll down to the “Logging” section and click on the “Configure” button.
- In the “Configure logging” dialog box, select the “Cloud Audit Logs” option.
- Choose the appropriate logs you want to receive and click on the “Save” button.
Using CLI
Using CLI
To remediate the bucket logging misconfiguration for GCP using GCP CLI, follow these step-by-step instructions:
- Open the Cloud Shell from the GCP console.
-
Run the following command to list all the buckets in your project:
- Choose the bucket for which you want to enable logging.
-
Run the following command to enable logging for the bucket:
Replace
[BUCKET_NAME]with the name of your bucket and[LOG_BUCKET_NAME]with the name of the bucket where you want to store the logs.[PREFIX]is an optional parameter that allows you to specify a prefix for the log object names. -
Verify that logging has been enabled for the bucket by running the following command:
This command will display the current logging configuration for the bucket.
-
You can also view the logs in the log bucket by running the following command:
This command will list all the log files that have been generated for the specified bucket.
Using Python
Using Python
To remediate the misconfiguration “Bucket Logging Should Be Enabled” in GCP using Python, you can follow the below steps:The above steps will enable bucket logging for the specified GCP bucket. You can run this Python script as a standalone script or integrate it into your infrastructure as code pipeline.
- Import the required libraries:
- Set the project ID and bucket name:
- Create a client object of the storage bucket:
- Set the bucket’s logging configuration:
- Verify the logging configuration by checking the bucket’s logging properties:
Using Terraform
Using Terraform
terraform plan should show an in-place update (~) to the affected google_storage_bucket with a new logging block specifying log_bucket and log_object_prefix.
