Blame SOURCES/0558-fips-ensure-fs-module-for-boot-is-installed.patch

18971c
From c6ccef8827af134884c5b2c785e07eb0b144450b Mon Sep 17 00:00:00 2001
18971c
From: Kairui Song <kasong@redhat.com>
18971c
Date: Thu, 14 Mar 2019 18:54:10 +0800
18971c
Subject: [PATCH] fips: ensure fs module for /boot is installed
18971c
18971c
When using dracut with  --hostonly and --no-hostonly-default-device,
18971c
/boot will be inaccessible as dracut will most fs modules unless
18971c
specified. But FIPS require /boot to be accessible, and it will try
18971c
to mount it on boot. It will fail if corresponding fs module is missing.
18971c
18971c
For most case /boot will be a simple partition, include the fs module
18971c
will be enough for FIPS to mount it. For other cases users have to pass
18971c
extra parameters by themselves.
18971c
18971c
Suggested-by: Kenneth Dsouza <kdsouza@redhat.com>
18971c
Signed-off-by: Kairui Song <kasong@redhat.com>
18971c
18971c
Cherry-picked from: 8365177644bee107dcb66a71c8a7509900c9ece4
18971c
Resolves: #1672817
18971c
---
18971c
 modules.d/01fips/module-setup.sh | 12 +++++++++++-
18971c
 1 file changed, 11 insertions(+), 1 deletion(-)
18971c
18971c
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
18971c
index 242d4dd9..834e7d7d 100755
18971c
--- a/modules.d/01fips/module-setup.sh
18971c
+++ b/modules.d/01fips/module-setup.sh
18971c
@@ -11,7 +11,7 @@ depends() {
18971c
 }
18971c
 
18971c
 installkernel() {
18971c
-    local _fipsmodules _mod i
18971c
+    local _fipsmodules _mod i _bootfstype
18971c
 
18971c
     if [[ -f "${srcmods}/modules.fips" ]]; then
18971c
         _fipsmodules="$(cat "${srcmods}/modules.fips")"
18971c
@@ -36,6 +36,16 @@ installkernel() {
18971c
             done
18971c
         fi
18971c
     done
18971c
+
18971c
+    # with hostonly_default_device fs module for /boot is not installed by default
18971c
+    if [[ $hostonly ]] && [[ "$hostonly_default_device" == "no" ]]; then
18971c
+        _bootfstype=$(find_mp_fstype /boot)
18971c
+        if [[ -n "$_bootfstype" ]]; then
18971c
+            hostonly='' instmods $_bootfstype
18971c
+        else
18971c
+            dwarning "Can't determine fs type for /boot, FIPS check may fail."
18971c
+        fi
18971c
+    fi
18971c
 }
18971c
 
18971c
 install() {