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.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 12, 2024
@michaelDovgal
Copy link

Oh, it's a very nice thing to have! Thanks for submitting this PR. wonder if it actually can be merged?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 18, 2024
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 17, 2025
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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

4 participants