Skip to content

Commit 3de9aad

Browse files
authored
Merge pull request #25293 from tengqm/zh-auth-2
[zh] Sync English site changes for authentication ref
2 parents 4939fe5 + b8c9b2f commit 3de9aad

File tree

4 files changed

+701
-308
lines changed

4 files changed

+701
-308
lines changed

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

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ for more details about this.
6666
使用证书中的 'subject' 的通用名称(Common Name)字段(例如,"/CN=bob")来
6767
确定用户名。接下来,基于角色访问控制(RBAC)子系统会确定用户是否有权针对
6868
某资源执行特定的操作。进一步的细节可参阅
69-
[证书请求](/docs/reference/access-authn-authz/certificate-signing-requests/#normal-user)
69+
[证书请求](/zh/docs/reference/access-authn-authz/certificate-signing-requests/#normal-user)
7070
下普通用户主题。
7171

7272
<!--
@@ -182,7 +182,7 @@ For example, using the `openssl` command line tool to generate a certificate sig
182182

183183
例如,使用 `openssl` 命令行工具生成一个证书签名请求:
184184

185-
``` bash
185+
```bash
186186
openssl req -new -key jbeda.pem -out jbeda-csr.pem -subj "/CN=jbeda/O=app1/O=app2"
187187
```
188188

@@ -321,54 +321,15 @@ how to manage these tokens with `kubeadm`.
321321
以了解关于启动引导令牌身份认证组件与控制器的更深入的信息,以及如何使用
322322
`kubeadm` 来管理这些令牌。
323323

324-
<!--
325-
### Static Password File
326-
327-
Basic authentication is enabled by passing the `-basic-auth-file=SOMEFILE`
328-
option to API server. Currently, the basic auth credentials last indefinitely,
329-
and the password cannot be changed without restarting API server. Note that basic
330-
authentication is currently supported for convenience while we finish making the
331-
more secure modes described above easier to use.
332-
-->
333-
### Static Password File
334-
335-
通过向 API 服务器传递 `--basic-auth-file=SOMEFILE` 选项可以启用基本的
336-
身份认证。目前,基本身份认证所涉及的凭据信息会长期有效,并且在不重启 API
337-
服务器的情况下无法改变用户的密码。
338-
要注意的是,对基本身份认证的支持目前仅是出于方便性考虑。
339-
与此同时我们正在增强前述的、更为安全的模式的易用性。
340-
341-
<!--
342-
The basic auth file is a csv file with a minimum of 3 columns: password, user name, user id.
343-
In Kubernetes version 1.6 and later, you can specify an optional fourth column containing
344-
comma-separated group names. If you have more than one group, you must enclose the fourth
345-
column value in double quotes ("). See the following example:
346-
-->
347-
基本身份认证数据文件是一个 CSV 文件,包含至少 3 列:密码、用户名和用户 ID。
348-
在 Kuernetes 1.6 及后续版本中,你可以指定一个可选的第 4 列,在其中给出用逗号
349-
分隔的用户组名。如果用户组名不止一个,你必须将第 4 列的值用双引号括起来。
350-
参见下面的例子:
351-
352-
```conf
353-
password,user,uid,"group1,group2,group3"
354-
```
355-
356-
<!--
357-
When using basic authentication from an http client, the API server expects an `Authorization` header
358-
with a value of `Basic BASE64ENCODED(USER:PASSWORD)`.
359-
-->
360-
当在 HTTP 客户端使用基本身份认证机制时,API 服务器会期望看到名为
361-
`Authorization` 的 HTTP 头部,其值形如 `Basic USER:PASSWORD的Base64编码字符串`
362-
363324
<!--
364325
### Service Account Tokens
365326
366327
A service account is an automatically enabled authenticator that uses signed
367328
bearer tokens to verify requests. The plugin takes two optional flags:
368329
369-
* `-service-account-key-file` A file containing a PEM encoded key for signing bearer tokens.
330+
* `--service-account-key-file` A file containing a PEM encoded key for signing bearer tokens.
370331
If unspecified, the API server's TLS private key will be used.
371-
* `-service-account-lookup` If enabled, tokens which are deleted from the API will be revoked.
332+
* `--service-account-lookup` If enabled, tokens which are deleted from the API will be revoked.
372333
-->
373334
### 服务账号令牌 {#service-account-tokens}
374335

@@ -555,7 +516,33 @@ is included in a request.
555516
中的 `id_token`(而非 `access_token`)作为持有者令牌。
556517
关于如何在请求中设置令牌,可参见[前文](#putting-a-bearer-token-in-a-request)。
557518

558-
![Kubernetes OpenID Connect Flow](/images/docs/admin/k8s_oidc_login.svg)
519+
{{< mermaid >}}
520+
sequenceDiagram
521+
participant user as 用户
522+
participant idp as 身份提供者
523+
participant kube as Kubectl
524+
participant api as API 服务器
525+
526+
user ->> idp: 1. 登录到 IdP
527+
activate idp
528+
idp -->> user: 2. 提供 access_token,<br>id_token, 和 refresh_token
529+
deactivate idp
530+
activate user
531+
user ->> kube: 3. 调用 Kubectl 并<br>设置 --token 为 id_token<br>或者将令牌添加到 .kube/config
532+
deactivate user
533+
activate kube
534+
kube ->> api: 4. Authorization: Bearer...
535+
deactivate kube
536+
activate api
537+
api ->> api: 5. JWT 签名合法么?
538+
api ->> api: 6. JWT 是否已过期?(iat+exp)
539+
api ->> api: 7. 用户被授权了么?
540+
api -->> kube: 8. 已授权:执行<br>操作并返回结果
541+
deactivate api
542+
activate kube
543+
kube --x user: 9. 返回结果
544+
deactivate kube
545+
{{< /mermaid >}}
559546

560547
<!--
561548
1. Login to your identity provider
@@ -683,16 +670,19 @@ For an identity provider to work with Kubernetes it must:
683670
3. 拥有由 CA 签名的证书(即使 CA 不是商业 CA 或者是自签名的 CA 也可以)
684671

685672
<!--
686-
A note about requirement #3 above, requiring a CA signed certificate. If you deploy your own identity provider (as opposed to one of the cloud providers like Google or Microsoft) you MUST have your identity provider's web server certificate signed by a certificate with the `CA` flag set to `TRUE`, even if it is self signed. This is due to GoLang's TLS client implementation being very strict to the standards around certificate validation. If you don't have a CA handy, you can use [this script](https://github.com/coreos/dex/blob/1ee5920c54f5926d6468d2607c728b71cfe98092/examples/k8s/gencert.sh) from the CoreOS team to create a simple CA and a signed certificate and key pair.
673+
A note about requirement #3 above, requiring a CA signed certificate. If you deploy your own identity provider (as opposed to one of the cloud providers like Google or Microsoft) you MUST have your identity provider's web server certificate signed by a certificate with the `CA` flag set to `TRUE`, even if it is self signed. This is due to GoLang's TLS client implementation being very strict to the standards around certificate validation. If you don't have a CA handy, you can use [this script](https://github.com/dexidp/dex/blob/master/examples/k8s/gencert.sh) from the Dex team to create a simple CA and a signed certificate and key pair.
687674
Or you can use [this similar script](https://raw.githubusercontent.com/TremoloSecurity/openunison-qs-kubernetes/master/src/main/bash/makessl.sh) that generates SHA256 certs with a longer life and larger key size.
688675
-->
689676
关于上述第三条需求,即要求具备 CA 签名的证书,有一些额外的注意事项。
690677
如果你部署了自己的身份服务,而不是使用云厂商(如 Google 或 Microsoft)所提供的服务,
691678
你必须对身份服务的 Web 服务器证书进行签名,签名所用证书的 `CA` 标志要设置为
692679
`TRUE`,即使用的是自签名证书。这是因为 GoLang 的 TLS 客户端实现对证书验证
693680
标准方面有非常严格的要求。如果你手头没有现成的 CA 证书,可以使用 CoreOS
694-
团队所开发的[这个脚本](https://github.com/coreos/dex/blob/1ee5920c54f5926d6468d2607c728b71cfe98092/examples/k8s/gencert.sh)来创建一个简单的 CA 和被签了名的证书与密钥对。
695-
或者你也可以使用[这个类似的脚本](https://raw.githubusercontent.com/TremoloSecurity/openunison-qs-kubernetes/master/src/main/bash/makessl.sh),生成一个合法期更长、密钥尺寸更大的 SHA256 证书。
681+
团队所开发的[这个脚本](https://github.com/dexidp/dex/blob/master/examples/k8s/gencert.sh)
682+
来创建一个简单的 CA 和被签了名的证书与密钥对。
683+
或者你也可以使用
684+
[这个类似的脚本](https://raw.githubusercontent.com/TremoloSecurity/openunison-qs-kubernetes/master/src/main/bash/makessl.sh),
685+
生成一个合法期更长、密钥尺寸更大的 SHA256 证书。
696686

697687
<!--
698688
Setup instructions for specific systems:

0 commit comments

Comments
 (0)