Skip to content

Commit be79149

Browse files
authored
Merge pull request #33702 from my-git9/mygit19
[zh] adjust abac.md
2 parents 02599fa + 42596d7 commit be79149

File tree

1 file changed

+12
-17
lines changed
  • content/zh/docs/reference/access-authn-authz

1 file changed

+12
-17
lines changed

content/zh/docs/reference/access-authn-authz/abac.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ content_type: concept
99
---
1010

1111
<!--
12-
---
1312
reviewers:
1413
- erictune
1514
- lavalamp
@@ -18,15 +17,15 @@ reviewers:
1817
title: Using ABAC Authorization
1918
content_type: concept
2019
weight: 80
21-
---
2220
-->
2321

2422
<!-- overview -->
2523

2624
<!--
2725
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.
2826
-->
29-
基于属性的访问控制(Attribute-based access control - ABAC)定义了访问控制范例,其中通过使用将属性组合在一起的策略来向用户授予访问权限。
27+
基于属性的访问控制(Attribute-based access control - ABAC)定义了访问控制范例,
28+
其中通过使用将属性组合在一起的策略来向用户授予访问权限。
3029

3130

3231

@@ -68,7 +67,6 @@ properties:
6867
- `/foo/*` matches all subpaths of `/foo/`.
6968
- `readonly`, type boolean, when true, means that the Resource-matching policy only applies to get, list, and watch operations, Non-resource-matching policy only applies to get operation.
7069
-->
71-
7270
## 策略文件格式
7371

7472
基于 `ABAC` 模式,可以这样指定策略文件 `--authorization-policy-file=SOME_FILENAME`
@@ -83,7 +81,8 @@ properties:
8381
- `spec` 配置为具有以下映射的属性:
8482
- 主体匹配属性:
8583
- `user`,字符串类型;来自 `--token-auth-file` 的用户字符串,如果你指定 `user`,它必须与验证用户的用户名匹配。
86-
- `group`,字符串类型;如果指定 `group`,它必须与经过身份验证的用户的一个组匹配,`system:authenticated`匹配所有经过身份验证的请求。`system:unauthenticated`匹配所有未经过身份验证的请求。
84+
- `group`,字符串类型;如果指定 `group`,它必须与经过身份验证的用户的一个组匹配,`system:authenticated` 匹配所有经过身份验证的请求。
85+
`system:unauthenticated` 匹配所有未经过身份验证的请求。
8786
- 资源匹配属性:
8887
- `apiGroup`,字符串类型;一个 API 组。
8988
- 例: `apps`, `networking.k8s.io`
@@ -154,10 +153,7 @@ resource, and nonResourcePath properties set to `"*"`.
154153

155154
要允许任何经过身份验证的用户执行某些操作,请将策略组属性设置为 `"system:authenticated"`
156155

157-
要允许任何未经身份验证的用户执行某些操作,请将策略组属性设置为 `"system:authentication"`
158-
159-
要允许用户执行任何操作,请使用 apiGroup,命名空间,
160-
资源和 nonResourcePath 属性设置为 `"*"` 的策略。
156+
要允许任何未经身份验证的用户执行某些操作,请将策略组属性设置为 `"system:unauthenticated"`
161157

162158
要允许用户执行任何操作,请使用设置为 `"*"` 的 apiGroup,namespace,resource 和 nonResourcePath 属性编写策略。
163159

@@ -181,17 +177,18 @@ up the verbosity:
181177
kubectl --v=8 version
182178
-->
183179

184-
## Kubectl
180+
## kubectl
185181

186-
Kubectl 使用 api-server 的 `/api``/apis` 端点来发现服务资源类型,并使用位于 `/openapi/v2` 的模式信息来验证通过创建/更新操作发送到 API 的对象。
182+
kubectl 使用 api-server 的 `/api``/apis` 端点来发现服务资源类型,
183+
并使用位于 `/openapi/v2` 的模式信息来验证通过创建/更新操作发送到 API 的对象。
187184

188185
当使用 ABAC 鉴权时,这些特殊资源必须显式地通过策略中的 `nonResourcePath` 属性暴露出来(参见下面的 [示例](#examples)):
189186

190187
* `/api``/api/*``/apis``/apis/*` 用于 API 版本协商。
191188
* `/version` 通过 `kubectl version` 检索服务器版本。
192189
* `/swaggerapi/*` 用于创建 / 更新操作。
193190

194-
要检查涉及到特定 kubectl 操作的 HTTP 调用,您可以调整详细程度
191+
要检查涉及到特定 kubectl 操作的 HTTP 调用,你可以调整详细程度
195192
kubectl --v=8 version
196193

197194
<!--
@@ -213,20 +210,19 @@ Kubectl 使用 api-server 的 `/api` 和 `/apis` 端点来发现服务资源类
213210
{"apiVersion": "abac.authorization.kubernetes.io/v1beta1", "kind": "Policy", "spec": {"user": "kubelet", "namespace": "*", "resource": "events"}}
214211
```
215212
-->
216-
217213
## 例子 {#examples}
218214

219215
1. Alice 可以对所有资源做任何事情:
220216

221217
```json
222218
{"apiVersion": "abac.authorization.kubernetes.io/v1beta1", "kind": "Policy", "spec": {"user": "alice", "namespace": "*", "resource": "*", "apiGroup": "*"}}
223219
```
224-
2. Kubelet 可以读取任何 pod:
220+
2. kubelet 可以读取任何 pod:
225221

226222
```json
227223
{"apiVersion": "abac.authorization.kubernetes.io/v1beta1", "kind": "Policy", "spec": {"user": "kubelet", "namespace": "*", "resource": "pods", "readonly": true}}
228224
```
229-
3. Kubelet 可以读写事件:
225+
3. kubelet 可以读写事件:
230226

231227
```json
232228
{"apiVersion": "abac.authorization.kubernetes.io/v1beta1", "kind": "Policy", "spec": {"user": "kubelet", "namespace": "*", "resource": "events"}}
@@ -245,8 +241,8 @@ Kubectl 使用 api-server 的 `/api` 和 `/apis` 端点来发现服务资源类
245241
{"apiVersion": "abac.authorization.kubernetes.io/v1beta1", "kind": "Policy", "spec": {"group": "system:unauthenticated", "readonly": true, "nonResourcePath": "*"}}
246242
```
247243
-->
248-
249244
4. Bob 可以在命名空间 `projectCaribou` 中读取 pod:
245+
250246
```json
251247
{"apiVersion": "abac.authorization.kubernetes.io/v1beta1", "kind": "Policy", "spec": {"user": "bob", "namespace": "projectCaribou", "resource": "pods", "readonly": true}}
252248
```
@@ -269,7 +265,6 @@ system:serviceaccount:<namespace>:<serviceaccountname>
269265
```
270266

271267
-->
272-
273268
[完整文件示例](https://releases.k8s.io/{{< param "fullversion" >}}/pkg/auth/authorizer/abac/example_policy_file.jsonl)
274269

275270
## 服务帐户的快速说明

0 commit comments

Comments
 (0)