[RHEL7.2 - PATCH 2 of 2] Enable Custom GRUB2 Password Utility (#985962)
Robert Marshall
rmarshall at redhat.com
Thu Jul 2 20:29:48 UTC 2015
Changes the output of the GRUB2 password selection to output
the encrypted and hashed password to a file in /boot/grub2.
Code change depends on the commit in GRUB2 that adds the
friendly GRUB2 password change utility.
Resolves: rhbz#985962
---
pyanaconda/bootloader.py | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 2e1f8ec..5a9d1ce 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -1393,6 +1393,7 @@ class GRUB2(GRUB):
packages = ["grub2"]
_config_file = "grub.cfg"
_config_dir = "grub2"
+ _passwd_file = "user.cfg"
defaults_file = "/etc/default/grub"
terminal_type = "console"
@@ -1522,17 +1523,13 @@ class GRUB2(GRUB):
if not self.password and not self.encrypted_password:
return
- users_file = iutil.getSysroot() + "/etc/grub.d/01_users"
+ # don't like using hard coded /boot/grub2/ - better call here?
+ users_file = iutil.getSysroot() + "/boot/grub2/" + self._passwd_file
header = open(users_file, "w")
- header.write("#!/bin/sh -e\n\n")
- header.write("cat << \"EOF\"\n")
# XXX FIXME: document somewhere that the username is "root"
- header.write("set superusers=\"root\"\n")
- header.write("export superusers\n")
self._encrypt_password()
- password_line = "password_pbkdf2 root " + self.encrypted_password
+ password_line = "GRUB2_PASSWORD=" + self.encrypted_password
header.write("%s\n" % password_line)
- header.write("EOF\n")
header.close()
iutil.eintr_retry_call(os.chmod, users_file, 0o700)
--
1.8.3.1
More information about the anaconda-patches
mailing list