[master/f22-branch][PATCH] Try using the global LUKS passphrase if none is given for LV/part (#1196112)

Vratislav Podzimek vpodzime at redhat.com
Tue Mar 3 10:21:14 UTC 2015


If passphrase cannot be determined, raise an explanatory exception instead of
creating a LUKS device with no passhprase and leaving to error out somewhere
deep in Blivet.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/kickstart.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 832810f..5385d35 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1019,6 +1019,15 @@ class LogVolData(commands.logvol.F21_LogVolData):
             if self.passphrase and not storage.encryptionPassphrase:
                 storage.encryptionPassphrase = self.passphrase
 
+            # try to use the global passphrase if available
+            # XXX: we require the LV/part with --passphrase to be processed
+            # before this one to setup the storage.encryptionPassphrase
+            self.passphrase = self.passphrase or storage.encryptionPassphrase
+
+            if not self.passphrase:
+                raise KickstartValueError(formatErrorMsg(self.lineno,
+                                                         msg="No passphrase given for encrypted LV"))
+
             cert = getEscrowCertificate(storage.escrowCertificates, self.escrowcert)
             if self.preexist:
                 luksformat = fmt
@@ -1332,6 +1341,15 @@ class PartitionData(commands.partition.F18_PartData):
             if self.passphrase and not storage.encryptionPassphrase:
                 storage.encryptionPassphrase = self.passphrase
 
+            # try to use the global passphrase if available
+            # XXX: we require the LV/part with --passphrase to be processed
+            # before this one to setup the storage.encryptionPassphrase
+            self.passphrase = self.passphrase or storage.encryptionPassphrase
+
+            if not self.passphrase:
+                raise KickstartValueError(formatErrorMsg(self.lineno,
+                                                         msg="No passphrase given for encrypted part"))
+
             cert = getEscrowCertificate(storage.escrowCertificates, self.escrowcert)
             if self.onPart:
                 luksformat = kwargs["fmt"]
-- 
2.1.0



More information about the anaconda-patches mailing list