Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Security Groups - Allow All Outbound Traffic does not allow IPv6 Traffic #9946

Closed
jake-jester-nih opened this issue Aug 24, 2020 · 3 comments

Comments

@jake-jester-nih
Copy link

Hello,

When creating a security group, or creating an ec2.Instance with default security group, when one gives the option allowAllOutBoundTraffic: true, only the IPv4 traffic is allowed.

When making calls to services like secretsmanager, the sdk/cli attempts to connect to the ipv6 address first. This causes a timeout error, and is not intuitive to discover, since we have ostensibly specified to allowAllOutboundTraffic.

Unless there is something subtle I am missing, I think allowAllOutboundTraffic: true should specify both ipv4 and ipv6 egress rules.

You can reproduce just by creating a ec2.Instance(...) construct and observing the default rules applied to the security group when allowAllOutboundTraffic: true (default value).

@NetaNir
Copy link
Contributor

NetaNir commented Aug 25, 2020

Yes you are right, we are working on it (sadly adding this default right now will result in a breaking change).
For now, you can set allowAllOutboundTraffic to false and add the two egress rules to allow IPv6 and IPv4 traffic.

duplicate #7827

@NetaNir NetaNir closed this as completed Aug 25, 2020
@jake-jester-nih
Copy link
Author

jake-jester-nih commented Aug 25, 2020

@NetaNir

Sadly this does not work. When setting the rules like this:

let prefectSecurityGroup = new ec2.SecurityGroup( this, "prefect-security-group", {
allowAllOutbound: false,
vpc: parent.coreStack.spaces_vpc,
description: "Allow all outbound, and inbound app ports",
});

prefectSecurityGroup.connections.allowToAnyIpv4( ec2.Port.allTraffic() );
prefectSecurityGroup.connections.allowTo( ec2.Peer.ipv6( "::/0") , ec2.Port.allTraffic() );

it results in this error:
Error: Cannot add an "all traffic" egress rule in this way; set allowAllOutbound=true on the SecurityGroup instead.

Catch 22.

@jake-jester-nih
Copy link
Author

jake-jester-nih commented Aug 25, 2020

Had to do this:

prefectSecurityGroup.connections.allowTo( ec2.Peer.ipv6( "::/0") , ec2.Port.tcp(80) );
prefectSecurityGroup.connections.allowTo( ec2.Peer.ipv6( "::/0") , ec2.Port.tcp(443) );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants