rhboot / shim-review

Reviews of shim
67 stars 127 forks source link

Shim 15.7 for openSUSE Tumbleweed #329

Closed jsegitz closed 1 year ago

jsegitz commented 1 year ago

Confirm the following are included in your repo, checking each box:


What is the link to your tag in a repo cloned from rhboot/shim-review?


https://github.com/jsegitz/shim-review/tree/SUSE-openSUSE_tumbleweed-shim-15.7-20230403_tag


What is the SHA256 hash of your final SHIM binary?


pesign --hash --padding --in=./usr/share/efi/x86_64/shim-opensuse.efi hash: 793aff84df52f86aceccc1be0111de4976d9e32fc62b20ac2ef6223f3c0516c1

sha256sum ./usr/share/efi/x86_64/shim-opensuse.efi 6af9b677a91b9f7fc4c06c18cc8ffaec91dd9255468d40e68ceb317af06b5d62 ./usr/share/efi/x86_64/shim-opensuse.efi


What is the link to your previous shim review request (if any, otherwise N/A)?


https://github.com/rhboot/shim-review/issues/283

aronowski commented 1 year ago

While I'm not an official reviewer, I can see a few curiosities:

The tag used for review is not covered by the rule: tag it with a tag of the form "myorg-shim-arch-YYYYMMDD". It has the word _tag at the end. But I can see the proper one has been used as a branch name.


Does your GRUB2 binary and kernel have the latest NX requirements mentioned here enabled:

Also NX support needs to be added to bootloader and kernel.

In other words: do you have a patch that toggles the NX compatibility flag for the vmlinuz binary somewhere in the build process?

The same question applies to the GRUB2 directory you attached - is there a patch for the NX compatibility flag somewhere that I cannot see?


Despite the fact there's the shim-Enable-the-NX-compatibility-flag-by-default.patch in here, your build process (covered by the build_log.x86_64 file) forces your shim binary to not have the NX compatibility flag enabled -

[...]
[   27s] ./post-process-pe -vv  MokManager.efi
[   27s] set_dll_characteristics():355: Updating DLL Characteristics from 0x0000 to 0x0100
[...]
[   27s] ./post-process-pe -vv  fallback.efi
[   27s] set_dll_characteristics():355: Updating DLL Characteristics from 0x0000 to 0x0100
[...]
[   30s] ./post-process-pe -vv -N shim.efi
[   30s] + grep -q 'openSUSE Secure Boot CA1' shim.efi
[...]

Somehow your build runs the program with the -N flag which means Disable the NX compatibility flag.

The shim-opensuse_x86_64.efi binary you attached has this flag set to disabled either.


*******************************************************************************
### How do you manage and protect the keys used in your SHIM?
*******************************************************************************
The keys are in a specially hardened machine that is in our build environment.

Please, tell us more on how does your environment implement the following Microsoft signing requirements:


*******************************************************************************
### Do you add a vendor-specific SBAT entry to the SBAT section in each binary that supports SBAT metadata ( grub2, fwupd, fwupdate, shim + all child shim binaries )?
### Please provide exact SBAT entries for all SBAT binaries you are booting or planning to boot directly through shim.
### Where your code is only slightly modified from an upstream vendor's, please also preserve their SBAT entries to simplify revocation.
*******************************************************************************
yes

[...]

fwupd:
sbat,1,UEFI shim,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
fwupd,1,Firmware update daemon,fwupd,1.7.3,https://github.com/fwupd/fwupd
fwupd-sle,1,SUSE Linux Enterprise,fwupd,1.7.3,https://build.opensuse.org

shim:
sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
shim,3,UEFI shim,shim,1,https://github.com/rhboot/shim
shim.opensuse,1,The openSUSE project,shim,15.7,mail:security-team@suse.de

Shouldn't fwupd-sle be fwupd.sle?

As far as I'm concerned, shim's SBAT does not need the mail: string. I'm unsure how this implementation is going to perform in regards to e.g. parsing the binary to extract only the email address and the output having the additional prefix.


Why doesn't your review mention the following GRUB2 modules:

despite them being listed in your GRUB2's specfile?

I assume there's one spelling error since the efinet module has been duplicated.

jsegitz commented 1 year ago

Thank you for your notes.

aronowski commented 1 year ago

It's not like the _tag suffix bothers me personally but I can't speak for other entities like the Red Hat Bootloader Team or Microsoft - maybe they happen to use some sort of automation tool that won't work with this suffix.

If I was to use your framework, that is having multiple branches and then tagging specific commits, I would use something like this: for developing specifically Shim 15.7 for openSUSE Tumbleweed I would use the branch SUSE-openSUSE_tumbleweed-shim-15.7-devel and then tag the commit I would want to publish for the review as SUSE-openSUSE_tumbleweed-shim-15.7-20230404.

This way the branch would indicate continuous development and potential shim-review fixes for that specific product and the tag would indicate the date of the commit to be reviewed.


Alright, waiting for the NX updates.

Hint: utlize tools for static analysis to make sure the final artifact has NX support enabled. You can use, for instance, NTCore's CFF Explorer or zed-0xff's pedump.

I do it this way to see the effecive outcome that only matters to me - as seen in the build logs, sometimes just adding a patch won't be enough.


I can see the machine is hardened and certified indeed!

Altough I can't speak for Microsoft and how their requirements will affect this review. Hope everything goes well.


Regarding GRUB2 variants, I understand the distribution allows one to choose the variant they want and therefore all of them are valid.

If this is correct, I would attach such a note in the review and let the official reviewers decide on this.

jsegitz commented 1 year ago

The NX topic is a bigger item for us. So I'll close this review request here and will reopen once all the necessary changes have been done and tested. Thanks again for your review @aronowski