32 lines
1.2 KiB
Diff
32 lines
1.2 KiB
Diff
From d6c4429bbb09fae249d7b97b06a9346cdc99f962 Mon Sep 17 00:00:00 2001
|
|
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
Date: Wed, 19 Dec 2018 09:36:30 +0100
|
|
Subject: [PATCH] Use cryptsetup to check LUKS2 label
|
|
|
|
libblkid on CentOS 7.6 doesn't support reading LUKS2 labels
|
|
---
|
|
tests/crypto_test.py | 7 +++++--
|
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/tests/crypto_test.py b/tests/crypto_test.py
|
|
index 7320e74..b8aacee 100644
|
|
--- a/tests/crypto_test.py
|
|
+++ b/tests/crypto_test.py
|
|
@@ -148,8 +148,11 @@ class CryptoTestFormat(CryptoTestCase):
|
|
BlockDev.CryptoLUKSVersion.LUKS2, extra)
|
|
self.assertTrue(succ)
|
|
|
|
- _ret, label, _err = run_command("lsblk -oLABEL -n %s" % self.loop_dev)
|
|
- self.assertEqual(label, "blockdevLUKS")
|
|
+ _ret, out, err = run_command("cryptsetup luksDump %s" % self.loop_dev)
|
|
+ m = re.search(r"Label:\s*(\S+)\s*", out)
|
|
+ if not m or len(m.groups()) != 1:
|
|
+ self.fail("Failed to get label information from:\n%s %s" % (out, err))
|
|
+ self.assertEqual(m.group(1), "blockdevLUKS")
|
|
|
|
# different key derivation function
|
|
pbkdf = BlockDev.CryptoLUKSPBKDF(type="pbkdf2")
|
|
--
|
|
2.21.0
|
|
|