turbot/alicloud_insights

Query: ecs_security_unrestricted_egress

Usage

powerpipe query alicloud_insights.query.ecs_security_unrestricted_egress

SQL

with egress_sg as (
select
distinct arn
from
alicloud_ecs_security_group,
jsonb_array_elements(permissions) as p
where
p ->> 'Policy' = 'Accept' and p ->> 'IpProtocol' <> 'ICMP'
and p ->> 'Direction' = 'egress'
and p ->> 'SourceCidrIp' = '0.0.0.0/0'
and (
p ->> 'PortRange' in ('-1/-1', '1/65535')
)
and security_group_id = $1
)
select
'Egress (Excludes ICMP)' as label,
case when count(*) = 0 then 'Restricted' else 'Unrestricted' end as value,
case when count(*) = 0 then 'ok' else 'alert' end as type
from
egress_sg

Dashboards

The query is used in the dashboards: