第 7 章 在构建 bootc 镜像时启用 FIPS 模式
FIPS 包括加密操作的标准。您可以在 bootc 镜像构建期间启用 FIPS 模式,在构建 bootc 镜像时启用 FIPS 模式,以将系统配置为只使用 FIPS 批准的模块。启用 FIPS 模式有两个选项:
-
使用
bootc-image-builder工具: 您必须将 FIPS 加密策略启用到 Containerfile 中。 -
当执行 Anaconda 安装时:除了在 Containerfile 中启用 FIPS 加密策略外,还必须在引导时添加
fips=1内核参数。
FIPS dracut 模块内置了基础镜像。默认为 boot=UUID= karg in bootc install-to-filesystem。
7.1. 使用 bootc-image-builder 启用 FIPS 模式 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
使用 bootc-image-builder 或 bootc install to-disk 创建磁盘镜像,并通过在构建镜像时将自定义 Containerfile 作为参数传递来启用 FIPS 模式。
先决条件
- 您已在主机机器上安装了 Podman。
-
您已在主机机器上安装了
virt-install。 -
您有运行
bootc-image-builder工具的 root 访问权限,并在--privileged模式下运行容器,以构建镜像。
流程
创建一个
01-fips.toml来配置 FIPS 启用,例如:# Enable FIPS kargs = ["fips=1"]使用以下说明创建 Containerfile,以启用
fips=1内核参数:FROM registry.redhat.io/rhel9/rhel-bootc:latest # Enable fips=1 kernel argument: https://containers.github.io/bootc/building/kernel-arguments.html COPY 01-fips.toml /usr/lib/bootc/kargs.d/ # Enable the FIPS crypto policy # crypto-policies-scripts is not installed by default in RHEL-10 RUN dnf install -y crypto-policies-scripts && update-crypto-policies --no-reload --set FIPS使用当前目录中的
Containerfile创建 bootc<image> 兼容基本磁盘镜像:$ podman build -t quay.io/<namespace>/<image>:<tag> .
验证
登录到系统后,检查是否启用了 FIPS 模式:
$ *fips-mode-setup --check* FIPS mode is enabled.