|
|
73ad23 |
From 9c54932f590fd7accadc780c6ee946a94286b7e6 Mon Sep 17 00:00:00 2001
|
|
|
73ad23 |
From: Lukas Nykryn <lnykryn@redhat.com>
|
|
|
73ad23 |
Date: Tue, 14 May 2019 09:23:55 +0200
|
|
|
73ad23 |
Subject: [PATCH] fips: split loading the crypto modules and checking the
|
|
|
73ad23 |
kernel
|
|
|
73ad23 |
|
|
|
73ad23 |
In e54ab383 we moved the fips script to a later pahse of boot, since
|
|
|
73ad23 |
the /boot might not be available early on.
|
|
|
73ad23 |
|
|
|
73ad23 |
The problem is that systemd-cryptsetup* services could be run now
|
|
|
73ad23 |
started before the do_fips is executed and need the crypto modules
|
|
|
73ad23 |
to decrypted the devices.
|
|
|
73ad23 |
|
|
|
73ad23 |
So let's split the do_fips and load the module before udev does the
|
|
|
73ad23 |
trigger.
|
|
|
73ad23 |
---
|
|
|
73ad23 |
modules.d/01fips/fips-load-crypto.sh | 8 ++++++++
|
|
|
73ad23 |
modules.d/01fips/fips.sh | 19 +++++++++++--------
|
|
|
73ad23 |
modules.d/01fips/module-setup.sh | 1 +
|
|
|
73ad23 |
3 files changed, 20 insertions(+), 8 deletions(-)
|
|
|
73ad23 |
|
|
|
73ad23 |
diff --git a/modules.d/01fips/fips-load-crypto.sh b/modules.d/01fips/fips-load-crypto.sh
|
|
|
73ad23 |
new file mode 100644
|
|
|
73ad23 |
index 00000000..82cbeee4
|
|
|
73ad23 |
--- /dev/null
|
|
|
73ad23 |
+++ b/modules.d/01fips/fips-load-crypto.sh
|
|
|
73ad23 |
@@ -0,0 +1,8 @@
|
|
|
73ad23 |
+#!/bin/sh
|
|
|
73ad23 |
+
|
|
|
73ad23 |
+if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
|
|
73ad23 |
+ rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
|
|
73ad23 |
+else
|
|
|
73ad23 |
+ . /sbin/fips.sh
|
|
|
73ad23 |
+ fips_load_crypto || die "FIPS integrity test failed"
|
|
|
73ad23 |
+fi
|
|
|
73ad23 |
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
|
|
|
73ad23 |
index 9bc089f2..beaa692b 100755
|
|
|
73ad23 |
--- a/modules.d/01fips/fips.sh
|
|
|
73ad23 |
+++ b/modules.d/01fips/fips.sh
|
|
|
73ad23 |
@@ -69,15 +69,8 @@ do_rhevh_check()
|
|
|
73ad23 |
return 0
|
|
|
73ad23 |
}
|
|
|
73ad23 |
|
|
|
73ad23 |
-do_fips()
|
|
|
73ad23 |
+fips_load_crypto()
|
|
|
73ad23 |
{
|
|
|
73ad23 |
- local _v
|
|
|
73ad23 |
- local _s
|
|
|
73ad23 |
- local _v
|
|
|
73ad23 |
- local _module
|
|
|
73ad23 |
-
|
|
|
73ad23 |
- KERNEL=$(uname -r)
|
|
|
73ad23 |
-
|
|
|
73ad23 |
FIPSMODULES=$(cat /etc/fipsmodules)
|
|
|
73ad23 |
|
|
|
73ad23 |
info "Loading and integrity checking all crypto modules"
|
|
|
73ad23 |
@@ -102,6 +95,16 @@ do_fips()
|
|
|
73ad23 |
info "Self testing crypto algorithms"
|
|
|
73ad23 |
modprobe tcrypt || return 1
|
|
|
73ad23 |
rmmod tcrypt
|
|
|
73ad23 |
+}
|
|
|
73ad23 |
+
|
|
|
73ad23 |
+do_fips()
|
|
|
73ad23 |
+{
|
|
|
73ad23 |
+ local _v
|
|
|
73ad23 |
+ local _s
|
|
|
73ad23 |
+ local _v
|
|
|
73ad23 |
+ local _module
|
|
|
73ad23 |
+
|
|
|
73ad23 |
+ KERNEL=$(uname -r)
|
|
|
73ad23 |
|
|
|
73ad23 |
info "Checking integrity of kernel"
|
|
|
73ad23 |
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
|
|
|
73ad23 |
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
|
|
|
73ad23 |
index f3af4d90..18186d62 100755
|
|
|
73ad23 |
--- a/modules.d/01fips/module-setup.sh
|
|
|
73ad23 |
+++ b/modules.d/01fips/module-setup.sh
|
|
|
73ad23 |
@@ -54,6 +54,7 @@ install() {
|
|
|
73ad23 |
local _dir
|
|
|
73ad23 |
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
|
|
73ad23 |
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
|
|
73ad23 |
+ inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
|
|
|
73ad23 |
inst_script "$moddir/fips.sh" /sbin/fips.sh
|
|
|
73ad23 |
|
|
|
73ad23 |
inst_multiple sha512hmac rmmod insmod mount uname umount
|
|
|
d4a4eb |
|