Profile Applicability:
Level 2
Description:
To monitor changes to Cloud Storage bucket IAM permissions, a log metric filter and associated alert policy should be configured. This ensures quick detection of unauthorized or unintended permission changes that could impact sensitive data stored in Cloud Storage.
Rationale:
Changes to Cloud Storage bucket permissions can expose sensitive data or compromise access control. By setting up log metrics and alerts, organizations can detect and respond to IAM permission modifications promptly, minimizing potential risks.
Impact:
Enabling logging may incur additional costs for log storage and processing, especially for organizations with frequent permission changes.
Default Value:
By default, there are no log metrics or alert policies configured for monitoring IAM permission changes on Cloud Storage buckets.
Audit Steps:
Using Google Cloud Console:
Verify Log Metric Configuration:
Navigate to Logs-based Metrics.
- Under User-defined Metrics, ensure a metric exists with the filter:
resource.type="gcs_bucket"
AND protoPayload.methodName="storage.setIamPermissions"
Verify Alert Policy Configuration:
Navigate to Alerting.
Confirm an alert policy is linked to the above metric with:
Condition: Triggers on any IAM permission change.
Threshold: 0 (alerts for every change).
Ensure appropriate notification channels are configured.
Using Google Cloud CLI:
Verify Log Metric Configuration:
- List all log metrics:
gcloud logging metrics list --format json
- Check for a metric with the following filter:
resource.type="gcs_bucket"
AND protoPayload.methodName="storage.setIamPermissions"
Verify Alert Policy Configuration:
- List alerting policies:
gcloud alpha monitoring policies list --format json
Ensure an alert policy exists with:
Condition Filter: Matches the above metric.
Enabled: true.
Remediation Steps:
Using Google Cloud Console:
Create a Log Metric:
Navigate to Logs-based Metrics.
Click CREATE METRIC and configure:
Filter:
resource.type="gcs_bucket"
AND protoPayload.methodName="storage.setIamPermissions"
Type: Counter.
Units: 1 (default).
Click Create Metric.
Create an Alert Policy:
Locate the newly created metric under User-defined Metrics.
Click the three-dot menu and select Create alert from Metric
Configure the alert:
Aggregator: Count.
Threshold: Above 0.
Condition: Trigger alerts for any IAM permission change.
Configure notification channels and save the policy.
Using Google Cloud CLI:
Create a Log Metric:
gcloud logging metrics create <metric-name> \
--description="Monitor Cloud Storage IAM permission changes" \
--log-filter="resource.type='gcs_bucket' AND protoPayload.methodName='storage.setIamPermissions'"
Create an Alert Policy:
gcloud alpha monitoring policies create \
--display-name="<policy-name>" \
--conditions="<condition-config>" \
--notification-channels="<notification-channels>"