Control: VPC default security group should not allow inbound and outbound traffic
Description
Amazon Elastic Compute Cloud (Amazon 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 terraform_aws_compliance.control.vpc_default_security_group_restricts_all_traffic
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_aws_compliance.control.vpc_default_security_group_restricts_all_traffic --share
SQL
This control uses a named query:
select address as resource, case when (attributes_std -> 'egress') is null and (attributes_std -> 'ingress') is null then 'ok' else 'alarm' end as status, case when (attributes_std -> 'ingress') is not null and (attributes_std -> 'egress') is not null then 'Default security group ' || split_part(address, '.', 2) || ' has inbound and outbound rules' when (attributes_std -> 'ingress') is not null and (attributes_std -> 'egress') is null then 'Default security group ' || split_part(address, '.', 2) || ' has inbound rules' when (attributes_std -> 'ingress') is null and (attributes_std -> 'egress') is not null then 'Default security group ' || split_part(address, '.', 2) || ' has outbound rules' else 'Default security group ' || split_part(address, '.', 2) || ' has no inbound or outbound rules' end || '.' as reason , path || ':' || start_linefrom terraform_resourcewhere type = 'aws_default_security_group';