Skip to content

Commit c5641a0

Browse files
authored
Merge pull request #74 from slagle/bootc-fips
Conditionally enable fips in bootc image
2 parents a84a408 + fdaa403 commit c5641a0

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

bootc/01-fips.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Enable FIPS
2+
kargs = ["fips=1"]

bootc/Containerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,18 @@ RUN /var/tmp/rhsm-script.sh && \
141141
(subscription-manager unregister || true) && \
142142
systemctl enable $ENABLE_UNITS
143143

144+
145+
# Configure FIPS
146+
ARG FIPS=1
147+
RUN if [ "${FIPS}" = "1" ] ; \
148+
then \
149+
# Enable the FIPS crypto policy
150+
update-crypto-policies --no-reload --set FIPS ; \
151+
touch /etc/system-fips ; \
152+
mkdir -p /usr/lib/bootc/kargs.d ; \
153+
echo -e "# Enable FIPS\nkargs = [\"fips=1\"]\n" > /usr/lib/bootc/kargs.d/01-fips.toml ; \
154+
fi
155+
144156
# Drop Ansible fact into place
145157
COPY ansible-facts/bootc.fact /etc/ansible/facts.d/bootc.fact
146158
RUN chmod +x /etc/ansible/facts.d/bootc.fact

bootc/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ EDPM_QCOW2_IMAGE ?= ${EDPM_BOOTC_REPO}:${EDPM_BOOTC_TAG}-qcow2
88
BUILDER_IMAGE ?= quay.io/centos-bootc/bootc-image-builder:latest
99
HOST_PACKAGES ?= podman osbuild-selinux https://download.devel.redhat.com/rcm-guest/puddles/OpenStack/rhos-release/rhos-release-latest.noarch.rpm
1010
RHSM_SCRIPT ?= empty.sh
11+
FIPS ?= 1
1112

1213
.ONESHELL:
1314

@@ -33,6 +34,7 @@ build: output/yum.repos.d
3334
sudo buildah bud \
3435
--build-arg EDPM_BASE_IMAGE=${EDPM_BASE_IMAGE} \
3536
--build-arg RHSM_SCRIPT=${RHSM_SCRIPT} \
37+
--build-arg FIPS=${FIPS} \
3638
--volume /etc/pki/ca-trust:/etc/pki/ca-trust:ro,Z \
3739
--volume $(shell pwd)/output/yum.repos.d:/etc/yum.repos.d:rw,Z \
3840
-f ${EDPM_CONTAINERFILE} \

0 commit comments

Comments
 (0)