fix grub2 password setting does not take effect

(cherry picked from commit d97f925042d64cc2435e4615c3f0313b125af213)
This commit is contained in:
zhangqiumiao 2022-04-14 16:21:15 +08:00 committed by openeuler-sync-bot
parent 5d6aa47fe3
commit 7746c1e996
3 changed files with 7 additions and 44 deletions

View File

@ -1,42 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 5 Jul 2021 18:24:22 +0200
Subject: [PATCH] grub-set-password: Always use /boot/grub2/user.cfg as
password default
The GRUB configuration file is always placed in /boot/grub2/ now, even for
EFI. But the tool is still creating the user.cfg in the ESP and not there.
Resolves: rhbz#1955294
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub-set-password.in | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
index c0b5ebbfdc5..d8005e5a142 100644
--- a/util/grub-set-password.in
+++ b/util/grub-set-password.in
@@ -1,11 +1,6 @@
#!/bin/sh -e
-EFIDIR=$(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/' -e 's/\"//g')
-if [ -d /sys/firmware/efi/efivars/ ]; then
- grubdir=`echo "/@bootdirname@/efi/EFI/${EFIDIR}/" | sed 's,//*,/,g'`
-else
- grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
-fi
+grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`
PACKAGE_VERSION="@PACKAGE_VERSION@"
PACKAGE_NAME="@PACKAGE_NAME@"
@@ -116,8 +111,6 @@ if [ -z "${MYPASS}" ]; then
exit 1
fi
-# on the ESP, these will fail to set the permissions, but it's okay because
-# the directory is protected.
install -m 0600 /dev/null "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
chmod 0600 "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
echo "GRUB2_PASSWORD=${MYPASS}" > "${OUTPUT_PATH}/user.cfg"

View File

@ -188,7 +188,6 @@ Patch0187: 0187-efinet-Add-DHCP-proxy-support.patch
Patch0188: 0188-fs-ext2-Ignore-checksum-seed-incompat-feature.patch
Patch0189: 0189-Don-t-update-the-cmdline-when-generating-legacy-menu.patch
Patch0190: 0190-Suppress-gettext-error-message.patch
Patch0191: 0191-grub-set-password-Always-use-boot-grub2-user.cfg-as-.patch
Patch0192: 0192-templates-Check-for-EFI-at-runtime-instead-of-config.patch
Patch0193: 0193-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch
Patch0194: 0194-arm64-Fix-EFI-loader-kernel-image-allocation.patch

View File

@ -14,7 +14,7 @@
Name: grub2
Epoch: 1
Version: 2.06
Release: 4
Release: 5
Summary: Bootloader with support for Linux, Multiboot and more
License: GPLv3+
URL: http://www.gnu.org/software/grub/
@ -432,6 +432,12 @@ fi
%{_datadir}/man/man*
%changelog
* Thu Apr 14 2022 zhangqiumiao <zhangqiumiao1@huawei.com> - 2.06-5
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix grub2 password setting does not take effect
* Fri Mar 25 2022 zhangqiumiao <zhangqiumiao1@huawei.com> - 2.06-4
- Type:bugfix
- CVE:NA