RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1784473 - fips-mode-setup breaks the Grub default value handling
Summary: fips-mode-setup breaks the Grub default value handling
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: crypto-policies
Version: 8.1
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: 8.3
Assignee: Tomas Mraz
QA Contact: Ondrej Moriš
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-12-17 14:31 UTC by Renaud Métrich
Modified: 2023-10-06 18:55 UTC (History)
7 users (show)

Fixed In Version: crypto-policies-20200527-1.git0a29b28.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 01:58:27 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 4740831 0 None None None 2020-01-17 14:40:02 UTC
Red Hat Product Errata RHBA-2020:4536 0 None None None 2020-11-04 01:58:40 UTC

Description Renaud Métrich 2019-12-17 14:31:27 UTC
Description of problem:

Initially, before running fips-mode-setup at all, BLS entries's "options" line looks like the one below:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
options $kernelopts $tuned_params
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This enables Grub to work just fine when changing the GRUB_CMDLINE_LINUX line in /etc/default/grub and running grub2-mkconfig, because $kernelopts in /boot/grub2/grubenv is adjusted.

Unfortunately, everything starts breaking after executing "fips-mode-setup --enable".
This leads to "options" line to become STATIC, as shown below:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
options root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap console=tty0 console=ttyS0,115200n8 $tuned_params fips=0 boot=UUID=17c2c80a-afad-4b64-a31b-55b21ced3740
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Hence, further modification of GRUB_CMDLINE_LINUX line in /etc/default/grub is not taken into account anymore, because $kernelopts in /boot/grub2/grubenv is adjusted *but* $kernelopts is now ignored.
Same happens for $tuned_params.

Note that "fips-mode-setup --disable" doesn't help here because it doesn't restore the entry, just changes "fips=1" to "fip0".


Version-Release number of selected component (if applicable):

crypto-policies-20190807-1.git9b1477b.el8.noarch


How reproducible:

Always


Steps to Reproduce:
1. Execute "fips-mode-setup --enable"
2. Check BLS entries content

Actual results:

Broken "options" line


Expected results:

Something like "options $kernelopts $tuned_params $fips" and a new "fips" variable in /boot/grub2/grubenv managed by fips-mode-setup.
Or /etc/default/grub updated accordingly, appending "fips=1 boot=..."

Comment 1 Tomas Mraz 2019-12-17 16:02:24 UTC
Why cannot grubby DTRT on BLS enabled system and just modify kernelopts? It is a huge mess and I would really like to know from some expert what should fips-mode-setup do to modify the kernel options without breaking any relevant use-cases.

Comment 2 Javier Martinez Canillas 2020-01-14 14:18:43 UTC
(In reply to Tomas Mraz from comment #1)
> Why cannot grubby DTRT on BLS enabled system and just modify kernelopts? It

That's what it does when using the grubby --update-kernel=ALL option.

> is a huge mess and I would really like to know from some expert what should
> fips-mode-setup do to modify the kernel options without breaking any
> relevant use-cases.

I've looked at the fips-mode-setup script and I see that's running 'grubby --update-kernel=$default_kernel --args="$fipsopts"' and then 'grub2-editenv - set kernelopts="$kernelopts $fipsopts"'. Since the intention seems to be to update the cmdline for all the entries, I think that instead it should run 'grubby --update-kernel=ALL --args="$fipsopts"'.

With that command grubby will update the $kernelopts variable. The reason why the 'grubby --update-kernel=$kernel --args=$foo' expands the $kernelopts variable and writes the resulting value in the BLS snippet for $kernel is that the user is telling grubby that only wants to modify the cmdline for that entry. So the $kernelopts variable can't be updated since that will affect all the entries.

That's why grubby supports an ALL argument for the --update-kernel option to specify that all the entries should modified, so grubby updates the $kernelopts variable instead of editing the options fields in the BLS files.

Comment 3 Tomas Mraz 2020-01-14 14:37:40 UTC
Do I get it right that grubby --update-kernel=ALL --args="$fipsopts" would replace both the existing grubby call and the grub2-editenv call?

Comment 4 Javier Martinez Canillas 2020-01-14 14:45:45 UTC
(In reply to Tomas Mraz from comment #3)
> Do I get it right that grubby --update-kernel=ALL --args="$fipsopts" would
> replace both the existing grubby call and the grub2-editenv call?

That's correct.

Comment 5 Tomas Mraz 2020-01-14 15:01:10 UTC
OK, thank you. Reassigned back to crypto-policies.

Comment 12 errata-xmlrpc 2020-11-04 01:58:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (crypto-policies bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4536


Note You need to log in before you can comment on or make changes to this bug.