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 1715202 - enabling fips mode after kernel update results in inconsistent state
Summary: enabling fips mode after kernel update results in inconsistent state
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: crypto-policies
Version: 8.0
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: 8.0
Assignee: Tomas Mraz
QA Contact: Ondrej Moriš
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-29 19:33 UTC by Ondrej Moriš
Modified: 2020-11-14 12:46 UTC (History)
3 users (show)

Fixed In Version: crypto-policies-20190613-1.git21ffdc8.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-05 22:33:24 UTC
Type: Bug
Target Upstream Version:
Embargoed:
tmraz: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3644 0 None None None 2019-11-05 22:33:40 UTC

Description Ondrej Moriš 2019-05-29 19:33:12 UTC
Description of problem:

Suppose we have a kernel version X installed on the system and booted. When that kernel is updated to version Y and fips-mode-setup is used to enable FIPS mode afterwards, system boots into inconsistent FIPS state after reboot.

One of the steps 'fips-mode-setup --enable' does is initramfs regeneration by dracut so that FIPS dracut modules are part such regeneration. However, crypto-policies or dracut regenerate initramfs of a kernel running on the system (version X) instead of kernel that will be booted next time (version Y).

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

dracut-049-10.git20190115.el8
crypto-policies-20181217-3.git9a35207.el8

How reproducible:

100%

Steps to Reproduce:

1. Boot the system.
2. Update the kernel.
3. Enable FIPS mode (fips-mode-setup --enable).
4. Reboot the system.
5. Check FIPS mode (fips-mode-setup --check).
6. Check that /etc/system-fips is present in initramfs of updated kernel (lsinitrd -f etc/system-fips).

Actual results:

# cat /proc/sys/crypto/fips_enabled 
1

# fips-mode-setup --check
Installation of FIPS modules is not completed.
FIPS mode is enabled.
Inconsistent state detected.

# lsinitrd -f etc/system-fips
<none>

Expected results:

# fips-mode-setup --check
FIPS mode is enabled.

# lsinitrd -f etc/system-fips
# FIPS module installation complete

Additional info:

Either crypto-policies should be fixed to use --regenerate-all or --kver dracut parameters or dracut should be fixed to use default kernel version initramfs for regeneration by default.

Comment 2 Tomas Mraz 2019-05-30 09:06:32 UTC
Lukáš, what do you think?

My opinion: The --regenerate-all is too big hammer. I do not think we want to modify initramfs for older kernels. Ideally we should regenerate initramfs for the kernel that will be booted after the reboot (and probably also for the kernel that is currently booted).

Lukáš, would it be possible to modify dracut -f without other options to regenerate both these kernels? Or if you think it is not a good idea to change dracut semantics, could you suggest what would be the best way to achieve this by calling dracut? Of course we would want to avoid stuff like always call dracut twice if the kernel that is booted now and that will be booted next is the same kernel as calling dracut is already quite time consuming.

Comment 3 Lukáš Nykrýn 2019-05-30 10:12:54 UTC
How do you modify the grub configuration? I would presume that you set fips=1 for all entries and in such case, I think it also makes sense to regenerate all initramdisks as well, since otherwise you will get the inconsistent state for all the old entries.

Comment 4 Tomas Mraz 2019-05-30 10:30:35 UTC
We use grubby to update the default kernel only but we also use grub2-editenv to modify the grubenv. I actually did not try whether this means it will affect all kernel command lines for old kernels or not.

Historically without BLS the grubby call affected only the default kernel (i.e. the one that will be booted next). However it is a good point that with BLS and editing grubenv it might actually affect all kernels.

Comment 5 Tomas Mraz 2019-06-03 16:00:55 UTC
Ondrej, do you have some machine ready where we could easily check whether the grub2-editenv affects all the kernels?

Comment 6 Ondrej Moriš 2019-06-11 15:11:14 UTC
(In reply to Tomas Mraz from comment #5)
> Ondrej, do you have some machine ready where we could easily check whether
> the grub2-editenv affects all the kernels?

Sorry, I was on PTO but I will try it right away.

Comment 7 Ondrej Moriš 2019-06-11 19:02:46 UTC
OK, the answer is yes - grub2-editenv affects all the kernel. IOW, when I have two kernels installed then kernelopts modifications via grub2-editenv affect all kernels installed.

Comment 15 errata-xmlrpc 2019-11-05 22:33:24 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, 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-2019:3644


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