Skip to contentSkip to conversation

UEFI Secure Boot Xen 4.9

Xen-users Daniel Kiper 3 participants 12 messages May 15, 2017 – Oct 13, 2017 2 messages not in the archive

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive

Hey,

CC-ing Xen-devel to spread some knowledge about the issue.

Quoted 21 lines · George Dunlap
Quoted 9 lines · Bill Jacobs (billjac)

Hi all

I gather that with 4.9, UEFI secure boot of Xen should be possible.

Is this true?

If so, what are the options for utilizing UEFI secure boot? Do I need a MSFT-signed shim or grub? Any special changes required for Xen kernel (signing?) or has that been done?

Bill,

I guess in part it depends on what you mean by "utilizing UEFI secure boot". If you simply want to boot an unsigned Xen on a UEFI system with SecureBoot enabled, then grub would probably work. If you want to actually do the full SecureBoot thing -- where you have grub check Xen's signature and that of the kernel and initrd, you probably need a bit more.

Quoted 5 lines

Daniel,

Is there any good documentation on this? The Xen EFI guide
(https://wiki.xenproject.org/wiki/Xen_EFI) mentions the shim, but doesn't go into detail about how to sign a binary &c.

Unfortunately I do not know anything like that. As you said in general shim is supported. Sadly, it works only if you load xen.efi directly from EFI. __Upstream__ GRUB2 has not have support for shim yet. I am working on it (shim support via GRUB2 requires also some changes in Xen). I hope that I will have something which works before Xen conf in Budapest.

If you wish to use shim with xen.efi then you have to sign xen.efi and vmlinux with your key using sbsign or pesign. The process works in the same way like in case vmlinux alone. Of course you have to install your public key into MOK before enabling secure boot.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 48 lines

-----Original Message-----
From: Daniel Kiper [mailto:[email protected]]
Sent: Monday, May 15, 2017 6:13 AM
To: Bill Jacobs (billjac) <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9

Hey,

CC-ing Xen-devel to spread some knowledge about the issue.

Quoted 22 lines · George Dunlap
Quoted 10 lines · Bill Jacobs (billjac)

Hi all

I gather that with 4.9, UEFI secure boot of Xen should be possible.

Is this true?

If so, what are the options for utilizing UEFI secure boot? Do I need a MSFT-signed shim or grub? Any special changes required for Xen kernel
(signing?) or has that been done?

Bill,

I guess in part it depends on what you mean by "utilizing UEFI secure boot". If you simply want to boot an unsigned Xen on a UEFI system with SecureBoot enabled, then grub would probably work. If you want to actually do the full SecureBoot thing -- where you have grub check Xen's signature and that of the kernel and initrd, you probably need a bit more.

Quoted 5 lines

Daniel,

Is there any good documentation on this? The Xen EFI guide
(https://wiki.xenproject.org/wiki/Xen_EFI) mentions the shim, but doesn't go into detail about how to sign a binary &c.

Unfortunately I do not know anything like that. As you said in general shim is supported. Sadly, it works only if you load xen.efi directly from EFI. __Upstream__ GRUB2 has not have support for shim yet. I am working on it (shim support via GRUB2 requires also some changes in Xen). I hope that I will have something which works before Xen conf in Budapest.

Quoted 6 lines

If you wish to use shim with xen.efi then you have to sign xen.efi and vmlinux with your key using sbsign or pesign. The process works in the same way like in case vmlinux alone. Of course you have to install your public key into MOK before enabling secure boot.

Daniel

Yes, there are options in how this is achievable, and the solutions may be different.

We are targeting a secure boot chain from UEFI fw to .ko, using same signing.
In our case would skip shim and reduce attack surface, but it appears that the mechanisms 'out there' for passing pub key (cert) from UEFI db to Linux chainring require shim to do the work. Is that accurate? Does it have to be the case? I don't see why. For us, ideal case is :
UEFI fw -> (signed)GRUB2.efi->Multiboot2->Xen(signed .ko)

I would be happy to work to help achieve this.
-Bill

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 51 lines · Bill Jacobs (billjac)
Quoted 51 lines

-----Original Message-----
From: Daniel Kiper [mailto:[email protected]]
Sent: Monday, May 15, 2017 6:13 AM
To: Bill Jacobs (billjac) <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9

Hey,

CC-ing Xen-devel to spread some knowledge about the issue.

Quoted 22 lines · George Dunlap
Quoted 10 lines · Bill Jacobs (billjac)

Hi all

I gather that with 4.9, UEFI secure boot of Xen should be possible.

Is this true?

If so, what are the options for utilizing UEFI secure boot? Do I need a MSFT-signed shim or grub? Any special changes required for Xen kernel
(signing?) or has that been done?

Bill,

I guess in part it depends on what you mean by "utilizing UEFI secure boot". If you simply want to boot an unsigned Xen on a UEFI system with SecureBoot enabled, then grub would probably work. If you want to actually do the full SecureBoot thing -- where you have grub check Xen's signature and that of the kernel and initrd, you probably need a bit more.

Quoted 5 lines

Daniel,

Is there any good documentation on this? The Xen EFI guide
(https://wiki.xenproject.org/wiki/Xen_EFI) mentions the shim, but doesn't go into detail about how to sign a binary &c.

Unfortunately I do not know anything like that. As you said in general shim is supported. Sadly, it works only if you load xen.efi directly from EFI. __Upstream__ GRUB2 has not have support for shim yet. I am working on it (shim support via GRUB2 requires also some changes in Xen). I hope that I will have something which works before Xen conf in Budapest.

If you wish to use shim with xen.efi then you have to sign xen.efi and vmlinux with your key using sbsign or pesign. The process works in the same way like in case vmlinux alone. Of course you have to install your public key into MOK before enabling secure boot.

Quoted 8 lines
Quoted 1 line

Daniel

Yes, there are options in how this is achievable, and the solutions may be different.

We are targeting a secure boot chain from UEFI fw to .ko, using same signing. In our case would skip shim and reduce attack surface, but it appears that the mechanisms 'out there' for passing pub key (cert) from UEFI db to Linux chainring require shim to do the work. Is that accurate? Does it have to be the case? I don't see why.

AIUI, if EFI secure boot is enabled then EFI verifies signatures of every loaded/executed PE file. Unfortunately, you are not able to use secure boot protocol directly to verify yourself PE's loaded from your app. So, this is one of reasons why shim was introduced. It exposes protocol which can be used by you to do verification.

Quoted 2 lines

For us, ideal case is :
UEFI fw -> (signed)GRUB2.efi->Multiboot2->Xen(signed .ko)

AFAICT, it is not possible. We should do following thing:

UEFI -> shim -> GRUB2 -> Multiboot2 -> Xen/Linux/etc.

UEFI will verify shim secure boot signature then shim will verify GRUB2 signature then GRUB2 will verify (with shim protocol) Xen signature and finally Xen will verify (with shim protocol) Linux kernel signature. Then your kernel can verify modules using whatever you want.

Quoted 1 line

I would be happy to work to help achieve this.

There is a chance that I will have something very raw at the beginning of June. If you wish to do tests drop me a line.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 79 lines · Daniel Kiper
Quoted 51 lines · Bill Jacobs (billjac)
Quoted 51 lines

-----Original Message-----
From: Daniel Kiper [mailto:[email protected]]
Sent: Monday, May 15, 2017 6:13 AM
To: Bill Jacobs (billjac) <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9

Hey,

CC-ing Xen-devel to spread some knowledge about the issue.

Quoted 22 lines · George Dunlap
Quoted 10 lines · Bill Jacobs (billjac)

Hi all

I gather that with 4.9, UEFI secure boot of Xen should be possible.

Is this true?

If so, what are the options for utilizing UEFI secure boot? Do I need a MSFT-signed shim or grub? Any special changes required for Xen kernel
(signing?) or has that been done?

Bill,

I guess in part it depends on what you mean by "utilizing UEFI secure boot". If you simply want to boot an unsigned Xen on a UEFI system with SecureBoot enabled, then grub would probably work. If you want to actually do the full SecureBoot thing -- where you have grub check Xen's signature and that of the kernel and initrd, you probably need a bit more.

Quoted 5 lines

Daniel,

Is there any good documentation on this? The Xen EFI guide
(https://wiki.xenproject.org/wiki/Xen_EFI) mentions the shim, but doesn't go into detail about how to sign a binary &c.

Unfortunately I do not know anything like that. As you said in general shim is supported. Sadly, it works only if you load xen.efi directly from EFI. __Upstream__ GRUB2 has not have support for shim yet. I am working on it (shim support via GRUB2 requires also some changes in Xen). I hope that I will have something which works before Xen conf in Budapest.

If you wish to use shim with xen.efi then you have to sign xen.efi and vmlinux with your key using sbsign or pesign. The process works in the same way like in case vmlinux alone. Of course you have to install your public key into MOK before enabling secure boot.

Quoted 8 lines
Quoted 1 line

Daniel

Yes, there are options in how this is achievable, and the solutions may be different.

We are targeting a secure boot chain from UEFI fw to .ko, using same signing. In our case would skip shim and reduce attack surface, but it appears that the mechanisms 'out there' for passing pub key (cert) from UEFI db to Linux chainring require shim to do the work. Is that accurate? Does it have to be the case? I don't see why.

AIUI, if EFI secure boot is enabled then EFI verifies signatures of every loaded/executed PE file. Unfortunately, you are not able to use secure boot protocol directly to verify yourself PE's loaded from your app. So, this is one of reasons why shim was introduced. It exposes protocol which can be used by you to do verification.

Quoted 2 lines

For us, ideal case is :
UEFI fw -> (signed)GRUB2.efi->Multiboot2->Xen(signed .ko)

AFAICT, it is not possible. We should do following thing:

UEFI -> shim -> GRUB2 -> Multiboot2 -> Xen/Linux/etc.

UEFI will verify shim secure boot signature then shim will verify GRUB2 signature then GRUB2 will verify (with shim protocol) Xen signature and finally Xen will verify (with shim protocol) Linux kernel signature. Then your kernel can verify modules using whatever you want.

Quoted 4 lines
Quoted 1 line

I would be happy to work to help achieve this.

There is a chance that I will have something very raw at the beginning of June. If you wish to do tests drop me a line.

Hi Daniel,
is there any news on this? I would be interested in giving this a shot too.

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw

Hey Tamas,

Sorry for late reply. I was on vacation.

Quoted 1 line · Tamas K Lengyel

On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[email protected]> wrote:

[...]

Quoted 5 lines
Quoted 5 lines

UEFI will verify shim secure boot signature then shim will verify GRUB2 signature then GRUB2 will verify (with shim protocol) Xen signature and finally Xen will verify (with shim protocol) Linux kernel signature. Then your kernel can verify modules using whatever you want.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I would be happy to work to help achieve this.

There is a chance that I will have something very raw at the beginning of June. If you wish to do tests drop me a line.

Hi Daniel,
is there any news on this? I would be interested in giving this a shot too.

Please look at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00982.html

and at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00985.html

Attachments contain the same patches as above but rebased on latest GRUB2 and Xen git repositories.

Due to some travel I am going to restart work on this in the second half of September.

If you have any questions please drop me a line.

Daniel

Quoted 1 line

From 8458d7904886ca4bea059d103dac2ba50e53c13b Mon Sep 17 00:00:00 2001

From: Daniel Kiper <[email protected]>
Date: Sat, 8 Jul 2017 23:32:36 +0200
Subject: [PATCH] efi: Add EFI shim lock verifier

This is based on git://git.savannah.gnu.org/grub.git phcoder/verifiers branch.

Just an RFC.

TODO:
- disable the GRUB2 modules load/unload,
- disable the dangerous modules, e.g. iorw, memrw.

---
 grub-core/Makefile.core.def        |    6 +++
 grub-core/commands/efi/shim_lock.c |  100 ++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)
 create mode 100644 grub-core/commands/efi/shim_lock.c
grub-core/Makefile.core.def +6 -0
index 16c4d0e..c38e4a8 100644
@@ -905,6 +905,12 @@ module = {
 };
 
 module = {
+  name = shim_lock;
+  common = commands/efi/shim_lock.c;
+  enable = x86_64_efi;
+};
+
+module = {
   name = hdparm;
   common = commands/hdparm.c;
   common = lib/hexdump.c;
grub-core/commands/efi/shim_lock.c new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
1.7.10.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 30 lines · Daniel Kiper

Hey Tamas,

Sorry for late reply. I was on vacation.

Quoted 1 line · Tamas K Lengyel

On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[email protected]> wrote:

[...]

Quoted 5 lines
Quoted 5 lines

UEFI will verify shim secure boot signature then shim will verify GRUB2 signature then GRUB2 will verify (with shim protocol) Xen signature and finally Xen will verify (with shim protocol) Linux kernel signature. Then your kernel can verify modules using whatever you want.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I would be happy to work to help achieve this.

There is a chance that I will have something very raw at the beginning of June. If you wish to do tests drop me a line.

Hi Daniel,
is there any news on this? I would be interested in giving this a shot too.

Please look at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00982.html

and at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00985.html

Quoted 8 lines

Attachments contain the same patches as above but rebased on latest GRUB2 and Xen git repositories.

Due to some travel I am going to restart work on this in the second half of September.

If you have any questions please drop me a line.

Hi Daniel,
thanks for the update, I'll give it a shot today to set it up. In a somewhat related note, are you aware of any work on getting secure boot + UEFI working in a guest? There is a PoC patch on OpenXT
(https://github.com/OpenXT/xenclient-oe/pull/729) but was wondering if there are any parallel efforts ongoing.

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw
Quoted 40 lines · Tamas K Lengyel
Quoted 30 lines · Daniel Kiper

Hey Tamas,

Sorry for late reply. I was on vacation.

Quoted 1 line · Tamas K Lengyel

On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[email protected]> wrote:

[...]

Quoted 5 lines
Quoted 5 lines

UEFI will verify shim secure boot signature then shim will verify GRUB2 signature then GRUB2 will verify (with shim protocol) Xen signature and finally Xen will verify (with shim protocol) Linux kernel signature. Then your kernel can verify modules using whatever you want.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I would be happy to work to help achieve this.

There is a chance that I will have something very raw at the beginning of June. If you wish to do tests drop me a line.

Hi Daniel,
is there any news on this? I would be interested in giving this a shot too.

Please look at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00982.html

and at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00985.html

Quoted 8 lines

Attachments contain the same patches as above but rebased on latest GRUB2 and Xen git repositories.

Due to some travel I am going to restart work on this in the second half of September.

If you have any questions please drop me a line.

Quoted 6 lines

Hi Daniel,
thanks for the update, I'll give it a shot today to set it up. In a somewhat related note, are you aware of any work on getting secure boot + UEFI working in a guest? There is a PoC patch on OpenXT
(https://github.com/OpenXT/xenclient-oe/pull/729) but was wondering if there are any parallel efforts ongoing.

I do not follow this issue in detail. However, I suppose that if OVMF supports UEFI secure boot (well, QEMU has to enable SMM support too; I do not know does it work with Xen or not) then guest should work without any issue. Just guessing...

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#9 lore raw
Quoted 48 lines · Daniel Kiper
Quoted 40 lines · Tamas K Lengyel
Quoted 30 lines · Daniel Kiper

Hey Tamas,

Sorry for late reply. I was on vacation.

Quoted 1 line · Tamas K Lengyel

On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[email protected]> wrote:

[...]

Quoted 5 lines
Quoted 5 lines

UEFI will verify shim secure boot signature then shim will verify GRUB2 signature then GRUB2 will verify (with shim protocol) Xen signature and finally Xen will verify (with shim protocol) Linux kernel signature. Then your kernel can verify modules using whatever you want.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I would be happy to work to help achieve this.

There is a chance that I will have something very raw at the beginning of June. If you wish to do tests drop me a line.

Hi Daniel,
is there any news on this? I would be interested in giving this a shot too.

Please look at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00982.html

and at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00985.html

Quoted 8 lines

Attachments contain the same patches as above but rebased on latest GRUB2 and Xen git repositories.

Due to some travel I am going to restart work on this in the second half of September.

If you have any questions please drop me a line.

Quoted 6 lines

Hi Daniel,
thanks for the update, I'll give it a shot today to set it up. In a somewhat related note, are you aware of any work on getting secure boot + UEFI working in a guest? There is a PoC patch on OpenXT
(https://github.com/OpenXT/xenclient-oe/pull/729) but was wondering if there are any parallel efforts ongoing.

Quoted 5 lines

I do not follow this issue in detail. However, I suppose that if OVMF supports UEFI secure boot (well, QEMU has to enable SMM support too; I do not know does it work with Xen or not) then guest should work without any issue. Just guessing...

Sure, was just wondering if you are aware of anyone looking at that.

In other news I was able to get your patches working and have been able to boot with Secure boot enabled as far as shim -> signed grub -> signed linux without initrd. If I boot a signed version of Xen from grub it goes as far as setup_efi_pci but then the system reboots without anything else being printed on the screen. I haven't been able to debug it any further yet.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw
Quoted 55 lines · Tamas K Lengyel
Quoted 48 lines · Daniel Kiper
Quoted 40 lines · Tamas K Lengyel
Quoted 30 lines · Daniel Kiper

Hey Tamas,

Sorry for late reply. I was on vacation.

Quoted 1 line · Tamas K Lengyel

On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[email protected]> wrote:

[...]

Quoted 5 lines
Quoted 5 lines

UEFI will verify shim secure boot signature then shim will verify GRUB2 signature then GRUB2 will verify (with shim protocol) Xen signature and finally Xen will verify (with shim protocol) Linux kernel signature. Then your kernel can verify modules using whatever you want.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I would be happy to work to help achieve this.

There is a chance that I will have something very raw at the beginning of June. If you wish to do tests drop me a line.

Hi Daniel,
is there any news on this? I would be interested in giving this a shot too.

Please look at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00982.html

and at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00985.html

Quoted 8 lines

Attachments contain the same patches as above but rebased on latest GRUB2 and Xen git repositories.

Due to some travel I am going to restart work on this in the second half of September.

If you have any questions please drop me a line.

Quoted 6 lines

Hi Daniel,
thanks for the update, I'll give it a shot today to set it up. In a somewhat related note, are you aware of any work on getting secure boot + UEFI working in a guest? There is a PoC patch on OpenXT
(https://github.com/OpenXT/xenclient-oe/pull/729) but was wondering if there are any parallel efforts ongoing.

Quoted 5 lines

I do not follow this issue in detail. However, I suppose that if OVMF supports UEFI secure boot (well, QEMU has to enable SMM support too; I do not know does it work with Xen or not) then guest should work without any issue. Just guessing...

Quoted 9 lines

Sure, was just wondering if you are aware of anyone looking at that.

In other news I was able to get your patches working and have been able to boot with Secure boot enabled as far as shim -> signed grub -> signed linux without initrd. If I boot a signed version of Xen from grub it goes as far as setup_efi_pci but then the system reboots without anything else being printed on the screen. I haven't been able to debug it any further yet.

Daniel,
just FYI the xen.mb.efi generated with your patches causes pesign to segfault:

cms_pe_common.c:generate_digest:198 PE section ".text" has invalid address Segmentation fault

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw
Quoted 67 lines · Tamas K Lengyel
Quoted 55 lines · Tamas K Lengyel
Quoted 48 lines · Daniel Kiper
Quoted 40 lines · Tamas K Lengyel
Quoted 30 lines · Daniel Kiper

Hey Tamas,

Sorry for late reply. I was on vacation.

Quoted 1 line · Tamas K Lengyel

On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[email protected]> wrote:

[...]

Quoted 5 lines
Quoted 5 lines

UEFI will verify shim secure boot signature then shim will verify GRUB2 signature then GRUB2 will verify (with shim protocol) Xen signature and finally Xen will verify (with shim protocol) Linux kernel signature. Then your kernel can verify modules using whatever you want.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I would be happy to work to help achieve this.

There is a chance that I will have something very raw at the beginning of June. If you wish to do tests drop me a line.

Hi Daniel,
is there any news on this? I would be interested in giving this a shot too.

Please look at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00982.html

and at

https://lists.xen.org/archives/html/xen-devel/2017-07/msg00985.html

Quoted 8 lines

Attachments contain the same patches as above but rebased on latest GRUB2 and Xen git repositories.

Due to some travel I am going to restart work on this in the second half of September.

If you have any questions please drop me a line.

Quoted 6 lines

Hi Daniel,
thanks for the update, I'll give it a shot today to set it up. In a somewhat related note, are you aware of any work on getting secure boot + UEFI working in a guest? There is a PoC patch on OpenXT
(https://github.com/OpenXT/xenclient-oe/pull/729) but was wondering if there are any parallel efforts ongoing.

Quoted 5 lines

I do not follow this issue in detail. However, I suppose that if OVMF supports UEFI secure boot (well, QEMU has to enable SMM support too; I do not know does it work with Xen or not) then guest should work without any issue. Just guessing...

Quoted 9 lines

Sure, was just wondering if you are aware of anyone looking at that.

In other news I was able to get your patches working and have been able to boot with Secure boot enabled as far as shim -> signed grub -> signed linux without initrd. If I boot a signed version of Xen from grub it goes as far as setup_efi_pci but then the system reboots without anything else being printed on the screen. I haven't been able to debug it any further yet.

Quoted 5 lines

Daniel,
just FYI the xen.mb.efi generated with your patches causes pesign to segfault:

cms_pe_common.c:generate_digest:198 PE section ".text" has invalid address Segmentation fault

Thank you for doing the tests. I am going to restart work on this next week and post next version of patches in October. I will try to fix all issues spotted by you. Stay tuned...

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#12 lore raw
In reply to Daniel Kiper

Hi
What is the status of creating a shim to abstract secure boot signing for Xen (to leverage MSFT 3rd party, e.g)? Thanks
-Bill

Quoted 91 lines

-----Original Message-----
From: Daniel Kiper [mailto:[email protected]]
Sent: Tuesday, May 16, 2017 4:05 AM
To: Bill Jacobs (billjac) <[email protected]>
Cc: [email protected]; [email protected]; xen- [email protected]
Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9

Quoted 35 lines · Bill Jacobs (billjac)
Quoted 35 lines

-----Original Message-----
From: Daniel Kiper [mailto:[email protected]]
Sent: Monday, May 15, 2017 6:13 AM
To: Bill Jacobs (billjac) <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9

Hey,

CC-ing Xen-devel to spread some knowledge about the issue.

Quoted 22 lines · George Dunlap
Quoted 10 lines · Bill Jacobs (billjac)

Hi all

I gather that with 4.9, UEFI secure boot of Xen should be possible.

Is this true?

If so, what are the options for utilizing UEFI secure boot? Do I need a MSFT-signed shim or grub? Any special changes required for Xen kernel
(signing?) or has that been done?

Bill,

I guess in part it depends on what you mean by "utilizing UEFI secure boot". If you simply want to boot an unsigned Xen on a UEFI system with SecureBoot enabled, then grub would probably work. If you want to actually do the full SecureBoot thing -- where you have grub check Xen's signature and that of the kernel and initrd, you probably need a bit more.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Daniel,

Is there any good documentation on this? The Xen EFI guide
(https://wiki.xenproject.org/wiki/Xen_EFI) mentions the shim, but doesn't go into detail about how to sign a binary &c.

Unfortunately I do not know anything like that. As you said in general shim is supported. Sadly, it works only if you load xen.efi directly

from EFI.

Quoted 4 lines
Quoted 4 lines

__Upstream__ GRUB2 has not have support for shim yet. I am working on it (shim support via GRUB2 requires also some changes in Xen). I hope that I will have something which works before Xen conf in Budapest.

Quoted 8 lines
Quoted 6 lines

If you wish to use shim with xen.efi then you have to sign xen.efi and vmlinux with your key using sbsign or pesign. The process works in the same way like in case vmlinux alone. Of course you have to install your public key into MOK before enabling secure boot.

Daniel

Yes, there are options in how this is achievable, and the solutions may be

different.

Quoted 5 lines

We are targeting a secure boot chain from UEFI fw to .ko, using same signing. In our case would skip shim and reduce attack surface, but it appears that the mechanisms 'out there' for passing pub key (cert) from UEFI db to Linux chainring require shim to do the work. Is that accurate? Does it

have to be the case? I don't see why.

AIUI, if EFI secure boot is enabled then EFI verifies signatures of every loaded/executed PE file. Unfortunately, you are not able to use secure boot protocol directly to verify yourself PE's loaded from your app. So, this is one of reasons why shim was introduced. It exposes protocol which can be used by you to do verification.

Quoted 2 lines

For us, ideal case is :
UEFI fw -> (signed)GRUB2.efi->Multiboot2->Xen(signed .ko)

AFAICT, it is not possible. We should do following thing:

UEFI -> shim -> GRUB2 -> Multiboot2 -> Xen/Linux/etc.

UEFI will verify shim secure boot signature then shim will verify GRUB2 signature then GRUB2 will verify (with shim protocol) Xen signature and finally Xen will verify (with shim protocol) Linux kernel signature. Then your kernel can verify modules using whatever you want.

Quoted 6 lines
Quoted 1 line

I would be happy to work to help achieve this.

There is a chance that I will have something very raw at the beginning of June. If you wish to do tests drop me a line.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#13 lore raw
Quoted 3 lines · Bill Jacobs (billjac)

Hi
What is the status of creating a shim to abstract secure boot signing for Xen (to leverage MSFT 3rd party, e.g)?

xen.efi works with shim itself out of the box. If you wish to use shim and GRUB2 to load Xen you have to look at these RFC patch series:
- https://lists.xen.org/archives/html/xen-devel/2017-07/msg00982.html
- https://lists.xen.org/archives/html/xen-devel/2017-07/msg00985.html

I am slowly going back to this work. So, I hope that it will be taken into Xen 4.11 or so.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel