第 8 章 在断开连接的环境中的 Clair
目前,IBM Power 和 IBM Z 不支持在断开连接的环境中部署 Clair。
Clair 使用一组称为 updaters 的组件来处理从各种漏洞数据库获取和解析数据。默认情况下,更新程序会被设置,以直接从互联网拉取漏洞数据,并立即使用。但是,有些用户可能要求 Red Hat Quay 在断开连接的环境中运行,或者不需要直接访问互联网的环境。Clair 支持断开连接的环境,方法是使用不同类型的更新工作流来考虑网络隔离。这通过使用 clairctl
命令行界面工具来工作,该工具通过使用开放主机从互联网获取更新器数据,从而安全地将数据传送到隔离的主机,然后将隔离主机上的 updater 数据非常重要到 Clair。
使用本指南在断开连接的环境中部署 Clair。
目前,Clairrichment 数据是 CVSS 数据。目前在断开连接的环境中不支持增强数据。
有关 Clair 更新器的更多信息,请参阅 "Clair updaters"。
8.1. 在断开连接的 OpenShift Container Platform 集群中设置 Clair 复制链接链接已复制到粘贴板!
使用以下步骤在断开连接的 OpenShift Container Platform 集群中设置 OpenShift Container Platform 置备的 Clair pod。
使用以下步骤为 OpenShift Container Platform 部署安装 clairctl
CLI 工具。
流程
输入以下命令为 OpenShift Container Platform 集群中的 Clair 部署安装
clairctl
程序:oc -n quay-enterprise exec example-registry-clair-app-64dd48f866-6ptgw -- cat /usr/bin/clairctl > clairctl
$ oc -n quay-enterprise exec example-registry-clair-app-64dd48f866-6ptgw -- cat /usr/bin/clairctl > clairctl
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意不正式,可以下载
clairctl
工具设置
clairctl
文件的权限,以便可由用户执行并运行,例如:chmod u+x ./clairctl
$ chmod u+x ./clairctl
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
使用以下步骤为 OpenShift Container Platform 上置备的 Clair 实例检索和解码配置 secret。
先决条件
-
您已安装了
clairctl
命令行工具工具。
流程
输入以下命令来检索和解码配置 secret,然后将其保存到 Clair 配置 YAML 中:
oc get secret -n quay-enterprise example-registry-clair-config-secret -o "jsonpath={$.data['config\.yaml']}" | base64 -d > clair-config.yaml
$ oc get secret -n quay-enterprise example-registry-clair-config-secret -o "jsonpath={$.data['config\.yaml']}" | base64 -d > clair-config.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 更新
clair-config.yaml
文件,使disable_updaters
和airgap
参数设置为true
,例如:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.1.3. 从连接的 Clair 实例导出更新程序捆绑包 复制链接链接已复制到粘贴板!
使用以下步骤从可访问互联网的 Clair 实例导出更新程序捆绑包。
先决条件
-
您已安装了
clairctl
命令行工具工具。 -
您已检索并解码 Clair 配置 secret,并将其保存到 Clair
config.yaml
文件中。 -
在 Clair
config.yaml
文件中,disable_updaters
和airgap
参数设置为true
。
流程
从可访问互联网的 Clair 实例中,将
clairctl
CLI 工具与您的配置文件一起使用,以导出更新程序捆绑包。例如:./clairctl --config ./config.yaml export-updaters updates.gz
$ ./clairctl --config ./config.yaml export-updaters updates.gz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
使用以下步骤配置对断开连接的 OpenShift Container Platform 集群中的 Clair 数据库的访问。
先决条件
-
您已安装了
clairctl
命令行工具工具。 -
您已检索并解码 Clair 配置 secret,并将其保存到 Clair
config.yaml
文件中。 -
在 Clair
config.yaml
文件中,disable_updaters
和airgap
参数设置为true
。 - 您已从可访问互联网的 Clair 实例导出了更新程序捆绑包。
流程
使用
oc
CLI 工具确定您的 Clair 数据库服务,例如:oc get svc -n quay-enterprise
$ oc get svc -n quay-enterprise
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE example-registry-clair-app ClusterIP 172.30.224.93 <none> 80/TCP,8089/TCP 4d21h example-registry-clair-postgres ClusterIP 172.30.246.88 <none> 5432/TCP 4d21h ...
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE example-registry-clair-app ClusterIP 172.30.224.93 <none> 80/TCP,8089/TCP 4d21h example-registry-clair-postgres ClusterIP 172.30.246.88 <none> 5432/TCP 4d21h ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 转发 Clair 数据库端口,使其可以从本地机器访问。例如:
oc port-forward -n quay-enterprise service/example-registry-clair-postgres 5432:5432
$ oc port-forward -n quay-enterprise service/example-registry-clair-postgres 5432:5432
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 更新 Clair
config.yaml
文件,例如:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.1.5. 将更新程序捆绑包导入到断开连接的 OpenShift Container Platform 集群中 复制链接链接已复制到粘贴板!
使用以下步骤将更新程序捆绑包导入到断开连接的 OpenShift Container Platform 集群中。
先决条件
-
您已安装了
clairctl
命令行工具工具。 -
您已检索并解码 Clair 配置 secret,并将其保存到 Clair
config.yaml
文件中。 -
在 Clair
config.yaml
文件中,disable_updaters
和airgap
参数设置为true
。 - 您已从可访问互联网的 Clair 实例导出了更新程序捆绑包。
- 您已将更新程序捆绑包传送到断开连接的环境中。
流程
使用
clairctl
CLI 工具将更新程序捆绑包导入到 OpenShift Container Platform 部署的 Clair 数据库中。例如:./clairctl --config ./clair-config.yaml import-updaters updates.gz
$ ./clairctl --config ./clair-config.yaml import-updaters updates.gz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow