[rhel7/master] Add check for the format of grub2 encrypted password (#1070327)

Brian C. Lane bcl at redhat.com
Sat Aug 9 00:20:09 UTC 2014


Encrypted grub2 passwords need to use the grub.pbkdf2 algorithm. Check
for this if bootloader --iscrypted is used with grub2 and raise a
KickstartError if it is in the wrong format.

Note that --md5pass is mapped to --iscrypted

Related: rhbz#1070327
---
 pyanaconda/kickstart.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 9118854..b6316c8 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -291,6 +291,11 @@ class Bootloader(commands.bootloader.F19_Bootloader):
             raise KickstartValueError(formatErrorMsg(self.lineno,
                     msg="GRUB2 does not support installation to a partition."))
 
+        if self.isCrypted and isinstance(get_bootloader(), GRUB2):
+            if not self.password.startswith("grub.pbkdf2."):
+                raise KickstartValueError(formatErrorMsg(self.lineno,
+                        msg="GRUB2 encrypted password must be in grub.pbkdf2 format."))
+
         return self
 
     def execute(self, storage, ksdata, instClass):
-- 
1.9.3



More information about the anaconda-patches mailing list