| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd-sbsign" |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
<refentryinfo> |
| 9 |
<title>systemd-sbsign</title> |
| 10 |
<productname>systemd</productname> |
| 11 |
</refentryinfo> |
| 12 |
|
| 13 |
<refmeta> |
| 14 |
<refentrytitle>systemd-sbsign</refentrytitle> |
| 15 |
<manvolnum>1</manvolnum> |
| 16 |
</refmeta> |
| 17 |
|
| 18 |
<refnamediv> |
| 19 |
<refname>systemd-sbsign</refname> |
| 20 |
<refpurpose>Sign PE binaries for EFI Secure Boot</refpurpose> |
| 21 |
</refnamediv> |
| 22 |
|
| 23 |
<refsynopsisdiv> |
| 24 |
<cmdsynopsis> |
| 25 |
<command>systemd-sbsign</command> |
| 26 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 27 |
<arg choice="req">COMMAND</arg> |
| 28 |
</cmdsynopsis> |
| 29 |
</refsynopsisdiv> |
| 30 |
|
| 31 |
<refsect1> |
| 32 |
<title>Description</title> |
| 33 |
|
| 34 |
<para><command>systemd-sbsign</command> can be used to sign PE binaries for EFI Secure Boot.</para> |
| 35 |
</refsect1> |
| 36 |
|
| 37 |
<refsect1> |
| 38 |
<title>Commands</title> |
| 39 |
|
| 40 |
<variablelist> |
| 41 |
<varlistentry> |
| 42 |
<term><option>sign</option></term> |
| 43 |
|
| 44 |
<listitem><para>Signs the given PE binary for EFI Secure Boot. Takes a path to a PE binary as its |
| 45 |
argument. If the PE binary already has a certificate table, the new signature will be added to it. |
| 46 |
Otherwise, a new certificate table will be created. The signed PE binary will be written to the path |
| 47 |
specified with <option>--output=</option>.</para> |
| 48 |
|
| 49 |
<xi:include href="version-info.xml" xpointer="v257"/> |
| 50 |
</listitem> |
| 51 |
</varlistentry> |
| 52 |
</variablelist> |
| 53 |
</refsect1> |
| 54 |
|
| 55 |
<refsect1> |
| 56 |
<title>Options</title> |
| 57 |
<para>The following options are understood:</para> |
| 58 |
|
| 59 |
<variablelist> |
| 60 |
<varlistentry> |
| 61 |
<term><option>--output=<replaceable>PATH</replaceable></option></term> |
| 62 |
|
| 63 |
<listitem><para>Specifies the path where to write the signed PE binary or the data to be signed |
| 64 |
offline when using the <option>--prepare-offline-signing</option> option.</para> |
| 65 |
|
| 66 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 67 |
</varlistentry> |
| 68 |
|
| 69 |
<varlistentry> |
| 70 |
<term><option>--private-key=<replaceable>PATH/URI</replaceable></option></term> |
| 71 |
<term><option>--private-key-source=<replaceable>TYPE</replaceable>[:<replaceable>NAME</replaceable>]</option></term> |
| 72 |
<term><option>--certificate=<replaceable>PATH</replaceable></option></term> |
| 73 |
<term><option>--certificate-source=<replaceable>TYPE</replaceable>[:<replaceable>NAME</replaceable>]</option></term> |
| 74 |
|
| 75 |
<listitem><para>Set the Secure Boot private key and certificate for use with the |
| 76 |
<command>sign</command> verb. The <option>--certificate=</option> option takes a path to a |
| 77 |
PEM-encoded X.509 certificate or a URI that's passed to the OpenSSL provider configured with |
| 78 |
<option>--certificate-source</option>. The <option>--certificate-source</option> option takes one of |
| 79 |
<literal>file</literal> or <literal>provider</literal>, with the latter being followed by a specific |
| 80 |
provider identifier, separated with a colon, e.g. <literal>provider:pkcs11</literal>. The |
| 81 |
<option>--private-key=</option> option takes a path or a URI that will be passed to the OpenSSL |
| 82 |
engine or provider, as specified by <option>--private-key-source=</option> as a |
| 83 |
<literal>type:name</literal> tuple, such as <literal>engine:pkcs11</literal>. The specified OpenSSL |
| 84 |
signing engine or provider will be used to sign the PE binary.</para> |
| 85 |
|
| 86 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 87 |
</varlistentry> |
| 88 |
|
| 89 |
<varlistentry> |
| 90 |
<term><option>--prepare-offline-signing</option></term> |
| 91 |
|
| 92 |
<listitem><para>When this option is specified, the <command>sign</command> command writes the data |
| 93 |
that should be signed to the path specified with <option>--output=</option> instead of writing the |
| 94 |
signed PE binary. This data can then be signed out of band after which the signature can be attached |
| 95 |
to the PE binary using the <option>--signed-data=</option> and |
| 96 |
<option>--signed-data-signature=</option> options.</para> |
| 97 |
|
| 98 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 99 |
</varlistentry> |
| 100 |
|
| 101 |
<varlistentry> |
| 102 |
<term><option>--signed-data=<replaceable>PATH</replaceable></option></term> |
| 103 |
<term><option>--signed-data-signature=<replaceable>PATH</replaceable></option></term> |
| 104 |
|
| 105 |
<listitem><para>Configure the signed data (as written to the path specified with |
| 106 |
<option>--output=</option> when using the <option>--prepare-offline-signing</option> option) and |
| 107 |
corresponding signature for the <command>sign</command> command.</para> |
| 108 |
|
| 109 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 110 |
</varlistentry> |
| 111 |
|
| 112 |
<xi:include href="standard-options.xml" xpointer="help"/> |
| 113 |
<xi:include href="standard-options.xml" xpointer="version"/> |
| 114 |
</variablelist> |
| 115 |
</refsect1> |
| 116 |
|
| 117 |
<refsect1> |
| 118 |
<title>Examples</title> |
| 119 |
|
| 120 |
<example> |
| 121 |
<title>Offline EFI secure boot signing of a PE binary</title> |
| 122 |
|
| 123 |
<para>The following does offline secure boot signing of systemd-boot:</para> |
| 124 |
|
| 125 |
<programlisting>SD_BOOT="$(find /usr/lib/systemd/boot/efi/ -name "systemd-boot*.efi" | head -n1)" |
| 126 |
# Extract the data that should be signed offline. |
| 127 |
/usr/lib/systemd/systemd-sbsign \ |
| 128 |
sign \ |
| 129 |
--certificate=secure-boot-certificate.pem \ |
| 130 |
--output=signed-data.bin \ |
| 131 |
--prepare-offline-signing \ |
| 132 |
"$SD_BOOT" |
| 133 |
# Sign the data out-of-band. This step usually happens out-of-band on a separate system. |
| 134 |
openssl dgst -sha256 -sign secure-boot-private-key.pem -out signed-data.sig signed-data.bin |
| 135 |
# Attach the signed data and its signature to the systemd-boot PE binary. |
| 136 |
/usr/lib/systemd/systemd-sbsign \ |
| 137 |
sign \ |
| 138 |
--certificate=secure-boot-certificate.pem \ |
| 139 |
--output="$SD_BOOT.signed" \ |
| 140 |
--signed-data=signed-data.bin \ |
| 141 |
--signed-data-signature=signed-data.sig \ |
| 142 |
"$SD_BOOT"</programlisting> |
| 143 |
</example> |
| 144 |
</refsect1> |
| 145 |
|
| 146 |
<refsect1> |
| 147 |
<title>See Also</title> |
| 148 |
<para><simplelist type="inline"> |
| 149 |
<member><citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 150 |
</simplelist></para> |
| 151 |
</refsect1> |
| 152 |
</refentry> |