turbot/digitalocean_insights

Query: network_firewall_unrestricted_inbound_status

Usage

powerpipe query digitalocean_insights.query.network_firewall_unrestricted_inbound_status

Steampipe Tables

SQL

with inbound_fw as (
select
id
from
digitalocean_firewall,
jsonb_array_elements(inbound_rules) as i
where
i -> 'sources' -> 'addresses' = '["0.0.0.0/0","::/0"]'
and i ->> 'protocol' <> 'icmp'
group by
id
)
select
status,
count(*) as "Firewalls"
from
(
select
case
when ofw.id is null then 'restricted'
else 'unrestricted'
end as status
from
digitalocean_firewall as df
left join inbound_fw as ofw on df.id = ofw.id
) as inbound_status
group by
status;

Dashboards

The query is used in the dashboards: