Azure Lustre CSI 驱动程序对其容器映像进行签名,以便可以验证所使用的映像的完整性和来源。 签名过程使用公钥/私钥对,通过创建数字签名并将其添加到映像中,来证明容器映像是由 Microsoft 构建的。 本文提供了验证映像是否由 Microsoft 签名的步骤。
了解 Kubernetes 系统组件中的映像安全性
在 kube-system 命名空间中部署 Azure Lustre CSI 驱动程序使用的容器映像,Kubernetes 将其视为受信任的系统命名空间。 出于安全性和操作原因,通常不会在系统命名空间上强制实施映像完整性策略,因为:
- 启动要求:CSI 驱动程序等系统组件必须在策略实施系统(如 Gatekeeper 和 Ratify)可用之前启动。
-
受信任的组件:
kube-system中的映像是由受信任的提供程序管理的核心 Kubernetes 基础架构组件。 - 操作稳定性:对策略强制实施组件本身实施策略可能会影响集群正常运行。
但是,在部署之前,仍可以验证 CSI 驱动程序映像的完整性。
预部署映像验证
在部署 Azure Lustre CSI 驱动程序之前,请使用Microsoft的公共签名证书验证容器映像的数字签名和真实性。
使用 Notation CLI 验证映像签名
下载 Notation CLI:
export NOTATION_VERSION=1.3.2 curl -LO https://github.com/notaryproject/notation/releases/download/v$NOTATION_VERSION/notation_$NOTATION_VERSION\_linux_amd64.tar.gz sudo tar xvzf notation_$NOTATION_VERSION\_linux_amd64.tar.gz -C /usr/bin/ notation下载Microsoft签名公共证书:
curl -sSL "https://www.microsoft.com/pkiops/certs/Microsoft%20Supply%20Chain%20RSA%20Root%20CA%202022.crt" -o msft_signing_cert.crt将证书添加到 notation CLI:
notation cert add --type ca --store supplychain msft_signing_cert.crt检查表示法中的证书:
notation cert ls命令的输出如以下示例所示:
STORE TYPE STORE NAME CERTIFICATE ca supplychain msft_signing_cert.crt为 Azure Lustre CSI 驱动程序映像创建 trustpolicy 文件:
创建名为
trustpolicy.json:{ "version": "1.0", "trustPolicies": [ { "name": "supplychain", "registryScopes": [ "*" ], "signatureVerification": { "level" : "strict" }, "trustStores": [ "ca:supplychain" ], "trustedIdentities": [ "x509.subject: CN=Microsoft SCD Products RSA Signing,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US" ] } ] }使用表示法验证 Azure Lustre CSI 驱动程序映像:
notation policy import trustpolicy.json export NOTATION_EXPERIMENTAL=1 # Verify the Jammy image used by Jammy node pods notation verify --allow-referrers-api mcr.microsoft.com/oss/v2/kubernetes-csi/azurelustre-csi:v0.6.0-jammy # Verify the Noble image used by the controller and Noble node pods notation verify --allow-referrers-api mcr.microsoft.com/oss/v2/kubernetes-csi/azurelustre-csi:v0.6.0-noble成功验证的输出如以下示例所示:
Successfully verified signature for mcr.microsoft.com/oss/v2/kubernetes-csi/azurelustre-csi@sha256:a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456
应用程序工作负荷镜像完整性
为了增强生产环境中的安全性,请考虑启用 AKS 映像完整性来自动验证应用程序工作负载的容器映像签名。 虽然策略强制通常排除在 kube-system 命名空间中的 CSI 驱动程序映像,但可以为应用程序命名空间配置映像完整性策略。
若要详细了解如何为应用程序工作负荷实现映像完整性策略,请参阅 Azure Kubernetes 服务(AKS)中的映像完整性。