turbot/alicloud_insights

Query: ecs_security_group_ingress_rules

Usage

powerpipe query alicloud_insights.query.ecs_security_group_ingress_rules

SQL

select
concat(text(p ->> 'SourceCidrIp'), text(p ->> 'Ipv6SourceCidrIp'), text(p ->> 'SourceGroupId'),text(p ->> 'SourcePrefixListId')) as "Source",
p ->> 'Policy' as "Policy",
case
when p ->> 'IpProtocol' = 'ALL' then 'All Traffic'
when p ->> 'IpProtocol' = 'ICMP' then 'ICMP'
else p ->> 'IpProtocol'
end as "Protocol",
case
when p ->> 'PortRange' = '-1/-1' or p ->> 'PortRange' = '1/65535' then 'All'
when SPLIT_PART(p ->> 'PortRange','/',2) = SPLIT_PART(p ->> 'PortRange','/',1) then SPLIT_PART(p ->> 'PortRange','/',2)::text
else p ->> 'PortRange'
end as "Ports"
from
alicloud_ecs_security_group,
jsonb_array_elements(permissions) as p
where
p ->> 'Direction' = 'ingress'
and security_group_id = $1;

Dashboards

The query is used in the dashboards: