Bug 2157836

Summary: rpm-plugin-ima tried to add IMA signature to non-existing files
Product: Red Hat Enterprise Linux 9 Reporter: Coiby <coxu>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Jan Blazek <jblazek>
Severity: low Docs Contact: Mariya Pershina <mpershin>
Priority: unspecified    
Version: 9.2CC: ffesti, mbanas, mpershin, mthacker
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.16.1.3-23.el9 Doc Type: Bug Fix
Doc Text:
.Installing packages with IMA signatures on file systems without extended file attributes no longer fails Previously, RPM tried to apply IMA signatures to files even if they did not support these signatures. As a consequence, package installation failed. With this update, RPM skips applying IMA signatures. As a result, package installation no longer fails.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:52:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Deadline: 2023-06-19   

Description Coiby 2023-01-03 07:31:42 UTC
Description of problem:

rpm-plugin-ima tried to add IMA signatures to non-existing files for grub2-efi and shim,

    $ dnf reinstall grub2-efi shim -y
    error: ima: could not apply signature on '/boot/efi/EFI/BOOT/BOOTX64.EFI;63b3d90d': Operation not supported
    error: Plugin ima: hook fsm_file_prepare failed
    
    Error unpacking rpm package shim-x64-15.6-1.el9.x86_64
      Reinstalling     : grub2-efi-x64-1:2.06-46.el9.x86_64                                                                                                                                  2/4 
    error: unpacking of archive failed on file /boot/efi/EFI/BOOT/BOOTX64.EFI;63b3d90d: cpio: (error 0x2)
    error: shim-x64-15.6-1.el9.x86_64: install failed
    error: ima: could not apply signature on '/boot/efi/EFI/redhat/grubx64.efi;63b3d90d': Operation not supported
    error: Plugin ima: hook fsm_file_prepare failed

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

rpm-plugin-ima-4.16.1.3-22.el9

How reproducible:

always

Steps to Reproduce:
1. Install RHEL9 or use cloud image e.g. rhel-guest-image-9.2-20221205.2.x86_64.qcow2
2. dnf install rpm-plugin-ima -y
2. dnf reinstall grub2-efi shim -y

Actual results:

grub2-efi and shim failed to be reinstalled.

Expected results:

grub2-efi and shim can be reinstalled and IMA signatures are successfully added to the package files.

Additional info:

Comment 1 Florian Festi 2023-01-09 15:09:44 UTC
This looks like a duplicate of or at least very similar to #2157835. https://github.com/rpm-software-management/rpm/commit/7db2efa95d859cebda2b095ffdffac42812bd6d9 should also fix this.

Comment 3 Coiby 2023-01-25 07:33:29 UTC
(In reply to Florian Festi from comment #1)
> This looks like a duplicate of or at least very similar to #2157835.
> https://github.com/rpm-software-management/rpm/commit/
> 7db2efa95d859cebda2b095ffdffac42812bd6d9 should also fix this.

The reasons I think this is a different bug are as follows,
a) there are strange trailing characters ";63b3d90d" in the path e.g. "/boot/efi/EFI/BOOT/BOOTX64.EFI;63b3d90d"  
b) a different error "error: unpacking of archive failed on file /boot/efi/EFI/BOOT/BOOTX64.EFI;63b3d90d: cpio: (error 0x2)" is seen.

Comment 4 Florian Festi 2023-01-25 12:35:18 UTC
These "trailing characters" is the temporary name the files gets while being un-packed. The file attributes are set there before the file is moved to it's actual position/name. It's the same issue happeningh at a slightly different place - leading to a slightly different error message. But the cause is the same: The efi file system doesn't support extended file attributes and the IMA plugin errors out because of that.

We could probably even close this as an duplicate.

Another question is whether these files/packages should have IMA signatures at all if the live in a place that doesn't support them. But I am not sure if the current IMA infrastructure supports omitting such signatures.

Comment 14 errata-xmlrpc 2023-11-07 08:52:54 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 (rpm 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-2023:6623