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

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