Supporting UEFI secure boot in Debian
Hutchings started by reviewing how the secure boot technology works. On
systems with secure boot, the UEFI firmware is able to validate the
system's bootloader by checking its signature against a list of trusted
keys; it can also validate UEFI drivers and firmware updates. This
checking is intended to defend the system against persistent malware
by ensuring that the system's low-level software has not been tampered
with. Support for secure boot is mandatory for systems that will run
Windows, so all desktop systems sold since 2012 have it. It is possible to
build
in trust for multiple signing keys but, in practice, the one key that is
trusted by everybody is Microsoft's key.
To boot Linux on a system with secure boot enabled, the first stage bootloader must have a Microsoft signature; in the Linux world, that is usually the special "shim" utility. Distributors create their own signing key, which they then build into shim; that key is then used to verify the GRUB installation. GRUB, in turn, verifies the signature for the kernel image; the kernel must validate any modules that it loads. By checking for proper signatures at every stage of the boot process, the system can be protected against hostile software modifications.
Supporting secure boot requires some fundamental changes in how Linux systems work. Traditionally, the root account can run arbitrary code, but that cannot be allowed under secure boot; even root should be unable to fully take over the system. To keep that from happening, the module loader must check signatures on kernel modules. The "kexec" mechanism must be prevented from booting into an arbitrary, unsigned image. Various I/O devices that are capable of modifying arbitrary memory must be disabled. The hibernation mechanism must be disabled entirely, though future work could, by signing and verifying the hibernation image, make that work again. Debian will be using Matthew Garrett's patches that make these changes; the patches are still not upstream and may never be, though, since certain high-profile kernel developers dislike them.
The Debian way
The commonly-used approach of signing the kernel image creates some problems for Debian, though. The project's practice with signatures has been to sign metadata describing software, never the code itself. Debian does not want to put signing keys onto its "buildd" systems; those systems are distributed around the globe and present any number of ways in which the keys could be exposed. Debian is also committed to reproducible builds, which cannot depend on secrets (or they would no longer be reproducible).
As a result, Debian cannot automatically build signed kernel binaries in a single step. Instead, the process starts with the creation of an unsigned binary. The signature for that binary is then created offline and a second source package is created to contain it. A second-stage build then rebuilds the kernel binary and applies the signature to it, resulting in a new package with a fully signed kernel binary. As long as the build is truly reproducible, the signature will still apply to the recreated binary. This mechanism allows anybody to create a signed Debian kernel image — as long as it precisely matches the kernel that was created by Debian itself.
Some changes to the Debian Archive Kit (dak) software, which signs archive metadata, will be needed, since it now needs to be able to publish detached signatures too. It may be necessary to publish the signature without publishing the accompanying binary immediately; this could happen in response to an embargoed security issue, for example. There is a script that turns a tarball of EFI binaries (and kernel modules) into a tarball of signatures, which are then installed into the archive metadata. The source package for the initial build is changed to include this tarball, along with a preparation script used by the second-stage build.
Some might wonder whether Ubuntu had already done this sort of work. Ubuntu's solution doesn't work for Debian, though, for a number of reasons, starting with the fact that Ubuntu's package builder doesn't use dak. Ubuntu's signing script only covers EFI binaries, leaving modules unsigned; it also creates signed binaries directly instead of using the two-stage signing process that Debian requires. Ubuntu only supports the amd64 architecture; Debian wants to support all architectures where secure boot is relevant. One other little complication is that the Ubuntu and Debian kernel packages have diverged significantly over the last ten years. The two projects do share some of the utilities, though, including shim and the grub-signed bootloader.
What about the ARM architecture? The upstream kernel has EFI stub support
for both 32-bit and 64-bit ARM systems. Debian has out-of-tree securelevel
patches that work for arm64; other tools, including sbsigntool,
shim, and the GRUB EFI code, also work there. So it should be possible to
support arm64 systems under secure boot, at least. The smaller ARM systems
that feature secure boot are locked down and will only run Microsoft
software, but that should be less of a problem in the server space.
Julien Cristau stepped up briefly to talk about how signing keys will be managed as this whole thing goes into production. Once again, the Ubuntu example is only so helpful for Debian. Ubuntu has its own data center, under its control, with the result that it has relatively good security for its machines. Debian lacks this data center, depending instead on machines hosted in various places around the world; it can thus never have as good a handle on the security of those machines. Signing keys will need to be kept in a hardware token, such as a YubiKey device. Patches are in the works to make all of this work in a secure manner.
Where things stand
Hutchings came back to summarize the status of this work; the current state of affairs can also be found in the Debian bug tracker as bug #820036. The changes to dak are in progress, and can be expected soon. The shim package is done, and is in review; there is still a need to put together a signed GRUB build. The signed build for the kernel is ready to go, but a signed build for the fwupdate utility is not ready yet. The installer and live images are ready to work with signed binaries, as is the support to actually install it all. The target for this work is the Debian 9 ("Stretch") release, which goes into freeze in January. More information can be found on the Debian secure boot wiki page.
The first question from the audience had to do with the UEFI signing key: would it be possible to use a separate key and avoid the need for Microsoft's signature? There is some appeal to that approach, but it has a big disadvantage: users would would have to install the new key in their firmware. There are a lot of different firmware implementations out there, each of which has its own horrible interface for key installation. Creating documentation to get Debian users through that process would not be fun.
Why is Debian only coming out with secure boot support now? Hutchings responded that the project has wanted this support all along, but has obviously been slow in implementing it. There has been a lot of talk about how to do it, but nobody actually got the work done. As a result, it's still not possible to install Debian without disabling secure boot in the firmware. That is about to change, though, now that support for secure boot is almost ready.
The final question suggested that, if Debian were to continue to not support secure boot, that might force vendors to make the feature easier to do without. Hutchings's response there was a dry "it's still not the year of the Linux desktop"; he does not believe that Linux distributors can push desktop hardware vendors around in that way.
[Your editor thanks Kernel Recipes for supporting his travel to this event.]
Index entries for this article | |
---|---|
Security | Distribution security |
Security | Secure boot |
Conference | Kernel Recipes/2016 |
Posted Oct 10, 2016 15:33 UTC (Mon)
by rahvin (guest, #16953)
[Link]
Posted Oct 10, 2016 16:16 UTC (Mon)
by josh (subscriber, #17465)
[Link] (2 responses)
This seems like a misleading statement, especially in the context of buildd systems that build software for Debian.
The problem is *not* with keeping those systems secure from malicious attacks; if that were a problem, users couldn't count on the resulting packages.
The problem is that the information on those systems can't be kept *secret*. Too many people would have access to the signing keys.
Hence the solution of the Debian kernel maintainers creating the signatures offline, using keys on hardware crypto tokens.
Posted Oct 10, 2016 20:26 UTC (Mon)
by xtifr (guest, #143)
[Link]
Posted Oct 10, 2016 21:30 UTC (Mon)
by jcristau (subscriber, #41237)
[Link]
Posted Oct 10, 2016 21:58 UTC (Mon)
by micka (subscriber, #38720)
[Link] (6 responses)
> Instead, the process starts with the creation of an unsigned binary.
So one unsigned kernel package, the same as currently (?). Reproducible provided we can find all variation sources.
>The signature for that binary is then created offline and a second source package is created to contain it
So one second package. If the first was kernel-image_XXXX, this one would be kernel-image-sig_XXXX or whatever.
> A second-stage build then rebuilds the kernel binary and applies the signature to it, resulting in a new package with a fully signed kernel binary
I'm begining ot be a bit lost. This is a new package which source(?) are the other previous binary(?) packages?
>As long as the build is truly reproducible, the signature will still apply to the recreated binary.
So we have reproducibility provided the second package (signature) is reproducible?
(I'm sorry if there are so many question marks, those are the points that wasn't able to clear by myself)
Posted Oct 11, 2016 0:18 UTC (Tue)
by BenHutchings (subscriber, #37955)
[Link] (5 responses)
Same source package, linux. The reproducible builds project now shows it as unreproducible, but only because they now vary the source directory. We can make it insensitive to the source directory once gcc supports path remapping in the preprocessor. The second source package is linux-signed. It contains the detached signatures for all the binary packages that get signed. It's reproducible.
Posted Oct 11, 2016 22:18 UTC (Tue)
by st (guest, #96477)
[Link] (4 responses)
Posted Oct 11, 2016 22:23 UTC (Tue)
by BenHutchings (subscriber, #37955)
[Link] (3 responses)
Posted Oct 12, 2016 7:09 UTC (Wed)
by micka (subscriber, #38720)
[Link] (2 responses)
Posted Oct 12, 2016 7:25 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Oct 12, 2016 7:26 UTC (Wed)
by chirlu (guest, #89906)
[Link]
Posted Oct 14, 2016 3:02 UTC (Fri)
by giraffedata (guest, #1954)
[Link] (8 responses)
What is "support for"? Does it mean the system must refuse to run an unsigned boot loader? Or maybe that it must be possible for the user to configure it so?
Have there been any computers made since 2012 that can run both Windows and Debian, and if so, will they run Debian out of the box?
Posted Oct 14, 2016 12:33 UTC (Fri)
by tao (subscriber, #17563)
[Link] (7 responses)
My current laptop, purchased this spring, is a ThinkPad 13. Works perfectly with Debian out of the box (and seeing as it came installed with Windows I'm gonna assume that Windows works on it too). My collection of Intel NUCs work just fine with Debian out of the box. The ThinkPad X1 Carbon I have at the office works just fine with Debian. etc..
TLDR:
That it gives the option to use secure boot, no, yes, yes.
Posted Oct 14, 2016 15:17 UTC (Fri)
by giraffedata (guest, #1954)
[Link] (6 responses)
"Support," by the way, is used to mean half a dozen things in the computer world, most not consistent with the traditional dictionary definition of that word. One has to ask.
Posted Oct 14, 2016 17:03 UTC (Fri)
by zlynx (guest, #2285)
[Link] (5 responses)
On a brand new system you may need to boot Windows in order to reboot to firmware configuration because Fast Boot is on. If you can't get to options even then you can download software to directly edit EFI variables.
Posted Oct 14, 2016 17:20 UTC (Fri)
by giraffedata (guest, #1954)
[Link] (3 responses)
OK, I understand that. (But it's not what I meant when I asked about "out of the box.")
There was talk when UEFI secure boot was new that computers would not have that option, i.e. that Microsoft would not let its products run on machines that let the user disable it.
I am glad to hear it ended up this way. The world makes more sense now.
But this gets back to the "what's the point" area, depending on what exactly it means. If you can download and run software under Windows to directly edit EFI variables and turn off secure boot, then that's exactly what a virus would do.
Posted Oct 14, 2016 17:44 UTC (Fri)
by zlynx (guest, #2285)
[Link]
Posted Oct 14, 2016 19:40 UTC (Fri)
by jem (subscriber, #24231)
[Link]
On x86 you are able to disable Secure Boot, on ARM you are not. Both are requirements from Microsoft for Windows logo certification.
>But this gets back to the "what's the point" area, depending on what exactly it means. If you can download and run software under Windows to directly edit EFI variables and turn off secure boot, then that's exactly what a virus would do.
That's not possible. The firmware must be implemented so that "physical presence" is required to disable secure boot.
Posted Oct 17, 2016 17:43 UTC (Mon)
by pjones (subscriber, #31722)
[Link]
Posted Oct 31, 2016 19:08 UTC (Mon)
by JanC_ (guest, #34940)
[Link]
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
What is the 'reproducible' status of this one? Do we abandon the reproducibility?
Supporting UEFI secure boot in Debian
So one unsigned kernel package, the same as currently (?). Reproducible provided we can find all variation sources.
So one second package. If the first was kernel-image_XXXX, this one would be kernel-image-sig_XXXX or whatever.
What is the 'reproducible' status of this one? Do we abandon the reproducibility?
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
I've been trying to figure out UEFI secure boot since LWN started writing about it in 2011.
Supporting UEFI secure boot in Debian
Support for secure boot is mandatory for systems that will run Windows, so all desktop systems sold since 2012 have it.
Supporting UEFI secure boot in Debian
OK, then what is the point? If your computer came with Windows, but willing to run Debian once you installed it, and according to this article, Debian today does not spring from anything signed by Microsoft, then what is to stop a worm running on Windows from changing the boot loader to something malicious and running a compromised Windows?
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
First enter the firmware configuration and disable Secure Boot.
If you can't get to options even then you can download software to directly edit EFI variables
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian
Supporting UEFI secure boot in Debian