Table: gcp_compute_firewalls

This table shows data for GCP Compute Firewalls.

The primary key for this table is self_link.

Columns

NameType
_cq_iduuid
_cq_parent_iduuid
project_idutf8
allowedjson
creation_timestamputf8
deniedjson
descriptionutf8
destination_rangeslist<item: utf8, nullable>
directionutf8
disabledbool
idint64
kindutf8
log_configjson
nameutf8
networkutf8
priorityint64
self_link (PK)utf8
source_rangeslist<item: utf8, nullable>
source_service_accountslist<item: utf8, nullable>
source_tagslist<item: utf8, nullable>
target_service_accountslist<item: utf8, nullable>
target_tagslist<item: utf8, nullable>

Example Queries

These SQL queries are sampled from CloudQuery policies and are compatible with PostgreSQL.

GCP CIS3.10 Ensure Firewall Rules for instances behind Identity Aware Proxy (IAP) only allow the traffic from Google Cloud Loadbalancer (GCLB) Health Check and Proxy Addresses (Manual)

WITH
  combined
    AS (
      SELECT
        *
      FROM
        gcp_compute_firewalls AS gcf, jsonb_array_elements(gcf.allowed) AS a
    )
SELECT
  DISTINCT
  gcf.name AS resource_id,
  'GCP CIS3.10 Ensure Firewall Rules for instances behind Identity Aware Proxy (IAP) only allow the traffic from Google Cloud Loadbalancer (GCLB) Health Check and Proxy Addresses (Manual)'
    AS title,
  gcf.project_id AS project_id,
  CASE
  WHEN NOT (ARRAY['35.191.0.0/16', '130.211.0.0/22'] <@ gcf.source_ranges)
  AND NOT
      (
        gcf.value->>'I_p_protocol' = 'tcp'
        AND ARRAY (SELECT jsonb_array_elements_text(gcf.value->'ports'))
          @> ARRAY['80']
      )
  THEN 'fail'
  ELSE 'pass'
  END
    AS status
FROM
  combined AS gcf;