Harald Hoyer 460d2c
From da4c9a950f339f2e87a021f7d060bf7ac07f4f00 Mon Sep 17 00:00:00 2001
Harald Hoyer 460d2c
From: Daniel Molkentin <dmolkentin@suse.com>
Harald Hoyer 460d2c
Date: Mon, 6 Jul 2020 14:47:28 +0200
Harald Hoyer 460d2c
Subject: [PATCH] 01fips: modprobe failures during manual module loading is not
Harald Hoyer 460d2c
 fatal
Harald Hoyer 460d2c
Harald Hoyer 460d2c
Users might see
Harald Hoyer 460d2c
Harald Hoyer 460d2c
"modprobe: FATAL: Module xyz not found in directory"
Harald Hoyer 460d2c
Harald Hoyer 460d2c
The output from modprobe is semantically wrong in this case and
Harald Hoyer 460d2c
confuses users. Keep the warning for debugging purposes, but reduce
Harald Hoyer 460d2c
the severeness.
Harald Hoyer 460d2c
Harald Hoyer 460d2c
It now reads "Module xyz not found in directory"
Harald Hoyer 460d2c
Harald Hoyer 460d2c
Reference: bsc#1169997
Harald Hoyer 460d2c
---
Harald Hoyer 460d2c
 modules.d/01fips/fips.sh | 10 +++++++++-
Harald Hoyer 460d2c
 1 file changed, 9 insertions(+), 1 deletion(-)
Harald Hoyer 460d2c
Harald Hoyer 460d2c
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
Harald Hoyer 460d2c
index 8fba135b..37cde0c0 100755
Harald Hoyer 460d2c
--- a/modules.d/01fips/fips.sh
Harald Hoyer 460d2c
+++ b/modules.d/01fips/fips.sh
Harald Hoyer 460d2c
@@ -69,6 +69,14 @@ do_rhevh_check()
Harald Hoyer 460d2c
     return 0
Harald Hoyer 460d2c
 }
Harald Hoyer 460d2c
 
Harald Hoyer 460d2c
+nonfatal_modprobe()
Harald Hoyer 460d2c
+{
Harald Hoyer 460d2c
+    modprobe $1 2>&1 > /dev/stdout |
Harald Hoyer 460d2c
+        while read -r line || [ -n "$line" ]; do
Harald Hoyer 460d2c
+            echo "${line#modprobe: FATAL: }" >&2
Harald Hoyer 460d2c
+        done
Harald Hoyer 460d2c
+}
Harald Hoyer 460d2c
+
Harald Hoyer 460d2c
 fips_load_crypto()
Harald Hoyer 460d2c
 {
Harald Hoyer 460d2c
     FIPSMODULES=$(cat /etc/fipsmodules)
Harald Hoyer 460d2c
@@ -77,7 +85,7 @@ fips_load_crypto()
Harald Hoyer 460d2c
     mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
Harald Hoyer 460d2c
     for _module in $FIPSMODULES; do
Harald Hoyer 460d2c
         if [ "$_module" != "tcrypt" ]; then
Harald Hoyer 460d2c
-            if ! modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
Harald Hoyer 460d2c
+            if ! nonfatal_modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
Harald Hoyer 460d2c
                 # check if kernel provides generic algo
Harald Hoyer 460d2c
                 _found=0
Harald Hoyer 460d2c
                 while read _k _s _v || [ -n "$_k" ]; do
Harald Hoyer 460d2c