Table: gcp_iam_policy - Query Google Cloud IAM Policies using SQL
Google Cloud Identity and Access Management (IAM) provides the right tools to manage resource permissions with minimum fuss and high automation. It offers unified control across the entire suite of Google Cloud resources. IAM Policies are the primary resources in IAM that bind a set of members to a role, thus defining what actions the members can take on the resources.
Table Usage Guide
The gcp_iam_policy
table provides insights into IAM Policies within Google Cloud Identity and Access Management (IAM). As a Security Analyst, explore policy-specific details through this table, including bindings, roles, and associated members. Utilize it to uncover information about the policies, such as those with broad access, the binding of members to roles, and the verification of permissions.
Examples
List of project members with their roles
Explore which roles are assigned to different project members. This can help in managing access control and ensuring appropriate permissions are allocated.
select entity, p ->> 'role' as rolefrom gcp_iam_policy, jsonb_array_elements(bindings) as p, jsonb_array_elements_text(p -> 'members') as entity;
select e.value as entity, json_extract(p.value, '$.role') as rolefrom gcp_iam_policy, json_each(bindings) as p, json_each(json_extract(p.value, '$.members')) as e;
List of members with owner roles
Explore which members have been assigned the 'owner' role in your Google Cloud Platform IAM policy. This is useful for gaining insights into access control and ensuring appropriate permissions are in place.
select entity, p ->> 'role' as rolefrom gcp_iam_policy, jsonb_array_elements(bindings) as p, jsonb_array_elements_text(p -> 'members') as entitywhere split_part(p ->> 'role', '/', 2) = 'owner';
Error: SQLite does not support split functions.
Control examples
- All Controls > Cloud Functions > Cloudfunction functions no roles/editor or roles/owner permission
- All Controls > Cloud Functions > Cloudfunction functions should restrict deployments manager permission
- All Controls > Cloud Functions > Cloudfunction functions should restrict disrupt logging permission
- All Controls > Compute > Compute Instances should restrict data destruction permission
- All Controls > Compute > Compute Instances should restrict database write permission
- All Controls > Compute > Compute Instances should restrict deployments manager permission
- All Controls > Compute > Compute Instances should restrict disrupt logging permission
- All Controls > Compute > Compute Instances should restrict high level basic role
- All Controls > Compute > Compute Instances should restrict IAM write permission
- All Controls > Compute > Compute Instances should restrict service account impersonate permission
- All Controls > Compute > Compute Instances should restrict write permission on deny policy
- All Controls > IAM > Ensure that Separation of duties is enforced while assigning KMS related roles to users
- CIS v1.2.0 > 1 Identity and Access Management > 1.1 Ensure that corporate login credentials are used
- CIS v1.2.0 > 1 Identity and Access Management > 1.11 Ensure that Separation of duties is enforced while assigning KMS related roles to users
- CIS v1.2.0 > 1 Identity and Access Management > 1.5 Ensure that Service Account has no Admin privileges
- CIS v1.2.0 > 1 Identity and Access Management > 1.6 Ensure that IAM users are not assigned the Service Account User or Service Account Token Creator roles at project level
- CIS v1.2.0 > 1 Identity and Access Management > 1.8 Ensure that Separation of duties is enforced while assigning service account related roles to users
- CIS v1.3.0 > 1 Identity and Access Management > 1.1 Ensure that corporate login credentials are used
- CIS v1.3.0 > 1 Identity and Access Management > 1.11 Ensure that Separation of duties is enforced while assigning KMS related roles to users
- CIS v1.3.0 > 1 Identity and Access Management > 1.5 Ensure that Service Account has no Admin privileges
- CIS v1.3.0 > 1 Identity and Access Management > 1.6 Ensure that IAM users are not assigned the Service Account User or Service Account Token Creator roles at project level
- CIS v1.3.0 > 1 Identity and Access Management > 1.8 Ensure that Separation of duties is enforced while assigning service account related roles to users
- CIS v2.0.0 > 1 Identity and Access Management > 1.1 Ensure that corporate login credentials are used
- CIS v2.0.0 > 1 Identity and Access Management > 1.11 Ensure that Separation of duties is enforced while assigning KMS related roles to users
- CIS v2.0.0 > 1 Identity and Access Management > 1.5 Ensure that Service Account has no Admin privileges
- CIS v2.0.0 > 1 Identity and Access Management > 1.6 Ensure that IAM users are not assigned the Service Account User or Service Account Token Creator roles at project level
- CIS v2.0.0 > 1 Identity and Access Management > 1.8 Ensure that Separation of duties is enforced while assigning service account related roles to users
- CIS v3.0.0 > 1 Identity and Access Management > 1.1 Ensure that Corporate Login Credentials are Used
- CIS v3.0.0 > 1 Identity and Access Management > 1.11 Ensure That Separation of Duties Is Enforced While Assigning KMS Related Roles to Users
- CIS v3.0.0 > 1 Identity and Access Management > 1.5 Ensure That Service Account Has No Admin Privileges
- CIS v3.0.0 > 1 Identity and Access Management > 1.6 Ensure That IAM Users Are Not Assigned the Service Account User or Service Account Token Creator Roles at Project Level
- CIS v3.0.0 > 1 Identity and Access Management > 1.8 Ensure That Separation of Duties Is Enforced While Assigning Service Account Related Roles to Users
- Ensure that IAM users are not assigned the Service Account User or Service Account Token Creator roles at project level
- Ensure that Separation of duties is enforced while assigning KMS related roles to users
- Ensure that Separation of duties is enforced while assigning service account related roles to users
- Ensure that Service Account has no Admin privileges
- Only allow members from my domain to be added to IAM roles
- Prevent public users from having access to resources via IAM
Schema for gcp_iam_policy
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
bindings | jsonb | A list of `members` to a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one member. | |
etag | text | Etag is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. | |
location | text | The GCP multi-region, region, or zone in which the resource is located. | |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
title | text | Title of the resource. | |
version | bigint | Version specifies the format of the policy. Valid values are `0`, `1`, and `3`. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- gcp
You can pass the configuration to the command with the --config
argument:
steampipe_export_gcp --config '<your_config>' gcp_iam_policy