@@ -35,7 +35,7 @@ cloud-provider-wide access control systems which may handle other APIs besides
35
35
the Kubernetes API.
36
36
-->
37
37
在 Kubernetes 中,你必须在鉴权(授予访问权限)之前进行身份验证(登录),有关身份验证的信息,
38
- 请参阅[ 访问控制概述] ( /zh/docs/concepts/security/controlling-access/ ) .
38
+ 请参阅[ 访问控制概述] ( /zh-cn /docs/concepts/security/controlling-access/ ) .
39
39
40
40
Kubernetes 期望请求中存在 REST API 常见的属性。
41
41
这意味着 Kubernetes 鉴权适用于现有的组织范围或云提供商范围的访问控制系统,
@@ -48,7 +48,15 @@ Kubernetes authorizes API requests using the API server. It evaluates all of the
48
48
request attributes against all policies and allows or denies the request. All
49
49
parts of an API request must be allowed by some policy in order to proceed. This
50
50
means that permissions are denied by default.
51
+ -->
52
+ ## 确定是允许还是拒绝请求 {#determine-whether-a-request-is-allowed-or-denied}
53
+
54
+ Kubernetes 使用 API 服务器对 API 请求进行鉴权。
55
+ 它根据所有策略评估所有请求属性来决定允许或拒绝请求。
56
+ 一个 API 请求的所有部分都必须被某些策略允许才能继续。
57
+ 这意味着默认情况下拒绝权限。
51
58
59
+ <!--
52
60
(Although Kubernetes uses the API server, access controls and policies that
53
61
depend on specific fields of specific kinds of objects are handled by Admission
54
62
Controllers.)
@@ -58,13 +66,6 @@ If any authorizer approves or denies a request, that decision is immediately
58
66
returned and no other authorizer is consulted. If all modules have no opinion on
59
67
the request, then the request is denied. A deny returns an HTTP status code 403.
60
68
-->
61
- ## 确定是允许还是拒绝请求
62
-
63
- Kubernetes 使用 API 服务器对 API 请求进行鉴权。
64
- 它根据所有策略评估所有请求属性来决定允许或拒绝请求。
65
- 一个 API 请求的所有部分都必须被某些策略允许才能继续。
66
- 这意味着默认情况下拒绝权限。
67
-
68
69
(尽管 Kubernetes 使用 API 服务器,但是依赖于特定对象种类的特定字段的访问控制
69
70
和策略由准入控制器处理。)
70
71
@@ -94,38 +95,39 @@ Kubernetes reviews only the following API request attributes:
94
95
95
96
Kubernetes 仅审查以下 API 请求属性:
96
97
97
- * ** 用户** - 身份验证期间提供的 ` user ` 字符串。
98
- * ** 组** - 经过身份验证的用户所属的组名列表。
99
- * ** 额外信息** - 由身份验证层提供的任意字符串键到字符串值的映射。
100
- * ** API** - 指示请求是否针对 API 资源。
101
- * ** 请求路径** - 各种非资源端点的路径,如 ` /api ` 或 ` /healthz ` 。
102
- * ** API 请求动词** - API 动词 ` get ` 、` list ` 、` create ` 、` update ` 、` patch ` 、` watch ` 、
98
+ * ** 用户** —— 身份验证期间提供的 ` user ` 字符串。
99
+ * ** 组** —— 经过身份验证的用户所属的组名列表。
100
+ * ** 额外信息** —— 由身份验证层提供的任意字符串键到字符串值的映射。
101
+ * ** API** —— 指示请求是否针对 API 资源。
102
+ * ** 请求路径** —— 各种非资源端点的路径,如 ` /api ` 或 ` /healthz ` 。
103
+ * ** API 请求动词** —— API 动词 ` get ` 、` list ` 、` create ` 、` update ` 、` patch ` 、` watch ` 、
103
104
` proxy ` 、` redirect ` 、` delete ` 和 ` deletecollection ` 用于资源请求。
104
- 要确定资源 API 端点的请求动词,请参阅
105
- [ 确定请求动词] ( #determine-the-request-verb ) 。
106
- * ** HTTP 请求动词** - HTTP 动词 ` get ` 、` post ` 、` put ` 和 ` delete ` 用于非资源请求。
107
- * ** Resource** - 正在访问的资源的 ID 或名称(仅限资源请求)-
105
+ 要确定资源 API 端点的请求动词,请参阅[ 确定请求动词] ( #determine-the-request-verb ) 。
106
+ * ** HTTP 请求动词** —— HTTP 动词 ` get ` 、` post ` 、` put ` 和 ` delete ` 用于非资源请求。
107
+ * ** 资源** —— 正在访问的资源的 ID 或名称(仅限资源请求)-
108
108
对于使用 ` get ` 、` update ` 、` patch ` 和 ` delete ` 动词的资源请求,你必须提供资源名称。
109
- * ** 子资源** - 正在访问的子资源(仅限资源请求)。
110
- * ** 名字空间** - 正在访问的对象的名称空间(仅适用于名字空间资源请求)。
111
- * ** API 组** - 正在访问的 {{< glossary_tooltip text="API 组" term_id="api-group" >}}
112
- (仅限资源请求)。空字符串表示[ 核心 API 组] ( /zh/docs/reference/using-api/#api-groups ) 。
109
+ * ** 子资源** —— 正在访问的子资源(仅限资源请求)。
110
+ * ** 名字空间** —— 正在访问的对象的名称空间(仅适用于名字空间资源请求)。
111
+ * ** API 组** —— 正在访问的 {{< glossary_tooltip text="API 组" term_id="api-group" >}}
112
+ (仅限资源请求)。空字符串表示[ 核心 API 组] ( /zh-cn /docs/reference/using-api/#api-groups ) 。
113
113
114
114
<!--
115
115
## Determine the Request Verb
116
116
117
117
**Non-resource requests**
118
118
Requests to endpoints other than `/api/v1/...` or `/apis/<group>/<version>/...`
119
119
are considered "non-resource requests", and use the lower-cased HTTP method of the request as the verb.
120
+
120
121
For example, a `GET` request to endpoints like `/api` or `/healthz` would use `get` as the verb.
121
122
-->
122
123
## 确定请求动词 {#determine-the-request-verb}
123
124
124
125
** 非资源请求**
125
126
126
- 对于 ` /api/v1/... ` 或 ` /apis/<group>/<version>/... ` 之外的端点的请求被
127
- 视为“非资源请求(Non-Resource Requests)”,并使用该请求的 HTTP 方法的
128
- 小写形式作为其请求动词。
127
+ 对于 ` /api/v1/... ` 或 ` /apis/<group>/<version>/... `
128
+ 之外的端点的请求被视为 “非资源请求(Non-Resource Requests)”,
129
+ 并使用该请求的 HTTP 方法的小写形式作为其请求动词。
130
+
129
131
例如,对 ` /api ` 或 ` /healthz ` 这类端点的 ` GET ` 请求将使用 ` get ` 作为其动词。
130
132
131
133
<!--
@@ -137,8 +139,7 @@ collection of resources:
137
139
-->
138
140
** 资源请求**
139
141
140
- 要确定对资源 API 端点的请求动词,需要查看所使用的 HTTP 动词以及该请求是针对
141
- 单个资源还是一组资源:
142
+ 要确定对资源 API 端点的请求动词,需要查看所使用的 HTTP 动词以及该请求是针对单个资源还是一组资源:
142
143
143
144
<!--
144
145
HTTP verb | request verb
@@ -169,19 +170,19 @@ Kubernetes sometimes checks authorization for additional permissions using speci
169
170
-->
170
171
Kubernetes 有时使用专门的动词以对额外的权限进行鉴权。例如:
171
172
172
- * [ PodSecurityPolicy] ( /zh/docs/concepts/security/pod-security-policy/ )
173
+ * [ PodSecurityPolicy] ( /zh-cn /docs/concepts/security/pod-security-policy/ )
173
174
* ` policy ` API 组中 ` podsecuritypolicies ` 资源使用 ` use ` 动词
174
- * [ RBAC] ( /zh/docs/reference/access-authn-authz/rbac/#privilege-escalation-prevention-and-bootstrapping )
175
+ * [ RBAC] ( /zh-cn /docs/reference/access-authn-authz/rbac/#privilege-escalation-prevention-and-bootstrapping )
175
176
* 对 ` rbac.authorization.k8s.io ` API 组中 ` roles ` 和 ` clusterroles ` 资源的 ` bind `
176
177
和 ` escalate ` 动词
177
- * [ 身份认证] ( /zh/docs/reference/access-authn-authz/authentication/ )
178
+ * [ 身份认证] ( /zh-cn /docs/reference/access-authn-authz/authentication/ )
178
179
* 对核心 API 组中 ` users ` 、` groups ` 和 ` serviceaccounts ` 以及 ` authentication.k8s.io `
179
180
API 组中的 ` userextras ` 所使用的 ` impersonate ` 动词。
180
181
181
182
<!--
182
183
## Authorization Modules {#authorization-modules}
183
184
184
- * **Node** - A special-purpose authorizer that grants permissions to kubelets based on the pods they are scheduled to run. To learn more about using the Node authorization mode, see [Node Authorization](/docs/reference/access-authn-authz/node/).
185
+ * **Node** - A special-purpose authorization mode that grants permissions to kubelets based on the pods they are scheduled to run. To learn more about using the Node authorization mode, see [Node Authorization](/docs/reference/access-authn-authz/node/).
185
186
* **ABAC** - Attribute-based access control (ABAC) defines an access control paradigm whereby access rights are granted to users through the use of policies which combine attributes together. The policies can use any type of attributes (user attributes, resource attributes, object, environment attributes, etc). To learn more about using the ABAC mode, see [ABAC Mode](/docs/reference/access-authn-authz/abac/).
186
187
* **RBAC** - Role-based access control (RBAC) is a method of regulating access to computer or network resources based on the roles of individual users within an enterprise. In this context, access is the ability of an individual user to perform a specific task, such as view, create, or modify a file. To learn more about using the RBAC mode, see [RBAC Mode](/docs/reference/access-authn-authz/rbac/)
187
188
* When specified RBAC (Role-Based Access Control) uses the `rbac.authorization.k8s.io` API group to drive authorization decisions, allowing admins to dynamically configure permission policies through the Kubernetes API.
@@ -190,23 +191,25 @@ Kubernetes 有时使用专门的动词以对额外的权限进行鉴权。例如
190
191
-->
191
192
## 鉴权模块 {#authorization-modules}
192
193
193
- * ** Node** - 一个专用鉴权组件,根据调度到 kubelet 上运行的 Pod 为 kubelet 授予权限。
194
- 了解有关使用节点鉴权模式的更多信息,请参阅[ 节点鉴权] ( /zh/docs/reference/access-authn-authz/node/ ) 。
195
- * ** ABAC** - 基于属性的访问控制(ABAC)定义了一种访问控制范型,通过使用将属性组合
196
- 在一起的策略,将访问权限授予用户。策略可以使用任何类型的属性(用户属性、资源属性、
197
- 对象,环境属性等)。要了解有关使用 ABAC 模式的更多信息,请参阅
198
- [ ABAC 模式] ( /zh/docs/reference/access-authn-authz/abac/ ) 。
199
- * ** RBAC** - 基于角色的访问控制(RBAC)是一种基于企业内个人用户的角色来管理对
200
- 计算机或网络资源的访问的方法。在此上下文中,权限是单个用户执行特定任务的能力,
194
+ * ** Node** —— 一个专用鉴权模式,根据调度到 kubelet 上运行的 Pod 为 kubelet 授予权限。
195
+ 要了解有关使用节点鉴权模式的更多信息,请参阅[ 节点鉴权] ( /zh-cn/docs/reference/access-authn-authz/node/ ) 。
196
+ * ** ABAC** —— 基于属性的访问控制(ABAC)定义了一种访问控制范型,通过使用将属性组合在一起的策略,
197
+ 将访问权限授予用户。策略可以使用任何类型的属性(用户属性、资源属性、对象,环境属性等)。
198
+ 要了解有关使用 ABAC 模式的更多信息,请参阅
199
+ [ ABAC 模式] ( /zh-cn/docs/reference/access-authn-authz/abac/ ) 。
200
+ * ** RBAC** —— 基于角色的访问控制(RBAC)
201
+ 是一种基于企业内个人用户的角色来管理对计算机或网络资源的访问的方法。
202
+ 在此上下文中,权限是单个用户执行特定任务的能力,
201
203
例如查看、创建或修改文件。要了解有关使用 RBAC 模式的更多信息,请参阅
202
- [ RBAC 模式] ( /zh/docs/reference/access-authn-authz/rbac/ ) 。
203
- * 被启用之后,RBAC(基于角色的访问控制)使用 ` rbac.authorization.k8s.io ` API 组来
204
- 驱动鉴权决策 ,从而允许管理员通过 Kubernetes API 动态配置权限策略。
204
+ [ RBAC 模式] ( /zh-cn /docs/reference/access-authn-authz/rbac/ ) 。
205
+ * 被启用之后,RBAC(基于角色的访问控制)使用 ` rbac.authorization.k8s.io ` API
206
+ 组来驱动鉴权决策 ,从而允许管理员通过 Kubernetes API 动态配置权限策略。
205
207
* 要启用 RBAC,请使用 ` --authorization-mode = RBAC ` 启动 API 服务器。
206
- * ** Webhook** - WebHook 是一个 HTTP 回调:发生某些事情时调用的 HTTP POST;
207
- 通过 HTTP POST 进行简单的事件通知。实现 WebHook 的 Web 应用程序会在发生某些事情时
208
- 将消息发布到 URL。要了解有关使用 Webhook 模式的更多信息,请参阅
209
- [ Webhook 模式] ( /zh/docs/reference/access-authn-authz/webhook/ ) 。
208
+ * ** Webhook** —— WebHook 是一个 HTTP 回调:发生某些事情时调用的 HTTP POST;
209
+ 通过 HTTP POST 进行简单的事件通知。
210
+ 实现 WebHook 的 Web 应用程序会在发生某些事情时将消息发布到 URL。
211
+ 要了解有关使用 Webhook 模式的更多信息,请参阅
212
+ [ Webhook 模式] ( /zh-cn/docs/reference/access-authn-authz/webhook/ ) 。
210
213
211
214
<!--
212
215
#### Checking API Access
@@ -225,7 +228,9 @@ a given action, and works regardless of the authorization mode used.
225
228
kubectl auth can-i create deployments --namespace dev
226
229
```
227
230
228
- <!-- The output is similar to this: -->
231
+ <!--
232
+ The output is similar to this:
233
+ -->
229
234
输出类似于:
230
235
231
236
```
236
241
kubectl auth can-i create deployments --namespace prod
237
242
```
238
243
239
- <!-- The output is similar to this: -->
244
+ <!--
245
+ The output is similar to this:
246
+ -->
240
247
输出类似于:
241
248
242
249
```
247
254
Administrators can combine this with [user impersonation](/docs/reference/access-authn-authz/authentication/#user-impersonation)
248
255
to determine what action other users can perform.
249
256
-->
250
- 管理员可以将此与
251
- [ 用户扮演] ( /zh/docs/reference/access-authn-authz/authentication/#user-impersonation )
257
+ 管理员可以将此与[ 用户扮演(User Impersonation)] ( /zh-cn/docs/reference/access-authn-authz/authentication/#user-impersonation )
252
258
结合使用,以确定其他用户可以执行的操作。
253
259
254
260
``` bash
255
261
kubectl auth can-i list secrets --namespace dev --as dave
256
262
```
257
263
258
- <!-- The output is similar to this: -->
264
+ <!--
265
+ The output is similar to this:
266
+ -->
259
267
输出类似于:
260
268
261
269
```
266
274
Similarly, to check whether a ServiceAccount named `dev-sa` in Namespace `dev`
267
275
can list Pods in the Namespace `target`:
268
276
-->
269
- 类似地,检查名字空间 ` dev ` 里的 ` dev-sa ` 服务账号是否可以列举名字空间 ` target ` 里的 Pod:
277
+ 类似地,检查名字空间 ` dev ` 里的 ` dev-sa ` 服务账户是否可以列举名字空间 ` target ` 里的 Pod:
270
278
271
279
``` bash
272
280
kubectl auth can-i list pods \
273
281
--namespace target \
274
282
--as system:serviceaccount:dev:dev-sa
275
283
```
276
284
277
- <!-- The output is similar to this: -->
285
+ <!--
286
+ The output is similar to this:
287
+ -->
278
288
输出类似于:
279
289
280
290
```
@@ -297,10 +307,9 @@ field of the returned object is the result of the query.
297
307
服务器鉴权公开给外部服务。该组中的其他资源包括:
298
308
299
309
* ` SubjectAccessReview ` - 对任意用户的访问进行评估,而不仅仅是当前用户。
300
- 当鉴权决策被委派给 API 服务器时很有用。例如,kubelet 和扩展 API 服务器使用
301
- 它来确定用户对自己的 API 的访问权限。
302
- * ` LocalSubjectAccessReview ` - 与 ` SubjectAccessReview ` 类似,但仅限于特定的
303
- 名字空间。
310
+ 当鉴权决策被委派给 API 服务器时很有用。例如,kubelet 和扩展 API
311
+ 服务器使用它来确定用户对自己的 API 的访问权限。
312
+ * ` LocalSubjectAccessReview ` - 与 ` SubjectAccessReview ` 类似,但仅限于特定的名字空间。
304
313
* ` SelfSubjectRulesReview ` - 返回用户可在名字空间内执行的操作集的审阅。
305
314
用户可以快速汇总自己的访问权限,或者用于 UI 中的隐藏/显示动作。
306
315
@@ -349,7 +358,7 @@ your policies include:
349
358
350
359
The following flags can be used:
351
360
-->
352
- ## 为你的鉴权模块设置参数
361
+ ## 为你的鉴权模块设置参数 {#using-flags-for-your-authorization-module}
353
362
354
363
你必须在策略中包含一个参数标志,以指明你的策略包含哪个鉴权模块:
355
364
@@ -363,24 +372,21 @@ The following flags can be used:
363
372
* `--authorization-mode=AlwaysDeny` This flag blocks all requests. Use this flag only for testing.
364
373
* `--authorization-mode=AlwaysAllow` This flag allows all requests. Use this flag only if you do not require authorization for your API requests.
365
374
-->
366
- * `--authorization-mode=ABAC` 基于属性的访问控制(ABAC)模式允许你
367
- 使用本地文件配置策略。
375
+ * `--authorization-mode=ABAC` 基于属性的访问控制(ABAC)模式允许你使用本地文件配置策略。
368
376
* `--authorization-mode=RBAC` 基于角色的访问控制(RBAC)模式允许你使用
369
377
Kubernetes API 创建和存储策略。
370
378
* `--authorization-mode=Webhook` WebHook 是一种 HTTP 回调模式,允许你使用远程
371
379
REST 端点管理鉴权。
372
380
* `--authorization-mode=Node` 节点鉴权是一种特殊用途的鉴权模式,专门对
373
381
kubelet 发出的 API 请求执行鉴权。
374
382
* `--authorization-mode=AlwaysDeny` 该标志阻止所有请求。仅将此标志用于测试。
375
- * `--authorization-mode=AlwaysAllow` 此标志允许所有请求。仅在你不需要 API 请求
376
- 的鉴权时才使用此标志。
383
+ * `--authorization-mode=AlwaysAllow` 此标志允许所有请求。仅在你不需要 API 请求的鉴权时才使用此标志。
377
384
378
385
<!--
379
386
You can choose more than one authorization module. Modules are checked in order
380
387
so an earlier module has higher priority to allow or deny a request.
381
388
-->
382
- 你可以选择多个鉴权模块。模块按顺序检查,以便较靠前的模块具有更高的优先级来允许
383
- 或拒绝请求。
389
+ 你可以选择多个鉴权模块。模块按顺序检查,以便较靠前的模块具有更高的优先级来允许或拒绝请求。
384
390
385
391
<!--
386
392
# # Privilege escalation via workload creation or edits {#privilege-escalation-via-pod-creation}
@@ -391,8 +397,8 @@ such as an operator, could escalate their privileges in that namespace.
391
397
# # 通过创建或编辑工作负载提升权限 {#privilege-escalation-via-pod-creation}
392
398
393
399
能够在名字空间中创建或者编辑 Pod 的用户,
394
- 无论是直接操作还是通过[控制器](/zh/docs/concepts/architecture/controller/)(例如,一个 Operator)来操作,
395
- 都可以提升他们在该名字空间内的权限。
400
+ 无论是直接操作还是通过[控制器](/zh-cn /docs/concepts/architecture/controller/)
401
+ (例如,一个 Operator)来操作, 都可以提升他们在该名字空间内的权限。
396
402
397
403
{{< caution >}}
398
404
<!--
@@ -417,7 +423,8 @@ Details of how these can be misused are documented in [escalation paths](/docs/r
417
423
- Mounting volumes meant for other workloads in that namespace
418
424
- Can be used to obtain information meant for other workloads, and change it.
419
425
-->
420
- # ## 提升途径 {#escalation-paths}
426
+ # ## 特权提升途径 {#escalation-paths}
427
+
421
428
- 挂载该名字空间内的任意 Secret
422
429
- 可以用来访问其他工作负载专用的 Secret
423
430
- 可以用来获取权限更高的服务账号的令牌
@@ -447,9 +454,8 @@ This should be considered when deciding on your RBAC controls.
447
454
* To learn more about Authentication, see **Authentication** in [Controlling Access to the Kubernetes API](/docs/concepts/security/controlling-access/).
448
455
* To learn more about Admission Control, see [Using Admission Controllers](/docs/reference/access-authn-authz/admission-controllers/).
449
456
-->
450
- * 要了解有关身份验证的更多信息,请参阅
451
- [控制对 Kubernetes API 的访问](/zh/docs/concepts/security/controlling-access/)
452
- 中的 **身份验证** 部分。
453
- * 要了解有关准入控制的更多信息,请参阅
454
- [使用准入控制器](/zh/docs/reference/access-authn-authz/admission-controllers/)。
457
+ * 要了解有关身份验证的更多信息,
458
+ 请参阅[控制对 Kubernetes API 的访问](/zh-cn/docs/concepts/security/controlling-access/)中的
459
+ **身份验证** 部分。
460
+ * 要了解有关准入控制的更多信息,请参阅[使用准入控制器](/zh-cn/docs/reference/access-authn-authz/admission-controllers/)。
455
461
0 commit comments