Skip to content

Commit 2ab2062

Browse files
authored
Merge pull request #35457 from kinzhi/kinzhi189
[zh-cn]Update content/zh-cn/docs/concepts/security/rbac-good-practices.md
2 parents e5f91ae + b6ad70c commit 2ab2062

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

content/zh-cn/docs/concepts/security/rbac-good-practices.md

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ execute their roles. It is important to ensure that, when designing permissions
2424
users, the cluster administrator understands the areas where privilge escalation could occur,
2525
to reduce the risk of excessive access leading to security incidents.
2626
27-
The good practices laid out here should be read in conjunction with the general [RBAC documentation](/docs/reference/access-authn-authz/rbac/#restrictions-on-role-creation-or-update).
27+
The good practices laid out here should be read in conjunction with the general
28+
[RBAC documentation](/docs/reference/access-authn-authz/rbac/#restrictions-on-role-creation-or-update).
2829
-->
2930

3031
Kubernetes {{< glossary_tooltip text="RBAC" term_id="rbac" >}}
@@ -47,8 +48,8 @@ Kubernetes {{< glossary_tooltip text="RBAC" term_id="rbac" >}}
4748
### 最小特权 {#least-privilege}
4849

4950
<!--
50-
Ideally minimal RBAC rights should be assigned to users and service accounts. Only permissions
51-
explicitly required for their operation should be used. Whilst each cluster will be different,
51+
Ideally, minimal RBAC rights should be assigned to users and service accounts. Only permissions
52+
explicitly required for their operation should be used. While each cluster will be different,
5253
some general rules that can be applied are :
5354
-->
5455
理想情况下,分配给用户和服务帐户的 RBAC 权限应该是最小的。
@@ -59,14 +60,15 @@ some general rules that can be applied are :
5960
ClusterRoleBindings to give users rights only within a specific namespace.
6061
- Avoid providing wildcard permissions when possible, especially to all resources.
6162
As Kubernetes is an extensible system, providing wildcard access gives rights
62-
not just to all object types presently in the cluster, but also to all future object types
63+
not just to all object types that currently exist in the cluster, but also to all future object types
6364
which are created in the future.
6465
- Administrators should not use `cluster-admin` accounts except where specifically needed.
65-
Providing a low privileged account with [impersonation rights](/docs/reference/access-authn-authz/authentication/#user-impersonation)
66+
Providing a low privileged account with
67+
[impersonation rights](/docs/reference/access-authn-authz/authentication/#user-impersonation)
6668
can avoid accidental modification of cluster resources.
6769
- Avoid adding users to the `system:masters` group. Any user who is a member of this group
6870
bypasses all RBAC rights checks and will always have unrestricted superuser access, which cannot be
69-
revoked by removing Role Bindings or Cluster Role Bindings. As an aside, if a cluster is
71+
revoked by removing RoleBindings or ClusterRoleBindings. As an aside, if a cluster is
7072
using an authorization webhook, membership of this group also bypasses that webhook (requests
7173
from users who are members of that group are never sent to the webhook)
7274
-->
@@ -89,14 +91,17 @@ some general rules that can be applied are :
8991
### 最大限度地减少特权令牌的分发 {#minimize-distribution-of-privileged-tokens}
9092

9193
<!--
92-
Ideally, pods shouldn't be assigned service accounts that have been granted powerful permissions (for example, any of the rights listed under
93-
[privilege escalation risks](#privilege-escalation-risks)).
94+
Ideally, pods shouldn't be assigned service accounts that have been granted powerful permissions
95+
(for example, any of the rights listed under [privilege escalation risks](#privilege-escalation-risks)).
9496
In cases where a workload requires powerful permissions, consider the following practices:
97+
9598
- Limit the number of nodes running powerful pods. Ensure that any DaemonSets you run
9699
are necessary and are run with least privilege to limit the blast radius of container escapes.
97100
- Avoid running powerful pods alongside untrusted or publicly-exposed ones. Consider using
98-
[Taints and Toleration](/docs/concepts/scheduling-eviction/taint-and-toleration/), [NodeAffinity](/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity), or [PodAntiAffinity](/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity) to ensure
99-
pods don't run alongside untrusted or less-trusted Pods. Pay especial attention to
101+
[Taints and Toleration](/docs/concepts/scheduling-eviction/taint-and-toleration/),
102+
[NodeAffinity](/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity), or
103+
[PodAntiAffinity](/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity)
104+
to ensure pods don't run alongside untrusted or less-trusted Pods. Pay especial attention to
100105
situations where less-trustworthy Pods are not meeting the **Restricted** Pod Security Standard.
101106
-->
102107
理想情况下,不应为 Pod 分配具有强大权限(例如,在[特权提级的风险](#privilege-escalation-risks)中列出的任一权限)的服务帐户。
@@ -109,6 +114,7 @@ In cases where a workload requires powerful permissions, consider the following
109114
[Pod 反亲和性](/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity)确保
110115
Pod 不会与不可信或不太受信任的 Pod 一起运行。
111116
特别注意可信度不高的 Pod 不符合 **Restricted** Pod 安全标准的情况。
117+
112118
<!--
113119
### Hardening
114120
@@ -124,7 +130,7 @@ Kubernetes 默认提供访问权限并非是每个集群都需要的。
124130
一般来说,不应该更改 `system:` 帐户的某些权限,有一些方式来强化现有集群的权限:
125131

126132
<!--
127-
- Review bindings for the `system:unauthenticated` group and remove where possible, as this gives
133+
- Review bindings for the `system:unauthenticated` group and remove them where possible, as this gives
128134
access to anyone who can contact the API server at a network level.
129135
- Avoid the default auto-mounting of service account tokens by setting
130136
`automountServiceAccountToken: false`. For more details, see
@@ -213,7 +219,7 @@ or other (third party) mechanisms to implement that enforcement.
213219
你可以使用 [Pod 安全性准入](/zh-cn/docs/concepts/security/pod-security-admission/)或其他(第三方)机制来强制实施这些限制。
214220

215221
<!--
216-
You can also use the deprecated [PodSecurityPolicy](/docs/concepts/policy/pod-security-policy/) mechanism
222+
You can also use the deprecated [PodSecurityPolicy](/docs/concepts/security/pod-security-policy/) mechanism
217223
to restrict users' abilities to create privileged Pods (N.B. PodSecurityPolicy is scheduled for removal
218224
in version 1.25).
219225
-->
@@ -232,7 +238,9 @@ Secrets they would not have through RBAC directly.
232238
<!--
233239
### Persistent volume creation
234240
235-
As noted in the [PodSecurityPolicy](/docs/concepts/policy/pod-security-policy/#volumes-and-file-systems) documentation, access to create PersistentVolumes can allow for escalation of access to the underlying host. Where access to persistent storage is required trusted administrators should create
241+
As noted in the [PodSecurityPolicy](/docs/concepts/security/pod-security-policy/#volumes-and-file-systems)
242+
documentation, access to create PersistentVolumes can allow for escalation of access to the underlying host.
243+
Where access to persistent storage is required trusted administrators should create
236244
PersistentVolumes, and constrained users should use PersistentVolumeClaims to access that storage.
237245
-->
238246
### 持久卷的创建 {#persistent-volume-creation}
@@ -246,7 +254,7 @@ PersistentVolumes, and constrained users should use PersistentVolumeClaims to ac
246254
### Access to `proxy` subresource of Nodes
247255
248256
Users with access to the proxy sub-resource of node objects have rights to the Kubelet API,
249-
which allows for command execution on every pod on the node(s) which they have rights to.
257+
which allows for command execution on every pod on the node(s) to which they have rights.
250258
This access bypasses audit logging and admission control, so care should be taken before
251259
granting rights to this resource.
252260
-->
@@ -259,8 +267,8 @@ granting rights to this resource.
259267
<!--
260268
### Escalate verb
261269
262-
Generally the RBAC system prevents users from creating clusterroles with more rights than
263-
they possess. The exception to this is the `escalate` verb. As noted in the [RBAC documentation](/docs/reference/access-authn-authz/rbac/#restrictions-on-role-creation-or-update),
270+
Generally, the RBAC system prevents users from creating clusterroles with more rights than the user possesses.
271+
The exception to this is the `escalate` verb. As noted in the [RBAC documentation](/docs/reference/access-authn-authz/rbac/#restrictions-on-role-creation-or-update),
264272
users with this right can effectively escalate their privileges.
265273
-->
266274
### esclate 动词 {#escalate-verb}
@@ -272,7 +280,7 @@ users with this right can effectively escalate their privileges.
272280
<!--
273281
### Bind verb
274282
275-
Similar to the `escalate` verb, granting users this right allows for bypass of Kubernetes
283+
Similar to the `escalate` verb, granting users this right allows for the bypass of Kubernetes
276284
in-built protections against privilege escalation, allowing users to create bindings to
277285
roles with rights they do not already have.
278286
-->
@@ -344,7 +352,8 @@ objects to create a denial of service condition either based on the size or numb
344352
specifically relevant in multi-tenant clusters if semi-trusted or untrusted users
345353
are allowed limited access to a system.
346354
347-
One option for mitigation of this issue would be to use [resource quotas](/docs/concepts/policy/resource-quotas/#object-count-quota)
355+
One option for mitigation of this issue would be to use
356+
[resource quotas](/docs/concepts/policy/resource-quotas/#object-count-quota)
348357
to limit the quantity of objects which can be created.
349358
-->
350359
## Kubernetes RBAC - 拒绝服务攻击的风险 {#denial-of-service-risks}
@@ -354,4 +363,11 @@ to limit the quantity of objects which can be created.
354363
产生拒绝服务状况,如 [Kubernetes 使用的 etcd 容易受到 OOM 攻击](https://github.com/kubernetes/kubernetes/issues/107325)中的讨论。
355364
允许太不受信任或者不受信任的用户对系统进行有限的访问在多租户集群中是特别重要的。
356365

357-
缓解此问题的一种选择是使用[资源配额](/zh-cn/docs/concepts/policy/resource-quotas/#object-count-quota)以限制可以创建的对象数量。
366+
缓解此问题的一种选择是使用[资源配额](/zh-cn/docs/concepts/policy/resource-quotas/#object-count-quota)以限制可以创建的对象数量。
367+
368+
## {{% heading "whatsnext" %}}
369+
370+
<!--
371+
* To learn more about RBAC, see the [RBAC documentation](/docs/reference/access-authn-authz/rbac/).
372+
-->
373+
* 了解有关 RBAC 的更多信息,请参阅 [RBAC 文档](/zh-cn/docs/reference/access-authn-authz/rbac/)

0 commit comments

Comments
 (0)