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