-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
(aws-ecs): doesn't configure security group on target group used in alb with forward action that follows non-terminating authenticate action #19035
Comments
Note just in case someone stumbles on this before its fixed:
|
Also another somewhat related issue: when ALB uses authenticateOidc action it needs to communicate with identity provider (ALB fetches token from token endpoint and then user claim from user info endpoint). Identity Provider will typically live in the public internet. right now CDK default - unlike clicking in console - blocks egress Internet access from ALB. This causes ALB to fail with tricky to debug I think when using authenticateOidc action with ALB it would make sense for CDK to configure security group on ALB to allow egress access to 0.0.0.0/0 on port 443 |
This was a fun one to triage on my setup. Took the whole existing ALB down until i found that it had altered the existing SG outbound rules, removing all existing rules, and installing just the single outbound rule for the new service. My setup is slightly different as i have an existing LB. Here's the GIST: |
Also in case someone comes here from trying to solve HTTP 500: Internal server error issues on load balancer provisioned through load_balanced_ecs_service = ecs_patterns.ApplicationLoadBalancedFargateService(...)
load_balanced_ecs_service.listener.add_action(
'AuthAction',
action=elbv2.ListenerAction.authenticate_oidc(...)
)
load_balancer_egress_sg = ec2.SecurityGroup(self, "LBEgressSecurityGroup", vpc=vpc)
load_balancer_egress_sg.add_egress_rule(
peer=ec2.Peer.any_ipv4(),
connection=ec2.Port.tcp(443)
)
load_balanced_ecs_service.load_balancer.add_security_group(load_balancer_egress_sg) I resorted to provision a new security group and add it to the load balancer as I was unable to directly act on the automatically provisioned load balancer security from |
…24510) ## Summary Allow HTTPS outbound traffic for security groups attached to the Application Load Balancer if the Application Load Balancer is configured with an authentication configuration. ## Why is this PR needed? Application Load Balancer authentication requires HTTPS outbound traffic. However, the security group attached to the ApplicationLoadBalancer does not allow traffic to the outside, so the code as described in the documentation will not work by itself. <img width="593" alt="image" src="https://user-images.githubusercontent.com/49480575/223705838-a047e14c-95f5-4c8e-9003-0bbdf6b9d281.png"> This issue is also documented. https://aws.amazon.com/premiumsupport/knowledge-center/elb-configure-authentication-alb/?nc1=h_ls ## Related issues Following opened issues were fixed by #21939, but related this PR. Closes #19035 #18944. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
What is the problem?
If one creates an ApplicationLoadBalancer with a listener which forwards traffic to TargetType.IP target group and then attaches a FargateService to that target group (via
service.attachToApplicationTargetGroup(targetGroup)
call), CDK will automatically configure security groups rules:which is actually quite impressive. The issue is, when listener action is not merely a "Forward" action but rather a non-terminating "authenticateOidc" action (with "Forward" as
next
), this relation seems to break and security groups are not configured well.Reproduction Steps
run
cdk synth
, proper security groups are created:and corresponding
ALBSecurityGrouptoDemoProxyServiceSecurityGroup1E6FC1A280009B0210A1:
but now replace
with composite action:
and security groups are not created and ALB can't reach fargate service.
What did you expect to happen?
security groups created regardless of if forward action is top level action or a 'next' on non-terminating action (AFAIK there are 2 - authenticateOidc and authenticateCogito)
What actually happened?
No target security group changes were made, ALB's only group blocks all outbound traffic:
Fargate service did not allow inbound.
CDK CLI Version
2.8.0 (build 8a5eb49)
Framework Version
No response
Node.js Version
v17.5.0
OS
MacOs
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: