Red Hat Training
A Red Hat training course is available for OpenShift Container Platform
3.9.4. 启用镜像签名支持
OpenShift Container Platform 能够检查镜像是否来自可信源。容器安全指南介绍了相关内容。
您可以使用 atomic
命令行界面(CLI)版本 1.12.5 或更高版本来配置镜像签名验证。在 RHEL Atomic Host 系统中预先安装 atomic
CLI。
注意
如需有关 atomic
CLI 的更多信息,请参阅 Atomic CLI 文档。
以下文件和目录组成主机的信任配置:
- /etc/containers/registries.d/*
- /etc/containers/policy.json
您可以直接管理每个节点上的信任配置,或者管理独立主机上的文件,或使用 Ansible 将这些文件分发到适当的节点。有关使用 Ansible 自动分发文件的实例,请参阅容器镜像签名集成指南。
如果还没有安装,在主机系统中安装 atomic 软件包:
$ yum install atomic
查看当前的信任配置:
$ atomic trust show * (default) accept
默认配置是将所有 registry 列入白名单,这代表没有配置签名验证。
自定义信任配置。在以下示例中,将一个 registry 或命名空间列入白名单,将不信任的 registry 列入黑名单(reject),这代表需要在供应商的 registry 中进行签名验证:
$ atomic trust add --type insecureAcceptAnything 172.30.1.1:5000 $ atomic trust add --sigstoretype atomic \ --pubkeys pub@example.com \ 172.30.1.1:5000/production $ atomic trust add --sigstoretype atomic \ --pubkeys /etc/pki/example.com.pub \ 172.30.1.1:5000/production $ atomic trust add --sigstoretype web \ --sigstore https://access.redhat.com/webassets/docker/content/sigstore \ --pubkeys /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release \ registry.redhat.io # atomic trust show * (default) accept 172.30.1.1:5000 accept 172.30.1.1:5000/production signed security@example.com registry.redhat.io signed security@redhat.com,security@redhat.com
您可以通过添加全局
reject(拒绝)
默认信任来进一步强化节点:$ atomic trust default reject $ atomic trust show * (default) reject 172.30.1.1:5000 accept 172.30.1.1:5000/production signed security@example.com registry.redhat.io signed security@redhat.com,security@redhat.com
-
(可选)查看
atomic
man pageman atomic-trust
来获得更多配置选项。