-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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 Authorization in Kubernetes Hardening Guide #43623
Conversation
Welcome @ashish493! |
✅ Pull request preview available for checkingBuilt without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
…n-hardening.md Co-authored-by: Qiming Teng <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor suggestions from my side
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
@aj11anuj Thanks, I've made some changes by checking with grammarly. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overarching concerns here:
- Is this still being worked upon @ashish493? I see a lot of deviations from the Kubernetes style guide here & would recommend that you read through the style guide and make necessary changes.
- Can we please get a technical review from SIG Security? @kubernetes/sig-security-pr-reviews ?
cc: @savitharaghunathan {Sorry, in advance, if this doesn't fall within your remit}
@divya-mohan0209 Yeah I'm currently working on the Resource Limits topic for the Hardening Guide. Thanks for the pointing out the Kubernetes style guide . I will make the changes in this doc according to it. |
Hello @ashish493, checking in on the updates for the PR. Is this still being worked upon? |
Hi @divya-mohan0209 |
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
content/en/docs/concepts/security/hardening-guide/authorization-hardening.md
Outdated
Show resolved
Hide resolved
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks @reylejano for reviewing, I've updated the changes according to it. @divya-mohan0209 I've also updated the content according to Kubernetes style guide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ashish493
We've got some quite good documentation already, which sets a bar for quality. I'd only be happy to merge this if you:
- remove the implication that RBAC mode is always active
- fix the snag around recommending admission controllers, rather than authz webhooks
(it's OK to mention admission control as further reading)
and please also consider
- fix the wrapping for the Markdown source, so that lines are typically 100 characters of fewer
|
||
<!-- body --> | ||
|
||
### Role based access control(RBAC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Role based access control(RBAC) | |
## Role based access control (RBAC) {#hardening-rbac} |
- It is crucial to refrain from using the AlwaysAllow value in the --authorization-mode flag. This value effectively disables all authorization modes, compromising the ability to enforce the principle of least privilege. | ||
- Assigning rights using the `system:masters` group should always be avoided, as it possesses hardcoded cluster-admin rights. These rights cannot be revoked due to their hardcoded nature in the source code. Users with `system:masters` rights will always have administrative privileges. The groups who genuinely require cluster-admin rights should be provided a binding to the cluster-admin clusterrole. | ||
|
||
### Resources to restrict to prevent privilege escalation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Resources to restrict to prevent privilege escalation | |
## Resources to restrict to prevent privilege escalation {#hardening-components} |
|
||
To prevent privilege escalation, specific measures should be taken to restrict access to critical resources within the Kubernetes environment: | ||
|
||
- *etcd*: A crucial component storing state information and cluster Secrets, requires careful access control. Roles should be defined for users with access limited to specific keys to prevent unauthorized access, safeguarding the entire cluster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it clear that these aren't roles in the RBAC sense
|
||
- *etcd*: A crucial component storing state information and cluster Secrets, requires careful access control. Roles should be defined for users with access limited to specific keys to prevent unauthorized access, safeguarding the entire cluster. | ||
|
||
- *kubelet*: The primary node agent operating on every node, necessitates secure configuration. The kubelet service should run with --anonymous-auth=false to enhance security. The node/proxy right should be granted judiciously, ensuring only necessary users have access to the Kubelet API and preventing evasion of Kubernetes admission control. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Put command line arguments inside backticks.
|
||
- *kubelet*: The primary node agent operating on every node, necessitates secure configuration. The kubelet service should run with --anonymous-auth=false to enhance security. The node/proxy right should be granted judiciously, ensuring only necessary users have access to the Kubelet API and preventing evasion of Kubernetes admission control. | ||
|
||
- *Kubernetes Dashboard* : a web-based UI for cluster interaction, poses a security risk if accessed by attackers. Users with elevated access to the dashboard can exploit vulnerabilities, including opening shell connections to pods and viewing Secrets. In the cluster role, grant users read-only permission to the dashboard, minimizing write access to mitigate the risk of cryptojacking attacks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, reword this to be good advice whether or not the cluster in question uses Kubernetes RBAC.
|
||
- *Kubernetes Secret* : An object containing sensitive information like passwords and tokens, demand controlled access. Unrestricted access to Secrets should be avoided to limit exposure to potential attackers. Admission controllers should be used to restrict access to only for necessary components. | ||
|
||
- *Kubernetes API* : It is an HTTP API for querying and modifying cluster objects, is critical for communication. Unrestricted access to the API poses risks, including resource modifications, data breaches, and potential cluster takeovers. Implement RBAC policies with minimal verbs, ensuring that users have only the necessary permissions to interact with the Kubernetes API securely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, reword this to be good advice whether or not the cluster in question uses Kubernetes RBAC.
|
||
- *Kubernetes API* : It is an HTTP API for querying and modifying cluster objects, is critical for communication. Unrestricted access to the API poses risks, including resource modifications, data breaches, and potential cluster takeovers. Implement RBAC policies with minimal verbs, ensuring that users have only the necessary permissions to interact with the Kubernetes API securely. | ||
|
||
### Admission controllers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Admission controllers | |
## Admission control {#hardening-admission-control} |
|
||
### Admission controllers | ||
|
||
You can extend the built-in RBAC policies using the validation admission webhooks to strengthen the authorization design. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is poor advice; if you want custom authz, you should use an authorization callout: https://kubernetes.io/docs/reference/access-authn-authz/webhook/
A Kubernetes admission controller is a component of code that analyzes requests made to the Kubernetes API server and decides whether to approve them or deny them. The request gets evaluated after it has been verified and authorized by the API server before it is granted and implemented. | ||
This is an optional feature that may only be required for large-scale clusters or where complex security is required. They can be adjustable for many different user-specific scenarios and environments. There are many open source and commercial implementations from which organizations can choose and enforce their specific restrictions. | ||
|
||
### Auditing RBAC policies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Auditing RBAC policies | |
## Policy review |
@ashish493 : Please could you advise if you're able to address the suggestions made by @sftim in this review? |
@divya-mohan0209 need some more time for those changes. We have sig-security-docs meeting this thursday. I will ask for some help for proceeding further. After that I will update my progress here. |
@ashish493 What's the plan for this PR moving forward? Does it require more refinement, is it ready for review (pending review comments), or are we at the stage where this can be closed? |
@dipesh-rawat Yeah, it needs a little refinement. I couldn't give much time to it because of some personal issues. I will definitely try to do it soon. If it comes to a point where I won't be able to do it, then I will definitely pass this on to sig-security-docs for further enhancement. |
@ashish493 Thank you for your efforts! Since there has been no progress on this PR, I'll be closing it out. In the event that you'd like to pass it on to SIG Security Docs and reopen it, please feel free to do so whenever you have the bandwidth. /close |
@divya-mohan0209: Closed this PR. In response to this:
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. |
This is Authorization Section of Kubernetes hardening guide which has been under discussion in SIG-Security-Docs kubernetes/sig-security#30 .