Skip to content

Commit ece6fd9

Browse files
committed
[zh-cn] administer-cluster/verify-signed-artifacts.md
Signed-off-by: xin.li <[email protected]>
1 parent 0d22a1c commit ece6fd9

File tree

1 file changed

+58
-46
lines changed

1 file changed

+58
-46
lines changed

content/zh-cn/docs/tasks/administer-cluster/verify-signed-artifacts.md

Lines changed: 58 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,18 @@ weight: 420
1818
## {{% heading "prerequisites" %}}
1919

2020
<!--
21-
These instructions are for Kubernetes {{< skew currentVersion >}}. If you want
22-
to check the integrity of components for a different version of Kubernetes,
23-
check the documentation for that Kubernetes release.
24-
2521
You will need to have the following tools installed:
2622
2723
- `cosign` ([install guide](https://docs.sigstore.dev/cosign/installation/))
2824
- `curl` (often provided by your operating system)
25+
- `jq` ([download jq](https://stedolan.github.io/jq/download/))
2926
-->
30-
这些说明适用于 Kubernetes {{< skew currentVersion >}}。
31-
如果你想要检查其他版本的 Kubernetes 组件的完整性,请查看对应 Kubernetes 版本的文档。
32-
3327
你需要安装以下工具:
3428

3529
- `cosign`[安装指南](https://docs.sigstore.dev/cosign/installation/)
3630
- `curl`(通常由你的操作系统提供)
31+
- `jq`[下载 jq](https://stedlan.github.io/jq/download/)
32+
3733

3834
<!--
3935
## Verifying binary signatures
@@ -45,8 +41,9 @@ binary, retrieve it together with its signature and certificate:
4541

4642
## 验证二进制签名 {#verifying-binary-signatures}
4743

48-
Kubernetes 发布过程使用 cosign 的无密钥签名对所有二进制工件(压缩包、SPDX 文件、 独立的二进制文件)签名。
49-
要验证一个特定的二进制文件,获取组件时要包含其签名和证书:
44+
Kubernetes 发布过程使用 cosign 的无密钥签名对所有二进制工件(压缩包、
45+
SPDX 文件、 独立的二进制文件)签名。要验证一个特定的二进制文件,
46+
获取组件时要包含其签名和证书:
5047

5148
```bash
5249
URL=https://dl.k8s.io/release/v{{< skew currentPatchVersion >}}/bin/linux/amd64
@@ -64,26 +61,37 @@ done
6461
```
6562

6663
<!--
67-
Then verify the blob by using `cosign`:
68-
69-
cosign v1.9.0 is required to be able to use the `--certificate` flag. Please use
70-
`--cert` for older versions of cosign.
64+
Then verify the blob by using `cosign verify-blob`:
7165
-->
72-
然后使用 `cosign` 验证二进制文件:
66+
然后使用 `cosign verify-blob` 验证二进制文件:
7367

7468
```shell
75-
cosign verify-blob "$BINARY" --signature "$BINARY".sig --certificate "$BINARY".cert
69+
cosign verify-blob "$BINARY" \
70+
--signature "$BINARY".sig \
71+
--certificate "$BINARY".cert \
72+
--certificate-identity [email protected] \
73+
--certificate-oidc-issuer https://accounts.google.com
7674
```
7775

78-
cosign 自 v1.9.0 版本开始才能使用 `--certificate` 标志,旧版本的 cosign 请使用 `--cert`
79-
8076
{{< note >}}
8177
<!--
82-
To learn more about keyless signing, please refer to [Keyless
83-
Signatures](https://github.com/sigstore/cosign/blob/main/KEYLESS.md#keyless-signatures).
78+
Cosign 2.0 requires the `--certificate-identity` and `--certificate-oidc-issuer` options.
79+
80+
To learn more about keyless signing, please refer to [Keyless Signatures](https://docs.sigstore.dev/cosign/keyless).
81+
82+
Previous versions of Cosign required that you set `COSIGN_EXPERIMENTAL=1`.
83+
84+
For additional information, plase refer to the [sigstore Blog](https://blog.sigstore.dev/cosign-2-0-released/)
8485
-->
86+
Cosign 2.0 需要指定 `--certificate-identity``--certificate-oidc-issuer` 选项。
87+
8588
想要进一步了解无密钥签名,请参考
8689
[Keyless Signatures](https://github.com/sigstore/cosign/blob/main/KEYLESS.md#keyless-signatures)
90+
91+
Cosign 的早期版本还需要设置 `COSIGN_EXPERIMENTAL=1`
92+
93+
如需更多信息,请参考
94+
[sigstore Blog](https://blog.sigstore.dev/cosign-2-0-released/)
8795
{{< /note >}}
8896

8997
<!--
@@ -92,7 +100,7 @@ Signatures](https://github.com/sigstore/cosign/blob/main/KEYLESS.md#keyless-sign
92100
For a complete list of images that are signed please refer
93101
to [Releases](/releases/download/).
94102
95-
Let's pick one image from this list and verify its signature using
103+
Pick one image from this list and verify its signature using
96104
the `cosign verify` command:
97105
-->
98106
## 验证镜像签名 {#verifying-image-signatures}
@@ -102,60 +110,64 @@ the `cosign verify` command:
102110
从这个列表中选择一个镜像,并使用 `cosign verify` 命令来验证它的签名:
103111

104112
```shell
105-
COSIGN_EXPERIMENTAL=1 cosign verify registry.k8s.io/kube-apiserver-amd64:v{{< skew currentPatchVersion >}}
113+
cosign verify registry.k8s.io/kube-apiserver-amd64:v{{< skew currentPatchVersion >}} \
114+
--certificate-identity [email protected] \
115+
--certificate-oidc-issuer https://accounts.google.com \
116+
| jq .
106117
```
107118

108-
{{< note >}}
109-
<!--
110-
`COSIGN_EXPERIMENTAL=1` is used to allow verification of images signed
111-
in `KEYLESS` mode. To learn more about keyless signing, please refer to
112-
[Keyless Signatures](https://github.com/sigstore/cosign/blob/main/KEYLESS.md#keyless-signatures).
113-
-->
114-
`COSIGN_EXPERIMENTAL=1` 用于对以 `KEYLESS` 模式签名的镜像进行验证。想要进一步了解 `KEYLESS`,请参考
115-
[Keyless Signatures](https://github.com/sigstore/cosign/blob/main/KEYLESS.md#keyless-signatures)
116-
{{< /note >}}
117-
118119
<!--
119120
### Verifying images for all control plane components
120121
121-
To verify all signed control plane images, please run this command:
122+
To verify all signed control plane images for the latest stable version
123+
(v{{< skew currentPatchVersion >}}), please run the following commands:
122124
-->
123125
### 验证所有控制平面组件镜像 {#verifying-images-for-all-control-plane-components}
124126

125-
验证所有已签名的控制平面组件镜像,请运行以下命令:
127+
验证最新稳定版(v{{< skew currentPatchVersion >}})所有已签名的控制平面组件镜像,
128+
请运行以下命令:
126129

127130
```shell
128-
curl -Ls "https://sbom.k8s.io/$(curl -Ls https://dl.k8s.io/release/stable.txt)/release" | grep "SPDXID: SPDXRef-Package-registry.k8s.io" | grep -v sha256 | cut -d- -f3- | sed 's/-/\//' | sed 's/-v1/:v1/' > images.txt
131+
curl -Ls "https://sbom.k8s.io/$(curl -Ls https://dl.k8s.io/release/stable.txt)/release" \
132+
| grep "SPDXID: SPDXRef-Package-registry.k8s.io" \
133+
| grep -v sha256 | cut -d- -f3- | sed 's/-/\//' | sed 's/-v1/:v1/' \
134+
| sort > images.txt
129135
input=images.txt
130136
while IFS= read -r image
131137
do
132-
COSIGN_EXPERIMENTAL=1 cosign verify "$image"
138+
cosign verify "$image" \
139+
--certificate-identity [email protected] \
140+
--certificate-oidc-issuer https://accounts.google.com \
141+
| jq .
133142
done < "$input"
134143
```
135144

136145
<!--
137-
Once you have verified an image, specify that image by its digest in your Pod
138-
manifests as per this
139-
example: `registry-url/image-name@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2`.
146+
Once you have verified an image, you can specify that image by its digest in your Pod
147+
manifests as per this example:
140148
141149
For more information, please refer
142-
to [Image Pull Policy](/docs/concepts/containers/images/#image-pull-policy)
150+
to the [Image Pull Policy](/docs/concepts/containers/images/#image-pull-policy)
143151
section.
144152
-->
145153
当你完成某个镜像的验证时,可以在你的 Pod 清单通过摘要值来指定该镜像,例如:
146-
`registry-url/image-name@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2`
154+
155+
```console
156+
registry-url/image-name@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
157+
```
147158

148159
要了解更多信息,请参考[镜像拉取策略](/zh-cn/docs/concepts/containers/images/#image-pull-policy)章节。
149160

150161
<!--
151162
## Verifying Image Signatures with Admission Controller
152163
153-
For non-control plane images (
154-
e.g. [conformance image](https://github.com/kubernetes/kubernetes/blob/master/test/conformance/image/README.md))
155-
, signatures can also be verified at deploy time using
164+
For non-control plane images (for example
165+
[conformance image](https://github.com/kubernetes/kubernetes/blob/master/test/conformance/image/README.md)),
166+
signatures can also be verified at deploy time using
156167
[sigstore policy-controller](https://docs.sigstore.dev/policy-controller/overview)
157-
admission controller. To get started with `policy-controller` here are a few helpful
158-
resources:
168+
admission controller.
169+
170+
Here are some helpful resources to get started with `policy-controller`:
159171
160172
* [Installation](https://github.com/sigstore/helm-charts/tree/main/charts/policy-controller)
161173
* [Configuration Options](https://github.com/sigstore/policy-controller/tree/main/config)
@@ -166,7 +178,7 @@ resources:
166178
(例如 [conformance 镜像](https://github.com/kubernetes/kubernetes/blob/master/test/conformance/image/README.md)),
167179
也可以在部署时使用
168180
[sigstore policy-controller](https://docs.sigstore.dev/policy-controller/overview)
169-
控制器验证其签名。如要使用 `policy-controller`,下面是一些有帮助的资源
181+
控制器验证其签名。以下是一些有助于你开始使用 `policy-controller` 的资源
170182

171183
- [安装](https://github.com/sigstore/helm-charts/tree/main/charts/policy-controller)
172184
- [配置选项](https://github.com/sigstore/policy-controller/tree/main/config)

0 commit comments

Comments
 (0)