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

Add elasticloadbalancing:ModifyTargetGroupAttributes to aws lb controller #11393

Merged

Conversation

olemarkus
Copy link
Member

Fixes #11297

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 6, 2021
@peter-svensson
Copy link

When using the annotation
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'

The following permissions are needed in order to setup HTTPs certificate:

{
    "Effect": "Allow",
    "Action": "acm:DescribeCertificate",
    "Resource": "arn:aws:acm:*:<accountid>:certificate/*"
},
{
    "Effect": "Allow",
    "Action": "acm:ListCertificates",
    "Resource": "*"
}

@peter-svensson
Copy link

peter-svensson commented May 6, 2021

When changing an ingress I also need to set

       {
            "Effect": "Allow",
            "Action": "elasticloadbalancing:DeleteRule",
            "Resource": [
                "arn:aws:elasticloadbalancing:*:<accountid>:listener-rule/app/*/*/*/*",
                "arn:aws:elasticloadbalancing:*:<accountid>:listener-rule/net/*/*/*/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": "elasticloadbalancing:ModifyRule",
            "Resource": [
                "arn:aws:elasticloadbalancing:*:<accountid>:listener-rule/app/*/*/*/*",
                "arn:aws:elasticloadbalancing:*:<accountid>:listener-rule/net/*/*/*/*"
            ]
        }

@olemarkus olemarkus force-pushed the fix-lb-controller-nlb-permissions branch from ca11045 to cd9ddd6 Compare May 6, 2021 13:29
@olemarkus
Copy link
Member Author

I think the ACM part needs more thinking. Maybe require that the certs have certain tags for them to be used by a cluster.

@peter-svensson
Copy link

I think the ACM part needs more thinking. Maybe require that the certs have certain tags for them to be used by a cluster.

I'd say the same might be applicable to the ALBs created by the ingress controller? But that might be harder to achieve?

@olemarkus
Copy link
Member Author

I think the ACM part needs more thinking. Maybe require that the certs have certain tags for them to be used by a cluster.

I'd say the same might be applicable to the ALBs created by the ingress controller? But that might be harder to achieve?

ALBs created by the LB controller has the elbv2.k8s.aws/cluster: <cluster> tag. But those are created by the cluster.
ACM certs are never created by the cluster itself, so we need to use tags so that ALB controller suddenly doesn't get to use any cert for any purpose.

This is why we don't copy/paste the permissions from the LB controller docs.. they are just way to open for anyone security minded.

@peter-svensson
Copy link

peter-svensson commented May 6, 2021

I think the ACM part needs more thinking. Maybe require that the certs have certain tags for them to be used by a cluster.

I'd say the same might be applicable to the ALBs created by the ingress controller? But that might be harder to achieve?

ALBs created by the LB controller has the elbv2.k8s.aws/cluster: <cluster> tag. But those are created by the cluster.
ACM certs are never created by the cluster itself, so we need to use tags so that ALB controller suddenly doesn't get to use any cert for any purpose.

This is why we don't copy/paste the permissions from the LB controller docs.. they are just way to open for anyone security minded.

I can image that.
What I meant was the the permission that we set with kops when enabling the AWS ALB addon should reflect that as well. So the permission to delete/update rules for example should be only for the ALBs with the correct tags as well. I haven't looked at the code so it might already be the case that it is considered.

@olemarkus
Copy link
Member Author

olemarkus commented May 6, 2021

ah yes. more rules could have

		Condition: Condition{
			"StringEquals": map[string]string{
				"ec2:ResourceTag/elbv2.k8s.aws/cluster": clusterName,
			},
		},

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hakman

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 7, 2021
k8s-ci-robot added a commit that referenced this pull request May 7, 2021
…393-origin-release-1.20

Automated cherry pick of #11393: Add elasticloadbalancing:ModifyTargetGroupAttributes to aws
@k8s-ci-robot k8s-ci-robot merged commit f0307cd into kubernetes:master May 7, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS LoadbalancerController IAM is missing ModifyTargetGroupAttributes
4 participants