镜像签名和验证

本页介绍如何使用 Cosign 验证 Istio 镜像工件的来源。

Cosign 是作为 sigstore 项目的一部分开发的工具,它简化了已签名的开放容器计划 (OCI) 工件(如容器镜像)的签名和验证。

从 Istio 1.12 开始,我们在发布流程中对所有正式发布的容器镜像进行签名。最终用户可以使用以下描述的方法来验证这些镜像。

此流程适合手动执行,也可以与构建或部署管道集成,以实现对工件的自动化验证。

先决条件

开始之前,请执行以下操作

  1. 下载适用于您架构的最新 [Cosign](https://github.com/sigstore/cosign/releases/latest) 构建版本及其签名。

  2. 验证 `cosign` 二进制文件的签名

    $ openssl dgst -sha256 \
        -verify <(curl -ssL https://raw.githubusercontent.com/sigstore/cosign/main/release/release-cosign.pub) \
        -signature <(cat /path/to/cosign.sig | base64 -d) \
        /path/to/cosign-binary
    
  3. 使二进制文件可执行(`chmod +x`)并将其移动到 `PATH` 上的某个位置

验证镜像

要验证容器镜像,请执行以下操作

$ ./cosign-binary verify --key "https://istio.ac.cn/misc/istio-key.pub" gcr.io/istio-release/pilot:1.24.0

此流程适用于使用 Istio 构建基础设施构建的任何已发布镜像或发布候选版本。

带有输出的示例

$ cosign verify --key "https://istio.ac.cn/misc/istio-key.pub" gcr.io/istio-release/pilot:1.12.0


Verification for gcr.io/istio-release/pilot:1.12.0 --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - The signatures were verified against the specified public key
  - Any certificates were verified against the Fulcio roots.

[{"critical":{"identity":{"docker-reference":"gcr.io/istio-release/pilot"},"image":{"docker-manifest-digest":"sha256:c37fd83f6435ca0966d653dc6ac42c9fe5ac11d0d5d719dfe97de84acbf7a32d"},"type":"cosign container image signature"},"optional":null}]
这些信息是否有用?
您有什么改进建议吗?

感谢您的反馈!