UEFI Secure Boot Xen 4.9

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

UEFI Secure Boot Xen 4.9

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?

 

Thanks

-Bill

 


_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: UEFI Secure Boot Xen 4.9

George Dunlap-5
On Wed, May 10, 2017 at 11:36 PM, Bill Jacobs (billjac)
<[hidden email]> wrote:
> 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.

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.

 -George

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: UEFI Secure Boot Xen 4.9

Daniel Kiper-2
Hey,

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

On Mon, May 15, 2017 at 10:42:23AM +0100, George Dunlap wrote:

> On Wed, May 10, 2017 at 11:36 PM, Bill Jacobs (billjac)
> <[hidden email]> wrote:
> > 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.
>
> 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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: UEFI Secure Boot Xen 4.9

Bill Jacobs (billjac)


> -----Original Message-----
> From: Daniel Kiper [mailto:[hidden email]]
> Sent: Monday, May 15, 2017 6:13 AM
> To: Bill Jacobs (billjac) <[hidden email]>; [hidden email]
> Cc: [hidden email]; [hidden email]
> Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9
>
> Hey,
>
> CC-ing Xen-devel to spread some knowledge about the issue.
>
> On Mon, May 15, 2017 at 10:42:23AM +0100, George Dunlap wrote:
> > On Wed, May 10, 2017 at 11:36 PM, Bill Jacobs (billjac)
> > <[hidden email]> wrote:
> > > 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.
> >
> > 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

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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: UEFI Secure Boot Xen 4.9

Daniel Kiper-2
On Mon, May 15, 2017 at 07:09:54PM +0000, Bill Jacobs (billjac) wrote:

> > -----Original Message-----
> > From: Daniel Kiper [mailto:[hidden email]]
> > Sent: Monday, May 15, 2017 6:13 AM
> > To: Bill Jacobs (billjac) <[hidden email]>; [hidden email]
> > Cc: [hidden email]; [hidden email]
> > Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9
> >
> > Hey,
> >
> > CC-ing Xen-devel to spread some knowledge about the issue.
> >
> > On Mon, May 15, 2017 at 10:42:23AM +0100, George Dunlap wrote:
> > > On Wed, May 10, 2017 at 11:36 PM, Bill Jacobs (billjac)
> > > <[hidden email]> wrote:
> > > > 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.
> > >
> > > 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
>
> 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.

> 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.

> 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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: [Xen-devel] UEFI Secure Boot Xen 4.9

Tamas K Lengyel
On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[hidden email]> wrote:

> On Mon, May 15, 2017 at 07:09:54PM +0000, Bill Jacobs (billjac) wrote:
>> > -----Original Message-----
>> > From: Daniel Kiper [mailto:[hidden email]]
>> > Sent: Monday, May 15, 2017 6:13 AM
>> > To: Bill Jacobs (billjac) <[hidden email]>; [hidden email]
>> > Cc: [hidden email]; [hidden email]
>> > Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9
>> >
>> > Hey,
>> >
>> > CC-ing Xen-devel to spread some knowledge about the issue.
>> >
>> > On Mon, May 15, 2017 at 10:42:23AM +0100, George Dunlap wrote:
>> > > On Wed, May 10, 2017 at 11:36 PM, Bill Jacobs (billjac)
>> > > <[hidden email]> wrote:
>> > > > 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.
>> > >
>> > > 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
>>
>> 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.
>
>> 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.
>
>> 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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: [Xen-devel] UEFI Secure Boot Xen 4.9

Daniel Kiper-2
Hey Tamas,

Sorry for late reply. I was on vacation.

On Tue, Aug 22, 2017 at 09:01:06PM -0600, Tamas K Lengyel wrote:
> On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[hidden email]> wrote:

[...]

> > 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.
> >
> >> 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

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xen.org/xen-users

0001-efi-Add-EFI-shim-lock-verifier.patch (4K) Download Attachment
xen_mb2_efi_sb_rfc_rebase_20170829.tgz (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Xen-devel] UEFI Secure Boot Xen 4.9

Tamas K Lengyel
On Tue, Aug 29, 2017 at 2:01 PM, Daniel Kiper <[hidden email]> wrote:

> Hey Tamas,
>
> Sorry for late reply. I was on vacation.
>
> On Tue, Aug 22, 2017 at 09:01:06PM -0600, Tamas K Lengyel wrote:
>> On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[hidden email]> wrote:
>
> [...]
>
>> > 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.
>> >
>> >> 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.
>

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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: [Xen-devel] UEFI Secure Boot Xen 4.9

Daniel Kiper-2
On Wed, Aug 30, 2017 at 10:16:23AM -0600, Tamas K Lengyel wrote:

> On Tue, Aug 29, 2017 at 2:01 PM, Daniel Kiper <[hidden email]> wrote:
> > Hey Tamas,
> >
> > Sorry for late reply. I was on vacation.
> >
> > On Tue, Aug 22, 2017 at 09:01:06PM -0600, Tamas K Lengyel wrote:
> >> On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[hidden email]> wrote:
> >
> > [...]
> >
> >> > 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.
> >> >
> >> >> 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.
> >
>
> 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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: [Xen-devel] UEFI Secure Boot Xen 4.9

