Skip to content

Secure boot add signed shim and grub, key signing an importing tools #5286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

kelly-yeh-ms
Copy link

  • Why I did it
    Add signed shim and grub, secure boot key signing and importing tools

  • How I did it
    Add corresponding packages

  • How to verify it
    Verify secure boot state and import keys with mokutil
    Sign binaries with sbsign
    Check if the following exist:
    /usr/lib/shim/shimx64.efi.signed
    /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed

@lguohan lguohan requested a review from qiluo-msft August 31, 2020 20:18
device-tree-compiler \
# For secure boot key signing and import
efitools \
mokutil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mokutil [](start = 1, length = 7)

Do you need mokutil in runtime to import key? sonic-slave is only for build.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be beneficial to have mokutil during runtime

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your comment said "importing secure boot keys", and I guess it is for mokutil. It is confusing, because sonic-slave-buster is a build environment (docker container). And it is different from a running SONiC. Why you need it in build time and how do you use it?


In reply to: 480381168 [](ancestors = 480381168)

build_debian.sh Outdated

## Secure boot signed shim grub
Copy link
Collaborator

@qiluo-msft qiluo-msft Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secure boot signed shim grub [](start = 3, length = 29)

The comment is difficult to read. Could you check against description of installed packages and refine the statement? #Closed

@@ -310,7 +310,10 @@ RUN apt-get update && apt-get install -y \
# For SWI Tools
python-m2crypto \
# For build dtb
device-tree-compiler
device-tree-compiler \
# For secure boot key signing and import
Copy link
Collaborator

@qiluo-msft qiluo-msft Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For secure boot key signing and import [](start = 2, length = 38)

Below 2 packages have nothing to do with signing. Please refine comment. #Closed

@qiluo-msft
Copy link
Collaborator

qiluo-msft commented Aug 31, 2020

Suggest refine PR title to be descriptive, accurate and explicit. #Closed

## Secure boot signed shim grub
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
grub-efi-amd64-signed \
shim-signed
Copy link
Collaborator

@qiluo-msft qiluo-msft Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried about the disk space of image. Are they needed in runtime? Is there anything we can do to reduce image sizes before installation, or occupied disk space after installation? #Closed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can sign grubx64.efi and shimx64.efi with our own keys, then we do not have to install these packages that contain debian signed shimx64.efi and grubx64.efi.

Copy link
Collaborator

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

@jleveque
Copy link
Contributor

Please add more detail to the PR title

@kelly-yeh-ms kelly-yeh-ms changed the title Secure boot Secure boot add signed shim and grub, key signing an importing tools Sep 4, 2020
@qiluo-msft
Copy link
Collaborator

I cannot understand PR title "key signing an importing tools" part.

@@ -637,6 +637,76 @@ else
cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg
fi

tmp_config=$(mktemp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tmp_config [](start = 0, length = 10)

Add some comment to this block of code.

zfscrypt
zfsinfo
"
/usr/bin/grub-mkimage --format="x86_64-efi" --directory="/usr/lib/grub/x86_64-efi" \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grub-mkimage [](start = 9, length = 12)

Check the build failure, seems this command is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants