|
|
6f5ff5 |
From 7d19c76bfc9a7b569a1077d1e5673a28bf31606f Mon Sep 17 00:00:00 2001
|
|
|
6f5ff5 |
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
6f5ff5 |
Date: Tue, 6 Mar 2018 13:59:34 +0100
|
|
|
6f5ff5 |
Subject: [PATCH] Don't execute clevis-luks-unlock while loop in a subshell
|
|
|
6f5ff5 |
|
|
|
6f5ff5 |
The loop that tries to open the dm-crypt devices using the pins in the
|
|
|
6f5ff5 |
luksmeta header is executed in a subshell. So on success it calls exit
|
|
|
6f5ff5 |
to exit the subshell.
|
|
|
6f5ff5 |
|
|
|
6f5ff5 |
But then clevis-luks-unlock has no way to know if the encrypted device
|
|
|
6f5ff5 |
was opened correctly or not. So run the loop in the main shell process
|
|
|
6f5ff5 |
and return 0 as exit status if the operation was successful.
|
|
|
6f5ff5 |
|
|
|
6f5ff5 |
Fixes: #36
|
|
|
6f5ff5 |
|
|
|
6f5ff5 |
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
6f5ff5 |
---
|
|
|
6f5ff5 |
src/clevis-luks-unlock | 4 ++--
|
|
|
6f5ff5 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
6f5ff5 |
|
|
|
6f5ff5 |
diff --git a/src/clevis-luks-unlock b/src/clevis-luks-unlock
|
|
|
6f5ff5 |
index 6396680..7d316cd 100755
|
|
|
6f5ff5 |
--- a/src/clevis-luks-unlock
|
|
|
6f5ff5 |
+++ b/src/clevis-luks-unlock
|
|
|
6f5ff5 |
@@ -54,7 +54,7 @@ fi
|
|
|
6f5ff5 |
|
|
|
6f5ff5 |
NAME=${NAME:-luks-`cryptsetup luksUUID $DEV`}
|
|
|
6f5ff5 |
|
|
|
6f5ff5 |
-luksmeta show -d "$DEV" | while read -r slot state uuid; do
|
|
|
6f5ff5 |
+while read -r slot state uuid; do
|
|
|
6f5ff5 |
[ "$state" != "active" ] && continue
|
|
|
6f5ff5 |
[ "$uuid" != "$UUID" ] && continue
|
|
|
6f5ff5 |
|
|
|
6f5ff5 |
@@ -62,6 +62,6 @@ luksmeta show -d "$DEV" | while read -r slot state uuid; do
|
|
|
6f5ff5 |
echo -n "$pt" | cryptsetup open -d- "$DEV" "$NAME"
|
|
|
6f5ff5 |
exit 0
|
|
|
6f5ff5 |
fi
|
|
|
6f5ff5 |
-done
|
|
|
6f5ff5 |
+done <<< "$(luksmeta show -d "$DEV")"
|
|
|
6f5ff5 |
|
|
|
6f5ff5 |
exit 1
|
|
|
6f5ff5 |
--
|
|
|
6f5ff5 |
2.17.1
|
|
|
6f5ff5 |
|