]> code.delx.au - refind/blob - docs/refind/secureboot.html
f93e9273a9d3bdc1513284db6d46a39fb49c35e2
[refind] / docs / refind / secureboot.html
1 <?xml version="1.0" encoding="utf-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
5 <html xmlns="http://www.w3.org/1999/xhtml">
6 <head>
7 <title>The rEFInd Boot Manager: Managing Secure Boot</title>
8 <link href="../Styles/styles.css" rel="stylesheet" type="text/css" />
9 </head>
10
11 <body>
12 <h1>The rEFInd Boot Manager:<br />Managing Secure Boot</h1>
13
14 <p class="subhead">by Roderick W. Smith, <a
15 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
16
17 <p>Originally written: 11/13/2012; last Web page update:
18 3/18/2013, referencing rEFInd 0.6.8</p>
19
20
21 <p>I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!</p>
22
23 <table border="1">
24 <tr>
25 <td>Donate $1.00</td>
26 <td>Donate $2.50</td>
27 <td>Donate $5.00</td>
28 <td>Donate $10.00</td>
29 <td>Donate another value</td>
30 </tr>
31 <tr>
32 <td><form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
33 <input type="hidden" name="cmd" value="_xclick">
34 <input type="hidden" name="business" value="rodsmith@rodsbooks.com">
35 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
36 <input type="hidden" name="currency_code" value="USD">
37 <input type="hidden" name="amount" value="1.00">
38 <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
39 </form>
40
41 </td>
42 <td><form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
43 <input type="hidden" name="cmd" value="_xclick">
44 <input type="hidden" name="business" value="rodsmith@rodsbooks.com">
45 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
46 <input type="hidden" name="currency_code" value="USD">
47 <input type="hidden" name="amount" value="2.50">
48 <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
49 </form>
50
51 </td>
52 <td><form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
53 <input type="hidden" name="cmd" value="_xclick">
54 <input type="hidden" name="business" value="rodsmith@rodsbooks.com">
55 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
56 <input type="hidden" name="currency_code" value="USD">
57 <input type="hidden" name="amount" value="5.00">
58 <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
59 </form>
60
61 </td>
62 <td><form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
63 <input type="hidden" name="cmd" value="_xclick">
64 <input type="hidden" name="business" value="rodsmith@rodsbooks.com">
65 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
66 <input type="hidden" name="currency_code" value="USD">
67 <input type="hidden" name="amount" value="10.00">
68 <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
69 </form>
70
71 </td>
72 <td>
73 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
74 <input type="hidden" name="cmd" value="_donations">
75 <input type="hidden" name="business" value="rodsmith@rodsbooks.com">
76 <input type="hidden" name="lc" value="US">
77 <input type="hidden" name="no_note" value="0">
78 <input type="hidden" name="currency_code" value="USD">
79 <input type="hidden" name="item_name" value="rEFInd Boot Manager">
80 <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest">
81 <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
82 <img alt="Donate with PayPal" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
83 </form>
84 </td></tr>
85 </table>
86
87 <hr />
88
89 <p>This page is part of the documentation for the rEFInd boot manager. If a Web search has brought you here, you may want to start at the <a href="index.html">main page.</a></p>
90
91 <hr />
92
93 <p class="sidebar"><b>Note:</b> My <a href="http://www.rodsbooks.com/efi-bootloaders/">Managing EFI Boot Loaders for Linux</a> Web page includes a much more detailed description of Secure Boot in its <a href="http://www.rodsbooks.com/efi-bootloaders/secureboot.html">Dealing with Secure Boot</a> sub-page. You should consult this page if you want to disable Secure Boot, generate your own keys, or perform other such tasks.</p>
94
95 <div class="navbar">
96
97 <h4 class="tight">Contents</h4>
98
99 <ul>
100
101 <li class="tight"><a href="#basic">Basic Issues</li>
102
103 <li class="tight"><a href="#installation">Installation Issues</a></li>
104
105 <li class="tight"><a href="#mok">Managing Your MOKs</a></li>
106
107 <li class="tight"><a href="#caveats">Secure Boot Caveats</a></li>
108
109 </ul>
110
111 </div>
112
113 <p>If you're using a computer that supports Secure Boot, you may run into extra complications. This feature is intended to make it difficult for malware to insert itself early into the computer's boot process. Unfortunately, it also complicates multi-boot configurations such as those that rEFInd is intended to manage. This page describes some <a href="#basic">secure boot basics</a> and two specific aspects of rEFInd and its interactions with Secure Boot: <a href="#installation">installation issues</a> and <a href="#mok">MOK management.</a> It concludes with a look at <a href="#caveats">known bugs and limitations</a> in rEFInd's Secure Boot features.</p>
114
115 <a name="basic">
116 <h2>Basic Issues</h2>
117 </a>
118
119 <p class="sidebar"><b>Note:</b> You don't <i>have to</i> use Secure Boot.
120 If you don't want it, you can <a
121 href="http://www.rodsbooks.com/efi-bootloaders/secureboot.html#disable">disable
122 it,</a> at least on <i>x</i>86-64 PCs. If an ARM-based computer ships with
123 Windows 8, this isn't an option for it. Unfortunately, the shim software
124 described on this page currently supports only <i>x</i>86-64, not
125 <i>x</i>86 or ARM.</p>
126
127 <p>Through 2012, it became obvious that Secure Boot would be a feature that was controlled, to a large extent, by Microsoft. This is because Microsoft requires that non-server computers that display Windows 8 logos ship with Secure Boot enabled. As a practical matter, this also means that such computers ship with Microsoft's keys in their firmware. In the absence of an industry-standard body to manage the signing of Secure Boot keys, this means that Microsoft's key is the only one that's more-or-less guaranteed to be installed on the computer, thus blocking the ability to boot any OS that lacks a boot path through Microsoft's signing key.</p>
128
129 <p class="sidebar"><b>Note:</b> The <a href="http://www.linuxfoundation.org">Linux Foundation</a> has released a signed version of their <a href="http://blog.hansenpartnership.com/linux-foundation-secure-boot-system-released/">PreBootloader,</a> which functions something like shim; however, where shim requires signing all binaries that don't already have valid Secure Boot keys and managing a small number of keys, PreBootloader requires registering every authorized binary. I haven't had the chance to revise this documentation to cover PreBootloader, but you may want to use it instead of shim if you want to manage a small number of binaries that are not already signed with a Secure Boot key, MOK, or a key built into a signed version of shim.</p>
130
131 <p>Fortunately, Microsoft will sign third-party binaries with their key&mdash;or more precisely, with a key that Microsoft uses to sign third-party binaries. (Microsoft uses another key to sign its own binaries, and some devices, such as the Microsoft Surface tablet, lack the third-party Microsoft key.) A payment of $99 to Verisign enables a software distributor to sign as many binaries as desired. Red Hat (Fedora), Novell (SUSE), and Canonical (Ubuntu) have all announced plans to take advantage of this system. Unfortunately, using a third-party signing service is an awkward solution for open source software. In fact, for this very reason Red Hat has developed a program that it calls <i>shim</i> that essentially shifts the Secure Boot "train" from Microsoft's proprietary "track" to one that's more friendly to open source authors. Shim is signed by Microsoft and redirects the boot process to another boot loader that can be signed with keys that the distribution maintains and that are built into shim. Fedora 18 also uses this system. SUSE has announced that it will use the same system, as does Ubuntu with version 12.10 and later. SUSE has contributed to the shim approach by providing expansions to shim that support a set of keys that users can maintain themselves. These keys are known as Machine Owner Keys (MOKs), and managing them is described later, in <a href="#mok">Managing MOKs.</a> To reiterate, then, there are potentially three ways to sign a binary that will get it launched on a computer that uses shim:</p>
132
133 <ul>
134
135 <li><b>Secure Boot keys</b>&mdash;These keys are managed by the EFI
136 firmware. In a default configuration, Microsoft is the only party
137 that's more-or-less guaranteed to be able to sign boot loaders with
138 these keys; however, it's possible to <a
139 href="http://www.rodsbooks.com/efi-bootloaders/secureboot.html#add_keys">replace
140 Microsoft's keys with your own,</a> in order to take full control of
141 Secure Boot on your computer. The trouble is that this process is
142 tedious and varies in details from one computer to another.</li>
143
144 <li><b>Shim's built-in keys</b>&mdash;It's possible, but not necessary, to
145 compile shim with a built-in public key. Its private counterpart can
146 then be used to sign binaries. In practice, this key type is limited in
147 utility; it's likely to be used by distribution maintainers to sign
148 their own version of GRUB and the Linux kernels that it launches,
149 nothing more. On the plus side, shim's keys require little or no
150 maintenance by users. One potential complication is that if you swap
151 out one shim binary for another, its built-in key may change, which
152 means that the replacement shim might no longer launch its follow-on
153 boot loader.</li>
154
155 <li><b>MOKs</b>&mdash;Versions 0.2 and later of shim support MOKs, which
156 give you the ability to add your own keys to the computer. If you want
157 to install multiple Linux distributions in Secure Boot mode, MOKs are
158 likely to be helpful. They're vital if you want to launch kernels you
159 compile yourself or use boot managers or boot loaders other than those
160 provided by your distribution.</li>
161
162 </ul>
163
164 <p>All three key types are the same in form&mdash;shim's built-in keys and MOKs are both generated using the same tools used to generate Secure Boot keys. The keys can be generated with the common <tt>openssl</tt> program, but signing EFI binaries requires a rarer program called <tt>sbsign</tt> or <tt>pesign</tt>. Although it's theoretically possible to use rEFInd without signing your own binaries, this is not yet practical, because distributions don't yet provide their own signed binaries or the public MOK files you must have to enroll their keys. With any luck this will change in 2013. At the very least, many distributions will begin supporting Secure Boot in the near future, and with any luck they'll include their public MOKs for use with other distributions' versions of shim.</p>
165
166 <p>Because shim and MOK are being supported by several of the major players in the Linux world, I've decided to do the same with rEFInd. Beginning with version 0.5.0, rEFInd can communicate with the shim system to authenticate boot loaders. If a boot loader has been signed by a valid UEFI Secure Boot key, a valid shim key, or a valid MOK key, rEFInd will launch it. rEFInd will also launch unsigned boot loaders or those with invalid signatures <i>if</i> Secure Boot is disabled in or unsupported by the firmware. (If that's your situation, you needn't bother reading this page.)</p>
167
168 <p>Version 0.5.0 ships signed with my own keys, and I provide the public version of this key with the rEFInd package. This can help simplify setup, since you needn't generate your own keys to get rEFInd working; however, without public keys for the boot loaders that rEFInd launches, you'll still need to generate keys and sign your boot loaders, as described in the <a href="#mok">Managing Your MOKs</a> section.</p>
169
170 <a name="installation">
171 <h2>Installation Issues</h2>
172 </a>
173
174 <p>A working Secure Boot installation of rEFInd involves at least three programs, and probably four or more, each of which must be installed in a specific way:</p>
175
176 <ul>
177
178 <li><b>shim</b>&mdash;You can download a version of shim signed with Microsoft's Secure Boot key <a href="http://www.codon.org.uk/~mjg59/shim-signed/">here.</a> This version (created by shim's developer, former Red Hat employee Matthew J. Garrett) includes a shim key that's used by nothing but the <tt>MokManager.efi</tt> program that also ships with the program. Thus, to use this version of shim, you must use MOKs. Fedora 18's version of shim includes its own key but can also use MOKs; but to use it with rEFInd, you must still enroll rEFInd's MOK. Ubuntu 12.10 ships with its own shim, but that version doesn't support MOKs and so is useless for launching rEFInd. Future versions of SUSE and probably other distributions will come with their own variants of shim, most of which will no doubt support their own shim keys as well as MOKs. You should install shim just as you would install other EFI boot loaders, as described <a href="http://www.rodsbooks.com/efi-bootloaders/installation.html">here.</a> For use in launching rEFInd, it makes sense to install <tt>shim.efi</tt> in <tt>EFI/refind</tt> on your ESP, although of course this detail is up to you.</li>
179
180 <li><b>MokManager</b>&mdash;This program is included with shim 0.2 and later. It presents a crude user interface for managing MOKs, and it's launched by shim if shim can't find its default boot loader (generally <tt>grubx64.efi</tt>) or if that program isn't properly signed. In principle, this program could be signed with a Secure Boot key or a MOK, but the binary in Garrett's shim 0.2 is signed with a shim key, and I expect that versions distributed with most Linux distributions will also be signed by their respective shim keys. This program should reside in the same directory as <tt>shim.efi</tt>, under the name <tt>MokManager.efi</tt>. Although you could theoretically do without MokManager, in practice you'll need it at least temporarily to install the MOK with which rEFInd is signed.</li>
181
182 <li><b>rEFInd</b>&mdash;Naturally, you need rEFInd. Because shim is hard-coded to launch a program called <tt>grubx64.efi</tt>, you must install rEFInd using that name and to the same directory in which <tt>shim.efi</tt> resides. In theory, rEFInd could be signed with a Secure Boot key, a shim key, or a MOK; however, because Microsoft won't sign binaries distributed under the GPLv3, I can't distribute a version of rEFInd signed with Microsoft's Secure Boot key; and as I don't have access to the private shim keys used by any distribution, I can't distribute a rEFInd binary signed by them. (If distributions begin including rEFInd in their package sets, though, such distribution-provided binaries could be signed with the distributions' shim keys.) Thus, rEFInd will normally be signed by a MOK. Beginning with version 0.5.0, rEFInd binaries that I provide are signed by me. Beginning with version 0.5.1, the installation script provides an option to sign the rEFInd binary with your own key, provided the necessary support software is installed.</li>
183
184 <li><b>Your boot loaders and kernels</b>&mdash;Your OS boot loaders, and perhaps your Linux kernels, must be signed. They can be signed with any of the three key types. Indeed, your system may have a mix of all three types&mdash;a Windows 8 boot loader will most likely be signed with Microsoft's Secure Boot key, GRUB and kernels provided by most distributions will be signed with their own shim keys, and if you use your own locally-compiled kernel or a boot loader from an unusual source you may need to sign it with a MOK. Aside from signing, these files can be installed in exactly the same way as if your computer were not using Secure Boot.</li>
185
186 </ul>
187
188 <p>Because of variables such as which version of shim you're using and whether you're installing a pre-signed version of rEFInd or want to sign it yourself, I can't provide an absolutely complete procedure for installing rEFInd to work with Secure Boot. Broadly speaking, though, the procedure should be something like this:</p>
189
190 <ol>
191
192 <li>Boot the computer. This can be a challenge in and of itself. You may
193 need to use a Secure Boot&ndash;enabled Linux emergency disc,
194 temporarily disable Secure Boot, or do the work from Windows.</li>
195
196 <li><a href="getting.html">Download rEFInd</a> in binary form (the binary
197 zip or CD-R image file). If you download the binary zip file, unzip it;
198 if you get the CD-R image file, burn it to a CD-R and mount it.</li>
199
200 <li>Download shim from <a
201 href="http://www.codon.org.uk/~mjg59/shim-signed/">Matthew J. Garrett's
202 download site</a> or from your distribution. (Don't use Ubuntu 12.10's
203 version, though; as noted earlier, it's inadequate for use with
204 rEFInd.) Fedora 18 ships with a signed shim, but I've not yet tested
205 it.</li>
206
207 <p class="sidebar"><b>Tip:</b> If you're running Linux, you can save some effort by using the <tt>install.sh</tt> script with its <tt>--shim <tt class="variable">/path/to/shim.efi</tt></tt> option rather than installing manually, as in steps 4&ndash;6 of this procedure. If you've installed <tt>openssl</tt> and <tt>sbsign</tt>, using <tt>--localkeys</tt> will generate local signing keys and re-sign the rEFInd binaries with your own key, too. You can then use <tt>sbsign</tt> and the keys in <tt>/etc/refind.d/keys</tt> to sign your kernels or boot loaders.</p>
208
209 <li>Copy the <tt>shim.efi</tt> and <tt>MokManager.efi</tt> binaries to the
210 directory you intend to use for rEFInd&mdash;for instance,
211 <tt>EFI/refind</tt> on the ESP.</li>
212
213 <li>Follow the installation instructions for rEFInd on the <a
214 href="installing.html">Installing rEFInd</a> page; however, give rEFInd
215 the filename <tt>grubx64.efi</tt> and register <tt>shim.efi</tt> with
216 the EFI by using <tt>efibootmgr</tt> in Linux or <tt>bcdedit</tt> in
217 Windows. Be sure that rEFInd (as <tt>grubx64.efi</tt>),
218 <tt>shim.efi</tt>, and <tt>MokManager.efi</tt> all reside in the same
219 directory.</li>
220
221 <li>Copy the <tt>refind.cer</tt> file from the rEFInd package to your ESP,
222 ideally to a location with few other files. (The rEFInd installation
223 directory should work fine.)</li>
224
225 <li>Reboot. With any luck, you'll see a simple text-mode user interface
226 with a label of <tt>Shim UEFI key management</tt>. This is the
227 MokManager program, which shim launched when rEFInd failed verification
228 because its key is not yet enrolled.</li>
229
230 <li>Press your down arrow key and press Enter to select <tt>Enroll key from
231 disk</tt>. The screen will clear and prompt you to select a key, as
232 shown here:</li>
233
234 <br /><IMG SRC="MokManager1.png" ALIGN="CENTER" WIDTH="676"
235 HEIGHT="186" ALT="MokManager's user interface is crude but effective."
236 BORDER=2> <br />
237
238 <li>Each of the lines with a long awkward string represents a disk
239 partition. Select one and you'll see a list of files. Continue
240 selecting subdirectories until you find the <tt>refind.cer</tt> file
241 you copied to the ESP earlier. (Note that the long lines can wrap
242 and hide valid entries on the next line, so you may need to select
243 a disk whose entry is masked by another one!)</li>
244
245 <li>Select <tt>refind.cer</tt>. You can type <tt class="userinput">1</tt>
246 to view the certificate's details if you like, or skip that and type
247 <tt class="userinput">0</tt> to enroll the key.</li>
248
249 <li>Back out of any directories you entered and return to the MokManager
250 main menu.</li>
251
252 <li>Select <tt>Continue boot</tt> at the main menu.</li>
253
254 </ol>
255
256 <p>At this point the computer may boot into its default OS, reboot, or perhaps even hang. When you reboot it, though, rEFInd should start up in Secure Boot mode. (You can verify this by selecting the <i>About rEFInd</i> tool in the main menu. Check the <i>Platform</i> item in the resulting screen; it should verify that Secure Boot is active.) You should now be able to launch any boot loader signed with a key recognized by the firmware or by shim (including any MOKs you've enrolled). If you want to manage keys in the future, rEFInd displays a new icon in the second (tools) row you can use to launch MokManager. (This icon appears by default if MokManager is installed, but if you edit <tt>showtools</tt> in <tt>refind.conf</tt>, you must be sure to include <tt>mok_tool</tt> as an option in order to gain access to it.)</p>
257
258 <p>If you're using Ubuntu 12.10, you can't use its version of shim, but you can replace it with Garrett's shim. If you do so, though, you'll have to add Ubuntu's public key as a MOK, at least if you intend to launch Ubuntu's version of GRUB or launch Ubuntu-provided signed kernels. Ubuntu's public key is available in the <a href="http://archive.ubuntu.com/ubuntu/pool/main/s/shim/shim_0~20120906.bcd0a4e8-0ubuntu4.debian.tar.gz">shim_0~20120906.bcd0a4e8-0ubuntu4.debian.tar.gz</a> tarball, as <tt>canonical-uefi-ca.der</tt>. (The filename extensions <tt>.cer</tt> and <tt>.der</tt> are interchangeable for most purposes.) I've also included this key with rEFInd, in the <tt>refind/keys</tt> subdirectory of its package file. To use this key, copy it to your ESP and enroll it with MokManager. See <a href="http://falstaff.agner.ch/2012/12/12/secure-boot-implementation-of-ubuntu-12-10-quantal-quetzal/">this blog post</a> for further details on Ubuntu 12.10's handling of Secure Boot. In principle, you should be able to use shim 0.2 or later from future distributions that include it; but you must be sure that whatever you use supports MokManager.</p>
259
260 <a name="mok">
261 <h2>Managing Your MOKs</h2>
262 </a>
263
264 <p>The preceding instructions provided the basics of getting rEFInd up and running, including using MokManager to enroll a MOK on your computer. If you need to sign binaries, though, you'll have to use additional tools. The OpenSSL package provides the cryptographic tools necessary, but actually signing EFI binaries requires additional software. Two packages for this are available: <tt>sbsigntool</tt> and <tt>pesign</tt>. Both are available in binary form from <a href="https://build.opensuse.org/project/show?project=home%3Ajejb1%3AUEFI">this OpenSUSE Build Service (OBS)</a> repository. The following procedure uses <tt>sbsigntool</tt>. To sign your own binaries, follow these steps (you can skip the first five steps if you've used <tt>install.sh</tt>'s <tt>--localkeys</tt> option):</p>
265
266 <ol>
267
268 <li>If it's not already installed, install OpenSSL on your computer. (It
269 normally comes in a package called <tt>openssl</tt>.)</li>
270
271 <li>If you did <i>not</i> re-sign your rEFInd binaries with
272 <tt>install.sh</tt>'s <tt>--localkeys</tt> option, type the following
273 two commands to generate your public and private keys:
274
275 <pre class="listing">
276 $ <tt class="userinput">openssl req -new -x509 -newkey rsa:2048 -keyout refind_local.key \
277 -out refind_local.crt -nodes -days 3650 -subj "/CN=Your Name/"</tt>
278 $ <tt class="userinput">openssl x509 -in refind_local.crt -out refind_local.cer -outform DER</tt>
279 </pre>
280
281 Change <tt>Your Name</tt> to your own name or other identifying
282 characteristics, and adjust the certificate's time span (set via
283 <tt>-days</tt>) as you see fit. If you omit the <tt>-nodes</tt> option,
284 the program will prompt you for a passphrase for added security.
285 Remember this, since you'll need it to sign your binaries. The result
286 is a private key file (<tt>refind_local.key</tt>), which is highly
287 sensitive since it's required to sign binaries, and two public keys
288 (<tt>refind_local.crt</tt> and <tt>refind_local.cer</tt>), which can be
289 used to verify signed binaries' authenticity. The two public key files
290 are equivalent, but are used by different
291 tools&mdash;<tt>sbsigntool</tt> uses <tt>refind_local.crt</tt> to sign
292 binaries, but MokManager uses <tt>refind_local.cer</tt> to enroll the
293 key. If you used <tt>install.sh</tt>'s <tt>--localkeys</tt> option,
294 this step is unnecessary, since these keys have already been created
295 and are stored in <tt>/etc/refind.d/keys</tt>.</li>
296
297 <li>Copy the three key files to a secure location and adjust permissions
298 such that only you can read <tt>refind_local.key</tt>. You'll need
299 these keys to sign future binaries, so don't discard them.</li>
300
301 <li>Copy the <tt>refind_local.cer</tt> file to your ESP, ideally to a
302 location with few other files. (MokManager's user interface becomes
303 unreliable when browsing directories with lots of files.)</li>
304
305 <li>Download and install the <tt>sbsigntool</tt> package. Binary links for
306 various distributions are available from the <a
307 href="https://build.opensuse.org/package/show?package=sbsigntools&project=home%3Ajejb1%3AUEFI">OpenSUSE
308 Build Service</a>, or you can obtain the source code by typing <tt
309 class="userinput">git clone
310 git://kernel.ubuntu.com/jk/sbsigntool</tt>.</li>
311
312 <li>Sign your binary by typing <tt class="userinput">sbsign --key
313 refind_local.key --cert refind_local.crt --output <tt
314 class="variable">binary-signed.efi binary.efi</tt></tt>, adjusting the
315 paths to the keys and the binary names.</li>
316
317 <li>Copy your signed binary to a suitable location on the ESP for rEFInd to
318 locate it. Be sure to include any support files that it needs,
319 too.</li>
320
321 <li>Check your <tt>refind.conf</tt> file to ensure that the
322 <tt>showtools</tt> option is either commented out or includes
323 <tt>mok_tool</tt> among its options.</li>
324
325 <li>Reboot. You can try launching the boot loader you just installed, but
326 chances are it will generate an <tt>Access Denied</tt> message. For it
327 to work, you must launch MokManager using the tool that rEFInd presents
328 on its second row. You can then enroll your <tt>refind_local.cer</tt>
329 key just as you enrolled the <tt>refind.cer</tt> key.</li>
330
331 </ol>
332
333 <p>At this point you should be able to launch the binaries you've signed. Unfortunately, there can still be problems at this point....</p>
334
335 <a name="caveats">
336 <h2>Secure Boot Caveats</h2>
337 </a>
338
339 <p>rEFInd's Secure Boot support is brand-new with version 0.5.0 of the program, and was revamped for version 0.6.2. I believe rEFInd 0.6.2's Secure Boot support to be significantly superior to that of previous versions, but you might still run into problems. Some issues you might encounter include the following:</p>
340
341 <ul>
342
343 <li>Under certain circumstances, the time required to launch a boot loader
344 can increase. This is unlikely to be noticeable for the average small
345 boot loader, but could be significant for larger boot loaders on slow
346 filesystems, such as Linux kernels on ext2fs, ext3fs, or ReiserFS
347 partitions.</li>
348
349 <li>As of version 0.6.2, rEFInd's own Secure Boot support is theoretically
350 able to work on non-<i>x</i>86-64 platforms; however, shim 0.2 works
351 only on <i>x</i>86-64, and rEFInd is dependent upon shim. Thus, you'll
352 have to wait for future shim developments if you want to use Secure
353 Boot on <i>x</i>86 or ARM computers.</li>
354
355 <li>In theory, signing Microsoft's boot loader with a MOK should work. This
356 might be handy if you want to replace your computer's built-in keys
357 with your own but still boot Windows&mdash;but be aware that if Windows
358 replaces its boot loader, it will then stop working.</li>
359
360 </ul>
361
362 <p>If you launch a boot loader or other program from rEFInd that relies on the EFI's standard program-launching code, that program should take advantage of shim and its MOKs. For instance, if you launch <a href="http://freedesktop.org/wiki/Software/gummiboot">gummiboot</a> from rEFInd (and rEFInd from shim), gummiboot should be able to launch shim/MOK-signed Linux kernels. This is not currently true if you launch gummiboot directly from shim.</p>
363
364 <p>My focus in testing rEFInd's Secure Boot capabilities has been on getting Linux kernels with EFI stub loaders to launch correctly. I've done some minimal testing with GRUB 2, though. I've also tested some self-signed binaries, such as an EFI shell and MokManager. (The EFI shell launches, but will not itself launch anything that's not been signed with a UEFI Secure Boot key, even with rEFInd 0.6.2. This of course limits its utility.)</p>
365
366 <p>At the moment, I consider rEFInd's shim/MOK support to be of late alpha quality. I'm releasing it in this state in the hope of getting feedback from adventurous early adopters. Some of the usability improvements are dependent upon MOK-capable versions of shim being released with major distributions; such versions of shim, with kernels signed with the key that matches the one built into shim, will greatly reduce the need for users to sign boot loaders.</p>
367
368 <hr />
369
370 <p>copyright &copy; 2012&ndash;2013 by Roderick W. Smith</p>
371
372 <p>This document is licensed under the terms of the <a href="FDL-1.3.txt">GNU Free Documentation License (FDL), version 1.3.</a></p>
373
374 <p>If you have problems with or comments about this Web page, please e-mail me at <a href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com.</a> Thanks.</p>
375
376 <p><a href="index.html">Go to the main rEFInd page</a></p>
377
378 <p><a href="revisions.html">Learn about rEFInd's history</a></p>
379
380
381 <p><a href="http://www.rodsbooks.com/">Return</a> to my main Web page.</p>
382 </body>
383 </html>