Control: VPC default security group should not allow inbound and outbound traffic
Description
AWS Elastic Compute Cloud (AWS EC2) security groups can help in the management of network access by providing stateful filtering of ingress and egress network traffic to AWS resources.
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.vpc_default_security_group_restricts_all_traffic
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.vpc_default_security_group_restricts_all_traffic --share
SQL
This control uses a named query:
select arn resource, case when jsonb_array_length(ip_permissions) = 0 and jsonb_array_length(ip_permissions_egress) = 0 then 'ok' else 'alarm' end status, case when jsonb_array_length(ip_permissions) > 0 and jsonb_array_length(ip_permissions_egress) > 0 then 'Default security group ' || group_id || ' has inbound and outbound rules.' when jsonb_array_length(ip_permissions) > 0 and jsonb_array_length(ip_permissions_egress) = 0 then 'Default security group ' || group_id || ' has inbound rules.' when jsonb_array_length(ip_permissions) = 0 and jsonb_array_length(ip_permissions_egress) > 0 then 'Default security group ' || group_id || ' has outbound rules.' else 'Default security group ' || group_id || ' has no inbound or outbound rules.' end reason , region, account_idfrom aws_vpc_security_groupwhere group_name = 'default';