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

Restrict iam policy by tagging SG rules and shield protection #3799

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

oliviassss
Copy link
Collaborator

@oliviassss oliviassss commented Aug 8, 2024

Issue

Currently, the controller does not tag SG rules or shield protection, and the IAM policy is allowing corresponding actions on all resources, which may lead to security concern.

Description

This PR adds the support for the controller to tag SG rules and shield protection, so that we can further scope down the corresponding IAM policies by tags. This PR also introduces new IAM policies for shield:TagResource on protection resource and ec2:CreateTags on security-group-rule resource.

manual test

  1. create protection with Tags
{"level":"info","ts":"2024-08-08T20:35:40Z","logger":"controllers.ingress","msg":"enabling shield protection","resourceARN":"arn:aws:elasticloadbalancing:us-west-2:xxx:loadbalancer/app/k8s-game2048-ingress2-599830d081/6d6dde95299796b6","protectionName":"managed by aws-load-balancer-controller","TagKey":"elbv2.k8s.aws/cluster","TagValue":"sonyingy-jun17"}
{"level":"info","ts":"2024-08-08T20:35:41Z","logger":"controllers.ingress","msg":"enabled shield protection","resourceARN":"arn:aws:elasticloadbalancing:us-west-2:xxx:loadbalancer/app/k8s-game2048-ingress2-599830d081/6d6dde95299796b6","protectionName":"managed by aws-load-balancer-controller","protectionID":"d09c2d3f-8917-4380-9cde-3de9841ae92a"}

Screenshot 2024-08-08 at 1 48 33 PM

  1. delete protection with Tags
{"level":"info","ts":"2024-08-08T20:37:34Z","logger":"controllers.ingress","msg":"disabling shield protection","resourceARN":"arn:aws:elasticloadbalancing:us-west-2:xxx:loadbalancer/app/k8s-game2048-ingress2-599830d081/6d6dde95299796b6","protectionID":"d09c2d3f-8917-4380-9cde-3de9841ae92a"}
{"level":"info","ts":"2024-08-08T20:37:35Z","logger":"controllers.ingress","msg":"disabled shield protection","resourceARN":"arn:aws:elasticloadbalancing:us-west-2:xxx:loadbalancer/app/k8s-game2048-ingress2-599830d081/6d6dde95299796b6"}
  1. Authorize SG rules with tags
    Screenshot 2024-08-08 at 1 50 12 PM
  2. Revoke SG rules with tags by deleting the ingress resources

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 8, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: oliviassss

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 8, 2024
@oliviassss oliviassss added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Aug 8, 2024
@oliviassss
Copy link
Collaborator Author

/retest

@k8s-ci-robot
Copy link
Contributor

@oliviassss: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-aws-load-balancer-controller-e2e-test b43e277 link true /test pull-aws-load-balancer-controller-e2e-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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. do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants