Blame SOURCES/0003-systemd-account-for-unlocking-failures-in-clevis-luk.patch

4ba90c
From 678ef82dd5608439c9a4222c594ab66d69009f06 Mon Sep 17 00:00:00 2001
4ba90c
From: Sergio Correia <scorreia@redhat.com>
4ba90c
Date: Fri, 29 Oct 2021 12:04:46 -0300
4ba90c
Subject: [PATCH 3/3] systemd: account for unlocking failures in
4ba90c
 clevis-luks-askpass (#343)
4ba90c
4ba90c
As unlock may fail for some reason, e.g. the network is not up yet,
4ba90c
one way cause problems would be to add extra `rd.luks.uuid' params
4ba90c
to the cmdline, which would then cause such devices to be unlocked
4ba90c
in early boot. If the unlocking fail, those devices might not be
4ba90c
accounted for in the clevis_devices_to_unlock() check, as it is
4ba90c
based on crypttab.
4ba90c
4ba90c
Let's make sure there are no pending ask.* sockets waiting to be
4ba90c
answered, before exiting.
4ba90c
4ba90c
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1878892
4ba90c
---
4ba90c
 src/luks/systemd/clevis-luks-askpass | 5 ++++-
4ba90c
 1 file changed, 4 insertions(+), 1 deletion(-)
4ba90c
4ba90c
diff --git a/src/luks/systemd/clevis-luks-askpass b/src/luks/systemd/clevis-luks-askpass
4ba90c
index 285bba4..f19671f 100755
4ba90c
--- a/src/luks/systemd/clevis-luks-askpass
4ba90c
+++ b/src/luks/systemd/clevis-luks-askpass
4ba90c
@@ -67,8 +67,11 @@ while true; do
4ba90c
     done
4ba90c
 
4ba90c
     [ "${loop}" != true ] && break
4ba90c
+
4ba90c
     # Checking for pending devices to be unlocked.
4ba90c
-    if remaining=$(clevis_devices_to_unlock) && [ -z "${remaining}" ]; then
4ba90c
+    remaining_crypttab=$(clevis_devices_to_unlock) ||:
4ba90c
+    remaining_askfiles=$(ls "${path}"/ask.* 2>/dev/null) ||:
4ba90c
+    if [ -z "${remaining_crypttab}" ] && [ -z "${remaining_askfiles}" ]; then
4ba90c
         break;
4ba90c
     fi
4ba90c
 
4ba90c
-- 
4ba90c
2.33.1
4ba90c