turbot/steampipe-mod-terraform-azure-compliance

Control: Network Security Rules UDP Services are restricted from the Internet

Description

Disable Internet exposed UDP ports on network security rules.

Usage

Run the control in your terminal:

powerpipe control run terraform_azure_compliance.control.network_security_rule_udp_access_restricted

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_azure_compliance.control.network_security_rule_udp_access_restricted --share

SQL

This control uses a named query:

select
address as resource,
case
when lower(attributes_std ->> 'protocol') = 'udp'
and lower(attributes_std ->> 'direction') = 'inbound'
and lower(attributes_std ->> 'access') = 'allow'
and lower(attributes_std ->> 'source_address_prefix') in ('*', '0.0.0.0', '<nw>/0', '/0', 'internet', 'any') then 'alarm'
else 'ok'
end as status,
split_part(address, '.', 2) || case
when lower(attributes_std ->> 'protocol') = 'udp'
and lower(attributes_std ->> 'direction') = 'inbound'
and lower(attributes_std ->> 'access') = 'allow'
and lower(attributes_std ->> 'source_address_prefix') in ('*', '0.0.0.0', '<nw>/0', '/0', 'internet', 'any') then ' allows UDP services from internet'
else ' restricts UDP services from internet'
end || '.' reason
, path || ':' || start_line
from
terraform_resource
where
type = 'azurerm_network_security_rule';

Tags