turbot/steampipe-mod-aws-compliance

Control: Network Firewall policies should have at least one rule group associated

Description

This control checks whether a Network Firewall policy has any stateful or stateless rule groups associated. The control fails if stateless or stateful rule groups are not assigned.

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.networkfirewall_firewall_policy_rule_group_not_empty

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_compliance.control.networkfirewall_firewall_policy_rule_group_not_empty --share

SQL

This control uses a named query:

select
arn as resource,
case
when (firewall_policy ->> 'StatefulRuleGroupReferences' is null or jsonb_array_length(firewall_policy -> 'StatefulRuleGroupReferences') = 0)
and (firewall_policy ->> 'StatelessRuleGroupReferences' is null or jsonb_array_length(firewall_policy -> 'StatelessRuleGroupReferences') = 0) then 'alarm'
else 'ok'
end as status,
case
when (firewall_policy ->> 'StatefulRuleGroupReferences' is null or jsonb_array_length(firewall_policy -> 'StatefulRuleGroupReferences') = 0)
and (firewall_policy ->> 'StatelessRuleGroupReferences' is null or jsonb_array_length(firewall_policy -> 'StatelessRuleGroupReferences') = 0) then title || ' has no associated rule groups.'
else title || ' has associated rule groups.'
end as reason
, region, account_id
from
aws_networkfirewall_firewall_policy;

Tags