Tamas K Lengyel
On Mon, Sep 4, 2017 at 6:40 AM, Daniel Kiper <[hidden email]> wrote:

> On Wed, Aug 30, 2017 at 10:16:23AM -0600, Tamas K Lengyel wrote:
>> On Tue, Aug 29, 2017 at 2:01 PM, Daniel Kiper <[hidden email]> wrote:
>> > Hey Tamas,
>> >
>> > Sorry for late reply. I was on vacation.
>> >
>> > On Tue, Aug 22, 2017 at 09:01:06PM -0600, Tamas K Lengyel wrote:
>> >> On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[hidden email]> wrote:
>> >
>> > [...]
>> >
>> >> > 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.
>> >> >
>> >> >> 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.
>> >
>>
>> 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...
>

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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: [Xen-devel] UEFI Secure Boot Xen 4.9

Tamas K Lengyel
On Tue, Sep 5, 2017 at 12:26 PM, Tamas K Lengyel
<[hidden email]> wrote:

> On Mon, Sep 4, 2017 at 6:40 AM, Daniel Kiper <[hidden email]> wrote:
>> On Wed, Aug 30, 2017 at 10:16:23AM -0600, Tamas K Lengyel wrote:
>>> On Tue, Aug 29, 2017 at 2:01 PM, Daniel Kiper <[hidden email]> wrote:
>>> > Hey Tamas,
>>> >
>>> > Sorry for late reply. I was on vacation.
>>> >
>>> > On Tue, Aug 22, 2017 at 09:01:06PM -0600, Tamas K Lengyel wrote:
>>> >> On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[hidden email]> wrote:
>>> >
>>> > [...]
>>> >
>>> >> > 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.
>>> >> >
>>> >> >> 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.
>>> >
>>>
>>> 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...
>>
>
> 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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: [Xen-devel] UEFI Secure Boot Xen 4.9

Daniel Kiper-2
On Mon, Sep 18, 2017 at 11:24:15AM -0400, Tamas K Lengyel wrote:

> On Tue, Sep 5, 2017 at 12:26 PM, Tamas K Lengyel
> <[hidden email]> wrote:
> > On Mon, Sep 4, 2017 at 6:40 AM, Daniel Kiper <[hidden email]> wrote:
> >> On Wed, Aug 30, 2017 at 10:16:23AM -0600, Tamas K Lengyel wrote:
> >>> On Tue, Aug 29, 2017 at 2:01 PM, Daniel Kiper <[hidden email]> wrote:
> >>> > Hey Tamas,
> >>> >
> >>> > Sorry for late reply. I was on vacation.
> >>> >
> >>> > On Tue, Aug 22, 2017 at 09:01:06PM -0600, Tamas K Lengyel wrote:
> >>> >> On Tue, May 16, 2017 at 5:04 AM, Daniel Kiper <[hidden email]> wrote:
> >>> >
> >>> > [...]
> >>> >
> >>> >> > 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.
> >>> >> >
> >>> >> >> 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.
> >>> >
> >>>
> >>> 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...
> >>
> >
> > 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

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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: UEFI Secure Boot Xen 4.9

Bill Jacobs (billjac)
In reply to this post by Daniel Kiper-2
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

> -----Original Message-----
> From: Daniel Kiper [mailto:[hidden email]]
> Sent: Tuesday, May 16, 2017 4:05 AM
> To: Bill Jacobs (billjac) <[hidden email]>
> Cc: [hidden email]; [hidden email]; xen-
> [hidden email]
> Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9
>
> On Mon, May 15, 2017 at 07:09:54PM +0000, Bill Jacobs (billjac) wrote:
> > > -----Original Message-----
> > > From: Daniel Kiper [mailto:[hidden email]]
> > > Sent: Monday, May 15, 2017 6:13 AM
> > > To: Bill Jacobs (billjac) <[hidden email]>;
> > > [hidden email]
> > > Cc: [hidden email]; [hidden email]
> > > Subject: Re: [Xen-users] UEFI Secure Boot Xen 4.9
> > >
> > > Hey,
> > >
> > > CC-ing Xen-devel to spread some knowledge about the issue.
> > >
> > > On Mon, May 15, 2017 at 10:42:23AM +0100, George Dunlap wrote:
> > > > On Wed, May 10, 2017 at 11:36 PM, Bill Jacobs (billjac)
> > > > <[hidden email]> wrote:
> > > > > 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.
> > > >
> > > > 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
> >
> > 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.
>
> > 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.
>
> > 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-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: UEFI Secure Boot Xen 4.9

Daniel Kiper-2
On Thu, Oct 12, 2017 at 05:03:13PM +0000, Bill Jacobs (billjac) wrote:
> 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-users mailing list
[hidden email]
https://lists.xen.org/xen-users