Skip to content

Commit 4a8e86f

Browse files
OPS-6614: pushing local changes for linux headers for ubuntu20
1 parent 6695c0c commit 4a8e86f

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

ubuntu-fips/Dockerfile

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
# Kairos framework packages for ubuntu fips
33
# FROM gcr.io/spectro-images-public/kairos/framework:v2.11.7-fips as kairos-fips
4-
FROM quay.io/kairos/framework:v2.11.7-fips as kairos-fips
4+
FROM quay.io/kairos/framework:v2.11.7-fips AS kairos-fips
55

66
# Base ubuntu image (focal)
7-
FROM ubuntu:focal as base
7+
FROM ubuntu:focal AS base
88

99
# Generate os-release file
10-
FROM quay.io/kairos/osbuilder-tools:v0.200.11 as osbuilder
10+
FROM quay.io/kairos/osbuilder-tools:v0.200.11 AS osbuilder
1111
RUN zypper install -y gettext && zypper clean
1212
RUN mkdir /workspace
1313
COPY --from=base /etc/os-release /workspace/os-release
@@ -38,6 +38,19 @@ RUN --mount=type=secret,id=pro-attach-config \
3838
&& pro attach --attach-config /run/secrets/pro-attach-config \
3939
&& apt-get upgrade -y \
4040
&& apt-get install -y openssl libssl1.1 libssl1.1-hmac libgcrypt20 libgcrypt20-hmac strongswan strongswan-hmac openssh-client openssh-server linux-image-fips \
41+
&& LATEST_VERSION=$(apt-cache search --names-only '^linux-image-[0-9].*-fips$' \
42+
| awk '{print $1}' \
43+
| grep -vE '(azure|aws|gcp)' \
44+
| sort -V \
45+
| tail -n1 \
46+
| sed -E 's/^linux-image-([0-9][^ ]*)-fips$/\1/') && \
47+
apt install -y --no-install-recommends \
48+
"linux-image-${LATEST_VERSION}-fips" \
49+
"linux-modules-${LATEST_VERSION}-fips" \
50+
"linux-headers-${LATEST_VERSION}-fips" && \
51+
apt-mark hold "linux-image-${LATEST_VERSION}-fips" "linux-modules-${LATEST_VERSION}-fips" && \
52+
apt update && apt upgrade -y && \
53+
apt install -y --no-install-recommends linux-headers-virtual \
4154
&& pro detach --assume-yes
4255

4356

@@ -115,6 +128,13 @@ RUN apt-get install -y --no-install-recommends \
115128
&& apt-get remove -y unattended-upgrades && apt-get clean \
116129
&& rm -rf /var/lib/apt/lists/*
117130

131+
RUN fips_kernel=$(basename $(ls /lib/modules | grep -- '-fips$' | sort -V | tail -n1)) && \
132+
echo "Detected FIPS kernel: $fips_kernel" && \
133+
# Remove all other kernel module trees (e.g., -generic)
134+
find /lib/modules -mindepth 1 -maxdepth 1 -type d ! -name "$fips_kernel" -exec rm -rf {} + && \
135+
find /usr/lib/modules -mindepth 1 -maxdepth 1 -type d ! -name "$fips_kernel" -exec rm -rf {} +
136+
137+
118138
# Copy the Kairos framework files. We use master builds here for fedora. See https://quay.io/repository/kairos/framework?tab=tags for a list
119139
COPY --from=kairos-fips / /
120140

ubuntu-fips/build.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)