]>
Commit | Line | Data |
---|---|---|
cf1e172d LP |
1 | <?xml version="1.0"?> |
2 | <!--*-nxml-*--> | |
3 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" | |
4 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
5 | <!-- SPDX-License-Identifier: LGPL-2.1-or-later --> | |
6 | <refentry id="systemd-cryptenroll" xmlns:xi="http://www.w3.org/2001/XInclude" conditional='HAVE_LIBCRYPTSETUP'> | |
7 | ||
8 | <refentryinfo> | |
9 | <title>systemd-cryptenroll</title> | |
10 | <productname>systemd</productname> | |
11 | </refentryinfo> | |
12 | ||
13 | <refmeta> | |
14 | <refentrytitle>systemd-cryptenroll</refentrytitle> | |
15 | <manvolnum>1</manvolnum> | |
16 | </refmeta> | |
17 | ||
18 | <refnamediv> | |
19 | <refname>systemd-cryptenroll</refname> | |
20 | <refpurpose>Enroll PKCS#11, FIDO2, TPM2 token/devices to LUKS2 encrypted volumes</refpurpose> | |
21 | </refnamediv> | |
22 | ||
23 | <refsynopsisdiv> | |
24 | <cmdsynopsis> | |
25 | <command>systemd-cryptenroll <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="opt">DEVICE</arg></command> | |
26 | </cmdsynopsis> | |
27 | </refsynopsisdiv> | |
28 | ||
29 | <refsect1> | |
30 | <title>Description</title> | |
31 | ||
880e1e07 ZJS |
32 | <para><command>systemd-cryptenroll</command> is a tool for enrolling hardware security tokens and devices |
33 | into a LUKS2 encrypted volume, which may then be used to unlock the volume during boot. Specifically, it | |
34 | supports tokens and credentials of the following kind to be enrolled:</para> | |
cf1e172d LP |
35 | |
36 | <orderedlist> | |
880e1e07 ZJS |
37 | <listitem><para>PKCS#11 security tokens and smartcards that may carry an RSA key pair (e.g. various |
38 | YubiKeys)</para></listitem> | |
cf1e172d | 39 | |
880e1e07 ZJS |
40 | <listitem><para>FIDO2 security tokens that implement the <literal>hmac-secret</literal> extension (most |
41 | FIDO2 keys, including YubiKeys)</para></listitem> | |
cf1e172d LP |
42 | |
43 | <listitem><para>TPM2 security devices</para></listitem> | |
44 | ||
a587a16a ZJS |
45 | <listitem><para>Regular passphrases</para></listitem> |
46 | ||
cf1e172d | 47 | <listitem><para>Recovery keys. These are similar to regular passphrases, however are randomly generated |
880e1e07 | 48 | on the computer and thus generally have higher entropy than user-chosen passphrases. Their character |
cf1e172d LP |
49 | set has been designed to ensure they are easy to type in, while having high entropy. They may also be |
50 | scanned off screen using QR codes. Recovery keys may be used for unlocking LUKS2 volumes wherever | |
51 | passphrases are accepted. They are intended to be used in combination with an enrolled hardware | |
52 | security token, as a recovery option when the token is lost.</para></listitem> | |
cf1e172d LP |
53 | </orderedlist> |
54 | ||
55 | <para>In addition, the tool may be used to enumerate currently enrolled security tokens and wipe a subset | |
56 | of them. The latter may be combined with the enrollment operation of a new security token, in order to | |
57 | update or replace enrollments.</para> | |
58 | ||
59 | <para>The tool supports only LUKS2 volumes, as it stores token meta-information in the LUKS2 JSON token | |
60 | area, which is not available in other encryption formats.</para> | |
10fa7251 ZJS |
61 | |
62 | <refsect2> | |
63 | <title>TPM2 PCRs and policies</title> | |
64 | ||
65 | <para>PCRs allow binding of the encryption of secrets to specific software versions and system state, | |
66 | so that the enrolled key is only accessible (may be "unsealed") if specific trusted software and/or | |
67 | configuration is used. Such bindings may be created with the option <option>--tpm2-pcrs=</option> | |
68 | described below.</para> | |
69 | ||
70 | <para>Secrets may also be bound indirectly: a signed policy for a state of some combination of PCR | |
71 | values is provided, and the secret is bound to the public part of the key used to sign this policy. | |
72 | This means that the owner of a key can generate a sequence of signed policies, for specific software | |
73 | versions and system states, and the secret can be decrypted as long as the machine state matches one of | |
74 | those policies. For example, a vendor may provide such a policy for each kernel+initrd update, allowing | |
75 | users to encrypt secrets so that they can be decrypted when running any kernel+initrd signed by the | |
76 | vendor. Such bindings may be created with the options <option>--tpm2-public-key=</option>, | |
77 | <option>--tpm2-public-key-pcrs=</option>, <option>--tpm2-signature=</option> described below. | |
78 | </para> | |
79 | ||
80 | <para>See <ulink url="https://uapi-group.org/specifications/specs/linux_tpm_pcr_registry/">Linux TPM | |
81 | PCR Registry</ulink> for an authoritative list of PCRs and how they are updated. The table below | |
82 | contains a quick reference, describing in particular the PCRs modified by systemd.</para> | |
83 | ||
84 | <table> | |
85 | <title>Well-known PCR Definitions</title> | |
86 | ||
87 | <!-- See: https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/ --> | |
88 | <!-- See: https://github.com/rhboot/shim/blob/main/README.tpm --> | |
89 | <!-- See: https://www.gnu.org/software/grub/manual/grub/html_node/Measured-Boot.html --> | |
90 | <!-- See: https://sourceforge.net/p/linux-ima/wiki/Home/ --> | |
91 | <!-- See: https://github.com/tianocore-docs/edk2-TrustedBootChain/blob/main/4_Other_Trusted_Boot_Chains.md --> | |
92 | <!-- See: https://wiki.archlinux.org/title/Trusted_Platform_Module#Accessing_PCR_registers --> | |
93 | ||
94 | <tgroup cols='3' align='left' colsep='1' rowsep='1'> | |
95 | <colspec colname="pcr" /> | |
96 | <colspec colname="name" /> | |
97 | <colspec colname="definition" /> | |
98 | ||
99 | <thead> | |
100 | <row> | |
101 | <entry>PCR</entry> | |
102 | <entry>name</entry> | |
103 | <entry>Explanation</entry> | |
104 | </row> | |
105 | </thead> | |
106 | ||
107 | <tbody> | |
108 | <row> | |
109 | <entry>0</entry> | |
110 | <entry>platform-code</entry> | |
111 | <entry>Core system firmware executable code; changes on firmware updates</entry> | |
112 | </row> | |
113 | ||
114 | <row> | |
115 | <entry>1</entry> | |
116 | <entry>platform-config</entry> | |
117 | <entry>Core system firmware data/host platform configuration; typically contains serial and model numbers, changes on basic hardware/CPU/RAM replacements</entry> | |
118 | </row> | |
119 | ||
120 | <row> | |
121 | <entry>2</entry> | |
122 | <entry>external-code</entry> | |
123 | <entry>Extended or pluggable executable code; includes option ROMs on pluggable hardware</entry> | |
124 | </row> | |
125 | ||
126 | <row> | |
127 | <entry>3</entry> | |
128 | <entry>external-config</entry> | |
129 | <entry>Extended or pluggable firmware data; includes information about pluggable hardware</entry> | |
130 | </row> | |
131 | ||
132 | <row> | |
133 | <entry>4</entry> | |
134 | <entry>boot-loader-code</entry> | |
135 | <entry>Boot loader and additional drivers, PE binaries invoked by the boot loader; changes on boot loader updates. <citerefentry><refentrytitle>sd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> measures system extension images read from the ESP here too (see <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry>).</entry> | |
136 | </row> | |
137 | ||
138 | <row> | |
139 | <entry>5</entry> | |
140 | <entry>boot-loader-config</entry> | |
141 | <entry>GPT/Partition table; changes when the partitions are added, modified, or removed</entry> | |
142 | </row> | |
143 | ||
144 | <row> | |
145 | <entry>7</entry> | |
146 | <entry>secure-boot-policy</entry> | |
147 | <entry>Secure Boot state; changes when UEFI SecureBoot mode is enabled/disabled, or firmware certificates (PK, KEK, db, dbx, …) changes.</entry> | |
148 | </row> | |
149 | ||
150 | <row> | |
151 | <entry>9</entry> | |
152 | <entry>kernel-initrd</entry> | |
153 | <entry>The Linux kernel measures all initrds it receives into this PCR.</entry> | |
154 | <!-- Strictly speaking only Linux >= 5.17 using the LOAD_FILE2 protocol, see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f046fff8bc4c4d8f8a478022e76e40b818f692df --> | |
155 | </row> | |
156 | ||
157 | <row> | |
158 | <entry>10</entry> | |
159 | <entry>ima</entry> | |
160 | <entry>The IMA project measures its runtime state into this PCR.</entry> | |
161 | </row> | |
162 | ||
163 | <row> | |
164 | <entry>11</entry> | |
165 | <entry>kernel-boot</entry> | |
166 | <entry><citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> measures the ELF kernel image, embedded initrd and other payload of the PE image it is placed in into this PCR. <citerefentry><refentrytitle>systemd-pcrphase.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> measures boot phase strings into this PCR at various milestones of the boot process.</entry> | |
167 | </row> | |
168 | ||
169 | <row> | |
170 | <entry>12</entry> | |
171 | <entry>kernel-config</entry> | |
172 | <entry><citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry> measures the kernel command line into this PCR. <citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> measures any manually specified kernel command line (i.e. a kernel command line that overrides the one embedded in the unified PE image) and loaded credentials into this PCR.</entry> | |
173 | </row> | |
174 | ||
175 | <row> | |
176 | <entry>13</entry> | |
177 | <entry>sysexts</entry> | |
178 | <entry><citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> measures any <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry> images it passes to the booted kernel into this PCR.</entry> | |
179 | </row> | |
180 | ||
181 | <row> | |
182 | <entry>14</entry> | |
183 | <entry>shim-policy</entry> | |
184 | <entry>The shim project measures its "MOK" certificates and hashes into this PCR.</entry> | |
185 | </row> | |
186 | ||
187 | <row> | |
188 | <entry>15</entry> | |
189 | <entry>system-identity</entry> | |
94d82b59 | 190 | <entry><citerefentry><refentrytitle>systemd-cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry> optionally measures the volume key of activated LUKS volumes into this PCR. <citerefentry><refentrytitle>systemd-pcrmachine.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> measures the <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> into this PCR. <citerefentry><refentrytitle>systemd-pcrfs@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> measures mount points, file system UUIDs, labels, partition UUIDs of the root and <filename>/var/</filename> filesystems into this PCR.</entry> |
10fa7251 ZJS |
191 | </row> |
192 | ||
193 | <row> | |
194 | <entry>16</entry> | |
195 | <entry>debug</entry> | |
196 | <entry>Debug</entry> | |
197 | </row> | |
198 | ||
199 | <row> | |
200 | <entry>23</entry> | |
201 | <entry>application-support</entry> | |
202 | <entry>Application Support</entry> | |
203 | </row> | |
204 | </tbody> | |
205 | </tgroup> | |
206 | </table> | |
207 | ||
208 | <para>In general, encrypted volumes would be bound to some combination of PCRs 7, 11, and 14 (if | |
209 | shim/MOK is used). In order to allow firmware and OS version updates, it is typically not advisable to | |
210 | use PCRs such as 0 and 2, since the program code they cover should already be covered indirectly | |
211 | through the certificates measured into PCR 7. Validation through certificates hashes is typically | |
212 | preferable over validation through direct measurements as it is less brittle in context of OS/firmware | |
213 | updates: the measurements will change on every update, but signatures should remain unchanged. See the | |
214 | <ulink url="https://uapi-group.org/specifications/specs/linux_tpm_pcr_registry/">Linux TPM PCR | |
215 | Registry</ulink> for more discussion.</para> | |
216 | </refsect2> | |
cf1e172d | 217 | </refsect1> |
0bada3f8 LP |
218 | |
219 | <refsect1> | |
220 | <title>Limitations</title> | |
221 | ||
222 | <para>Note that currently when enrolling a new key of one of the five supported types listed above, it is | |
820c66dc PC |
223 | required to first provide a passphrase, a recovery key or a FIDO2 token. It's currently not supported to |
224 | unlock a device with a TPM2/PKCS#11 key in order to enroll a new TPM2/PKCS#11 key. Thus, if in future key | |
225 | roll-over is desired it's generally recommended to ensure a passphrase, a recovery key or a FIDO2 token | |
226 | is always enrolled.</para> | |
227 | ||
228 | <para>Also note that support for enrolling multiple FIDO2 tokens is currently limited. When multiple FIDO2 | |
229 | tokens are enrolled, <command>systemd-cryptseup</command> will perform pre-flight requests to attempt to | |
230 | identify which of the enrolled tokens are currently plugged in. However, this is not possible for FIDO2 | |
231 | tokens with user verification (UV, usually via biometrics), in which case it will fall back to attempting | |
232 | each enrolled token one by one. This will result in multiple prompts for PIN and user verification. This | |
233 | limitation does not apply to PKCS#11 tokens.</para> | |
0bada3f8 | 234 | </refsect1> |
cf1e172d LP |
235 | |
236 | <refsect1> | |
237 | <title>Options</title> | |
238 | ||
239 | <para>The following options are understood:</para> | |
240 | ||
241 | <variablelist> | |
242 | <varlistentry> | |
243 | <term><option>--password</option></term> | |
244 | ||
245 | <listitem><para>Enroll a regular password/passphrase. This command is mostly equivalent to | |
246 | <command>cryptsetup luksAddKey</command>, however may be combined with | |
247 | <option>--wipe-slot=</option> in one call, see below.</para></listitem> | |
248 | </varlistentry> | |
249 | ||
250 | <varlistentry> | |
251 | <term><option>--recovery-key</option></term> | |
252 | ||
880e1e07 ZJS |
253 | <listitem><para>Enroll a recovery key. Recovery keys are mostly identical to passphrases, but are |
254 | computer-generated instead of being chosen by a human, and thus have a guaranteed high entropy. The | |
255 | key uses a character set that is easy to type in, and may be scanned off screen via a QR code. | |
256 | </para></listitem> | |
cf1e172d LP |
257 | </varlistentry> |
258 | ||
1f419024 J |
259 | <varlistentry> |
260 | <term><option>--unlock-key-file=</option><replaceable>PATH</replaceable></term> | |
261 | ||
262 | <listitem><para>Use a file instead of a password/passphrase read from stdin to unlock the volume. | |
263 | Expects the PATH to the file containing your key to unlock the volume. Currently there is nothing like | |
264 | <option>--key-file-offset=</option> or <option>--key-file-size=</option> so this file has to only | |
265 | contain the full key.</para></listitem> | |
266 | </varlistentry> | |
267 | ||
d8c5bd04 AAF |
268 | <varlistentry> |
269 | <term><option>--unlock-fido2-device=</option><replaceable>PATH</replaceable></term> | |
270 | ||
271 | <listitem><para>Use a FIDO2 device instead of a password/passphrase read from stdin to unlock the | |
272 | volume. Expects a <filename>hidraw</filename> device referring to the FIDO2 device (e.g. | |
273 | <filename>/dev/hidraw1</filename>). Alternatively the special value <literal>auto</literal> may be | |
274 | specified, in order to automatically determine the device node of a currently plugged in security | |
275 | token (of which there must be exactly one). This automatic discovery is unsupported if | |
276 | <option>--fido2-device=</option> option is also specified.</para></listitem> | |
277 | </varlistentry> | |
278 | ||
cf1e172d LP |
279 | <varlistentry> |
280 | <term><option>--pkcs11-token-uri=</option><replaceable>URI</replaceable></term> | |
281 | ||
282 | <listitem><para>Enroll a PKCS#11 security token or smartcard (e.g. a YubiKey). Expects a PKCS#11 | |
be0d27ee | 283 | smartcard URI referring to the token. Alternatively the special value <literal>auto</literal> may |
cf1e172d LP |
284 | be specified, in order to automatically determine the URI of a currently plugged in security token |
285 | (of which there must be exactly one). The special value <literal>list</literal> may be used to | |
286 | enumerate all suitable PKCS#11 tokens currently plugged in. The security token must contain an RSA | |
287 | key pair which is used to encrypt the randomly generated key that is used to unlock the LUKS2 | |
288 | volume. The encrypted key is then stored in the LUKS2 JSON token header area.</para> | |
289 | ||
290 | <para>In order to unlock a LUKS2 volume with an enrolled PKCS#11 security token, specify the | |
291 | <option>pkcs11-uri=</option> option in the respective <filename>/etc/crypttab</filename> line:</para> | |
292 | ||
293 | <programlisting>myvolume /dev/sda1 - pkcs11-uri=auto</programlisting> | |
294 | ||
295 | <para>See | |
296 | <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry> for a | |
297 | more comprehensive example of a <command>systemd-cryptenroll</command> invocation and its matching | |
298 | <filename>/etc/crypttab</filename> line.</para></listitem> | |
299 | </varlistentry> | |
300 | ||
70e723c0 M |
301 | <varlistentry> |
302 | <term><option>--fido2-credential-algorithm=</option><replaceable>STRING</replaceable></term> | |
303 | <listitem><para>Specify COSE algorithm used in credential generation. The default value is | |
304 | <literal>es256</literal>. Supported values are <literal>es256</literal>, <literal>rs256</literal> | |
305 | and <literal>eddsa</literal>.</para> | |
306 | ||
307 | <para><literal>es256</literal> denotes ECDSA over NIST P-256 with SHA-256. <literal>rs256</literal> | |
308 | denotes 2048-bit RSA with PKCS#1.5 padding and SHA-256. <literal>eddsa</literal> denotes | |
309 | EDDSA over Curve25519 with SHA-512.</para> | |
310 | ||
311 | <para>Note that your authenticator may not support some algorithms.</para></listitem> | |
312 | </varlistentry> | |
313 | ||
cf1e172d LP |
314 | <varlistentry> |
315 | <term><option>--fido2-device=</option><replaceable>PATH</replaceable></term> | |
316 | ||
317 | <listitem><para>Enroll a FIDO2 security token that implements the <literal>hmac-secret</literal> | |
318 | extension (e.g. a YubiKey). Expects a <filename>hidraw</filename> device referring to the FIDO2 | |
319 | device (e.g. <filename>/dev/hidraw1</filename>). Alternatively the special value | |
320 | <literal>auto</literal> may be specified, in order to automatically determine the device node of a | |
d8c5bd04 AAF |
321 | currently plugged in security token (of which there must be exactly one). This automatic discovery |
322 | is unsupported if <option>--unlock-fido2-device=</option> option is also specified. The special value | |
cf1e172d LP |
323 | <literal>list</literal> may be used to enumerate all suitable FIDO2 tokens currently plugged in. Note |
324 | that many hardware security tokens that implement FIDO2 also implement the older PKCS#11 | |
325 | standard. Typically FIDO2 is preferable, given it's simpler to use and more modern.</para> | |
326 | ||
327 | <para>In order to unlock a LUKS2 volume with an enrolled FIDO2 security token, specify the | |
328 | <option>fido2-device=</option> option in the respective <filename>/etc/crypttab</filename> line:</para> | |
329 | ||
330 | <programlisting>myvolume /dev/sda1 - fido2-device=auto</programlisting> | |
331 | ||
332 | <para>See | |
333 | <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry> for a | |
334 | more comprehensive example of a <command>systemd-cryptenroll</command> invocation and its matching | |
335 | <filename>/etc/crypttab</filename> line.</para></listitem> | |
336 | </varlistentry> | |
337 | ||
cde2f860 LB |
338 | <varlistentry> |
339 | <term><option>--fido2-with-client-pin=</option><replaceable>BOOL</replaceable></term> | |
340 | ||
72c15422 LP |
341 | <listitem><para>When enrolling a FIDO2 security token, controls whether to require the user to enter |
342 | a PIN when unlocking the volume (the FIDO2 <literal>clientPin</literal> feature). Defaults to | |
343 | <literal>yes</literal>. (Note: this setting is without effect if the security token does not support | |
344 | the <literal>clientPin</literal> feature at all, or does not allow enabling or disabling | |
345 | it.)</para></listitem> | |
cde2f860 LB |
346 | </varlistentry> |
347 | ||
06f08719 LB |
348 | <varlistentry> |
349 | <term><option>--fido2-with-user-presence=</option><replaceable>BOOL</replaceable></term> | |
350 | ||
351 | <listitem><para>When enrolling a FIDO2 security token, controls whether to require the user to | |
352 | verify presence (tap the token, the FIDO2 <literal>up</literal> feature) when unlocking the volume. | |
72c15422 LP |
353 | Defaults to <literal>yes</literal>. (Note: this setting is without effect if the security token does not support |
354 | the <literal>up</literal> feature at all, or does not allow enabling or disabling it.) | |
06f08719 LB |
355 | </para></listitem> |
356 | </varlistentry> | |
357 | ||
896cc0da LB |
358 | <varlistentry> |
359 | <term><option>--fido2-with-user-verification=</option><replaceable>BOOL</replaceable></term> | |
360 | ||
361 | <listitem><para>When enrolling a FIDO2 security token, controls whether to require user verification | |
72c15422 LP |
362 | when unlocking the volume (the FIDO2 <literal>uv</literal> feature). Defaults to |
363 | <literal>no</literal>. (Note: this setting is without effect if the security token does not support | |
364 | the <literal>uv</literal> feature at all, or does not allow enabling or disabling it.)</para></listitem> | |
896cc0da LB |
365 | </varlistentry> |
366 | ||
cf1e172d LP |
367 | <varlistentry> |
368 | <term><option>--tpm2-device=</option><replaceable>PATH</replaceable></term> | |
369 | ||
370 | <listitem><para>Enroll a TPM2 security chip. Expects a device node path referring to the TPM2 chip | |
371 | (e.g. <filename>/dev/tpmrm0</filename>). Alternatively the special value <literal>auto</literal> may | |
372 | be specified, in order to automatically determine the device node of a currently discovered TPM2 | |
373 | device (of which there must be exactly one). The special value <literal>list</literal> may be used to | |
374 | enumerate all suitable TPM2 devices currently discovered.</para> | |
375 | ||
376 | <para>In order to unlock a LUKS2 volume with an enrolled TPM2 security chip, specify the | |
377 | <option>tpm2-device=</option> option in the respective <filename>/etc/crypttab</filename> line:</para> | |
378 | ||
379 | <programlisting>myvolume /dev/sda1 - tpm2-device=auto</programlisting> | |
380 | ||
381 | <para>See | |
382 | <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry> for a | |
383 | more comprehensive example of a <command>systemd-cryptenroll</command> invocation and its matching | |
384 | <filename>/etc/crypttab</filename> line.</para> | |
385 | ||
386 | <para>Use <option>--tpm2-pcrs=</option> (see below) to configure which TPM2 PCR indexes to bind the | |
387 | enrollment to.</para></listitem> | |
388 | </varlistentry> | |
389 | ||
390 | <varlistentry> | |
391 | <term><option>--tpm2-pcrs=</option><arg rep="repeat">PCR</arg></term> | |
392 | ||
10fa7251 | 393 | <listitem><para>Configures the TPM2 PCRs (Platform Configuration Registers) to bind to when |
1782b0b8 DS |
394 | enrollment is requested via <option>--tpm2-device=</option>. Takes a list of PCR entries, where each |
395 | entry starts with a name or numeric index in the range 0…23, optionally followed by | |
396 | <literal>:</literal> and a hash algorithm name (specifying the PCR bank), optionally followed by | |
397 | <literal>=</literal> and a hash digest value. Multiple PCR entries are separated by | |
398 | <literal>+</literal>. If not specified, the default is to use PCR 7 only. If an empty string is | |
399 | specified, binds the enrollment to no PCRs at all. See the table above for a list of available | |
400 | PCRs.</para> | |
10fa7251 ZJS |
401 | |
402 | <para>Example: <option>--tpm2-pcrs=boot-loader-code+platform-config+boot-loader-config</option> | |
403 | specifies that PCR registers 4, 1, and 5 should be used.</para> | |
1782b0b8 DS |
404 | <para>Example: <option>--tpm2-pcrs=7:sha256</option> specifies that PCR register 7 from the SHA256 |
405 | bank should be used.</para> | |
a11a2e05 | 406 | <para>Example: <option>--tpm2-pcrs=4:sha1=3a3f780f11a4b49969fcaa80cd6e3957c33b2275</option> |
1782b0b8 | 407 | specifies that PCR register 4 from the SHA1 bank should be used, and a hash digest value of |
a11a2e05 | 408 | 3a3f780f11a4b49969fcaa80cd6e3957c33b2275 will be used instead of reading the current PCR |
1782b0b8 | 409 | value.</para> |
10fa7251 | 410 | </listitem> |
cf1e172d LP |
411 | </varlistentry> |
412 | ||
caeb5604 GG |
413 | <varlistentry> |
414 | <term><option>--tpm2-with-pin=</option><replaceable>BOOL</replaceable></term> | |
415 | ||
416 | <listitem><para>When enrolling a TPM2 device, controls whether to require the user to enter a PIN | |
417 | when unlocking the volume in addition to PCR binding, based on TPM2 policy authentication. Defaults | |
418 | to <literal>no</literal>. Despite being called PIN, any character can be used, not just numbers. | |
419 | </para> | |
420 | ||
f0f4fcae LP |
421 | <para>Note that incorrect PIN entry when unlocking increments the TPM dictionary attack lockout |
422 | mechanism, and may lock out users for a prolonged time, depending on its configuration. The lockout | |
423 | mechanism is a global property of the TPM, <command>systemd-cryptenroll</command> does not control or | |
424 | configure the lockout mechanism. You may use tpm2-tss tools to inspect or configure the dictionary | |
425 | attack lockout, with <citerefentry | |
426 | project='mankier'><refentrytitle>tpm2_getcap</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
427 | and <citerefentry | |
428 | project='mankier'><refentrytitle>tpm2_dictionarylockout</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
caeb5604 GG |
429 | commands, respectively.</para></listitem> |
430 | </varlistentry> | |
431 | ||
f0f4fcae LP |
432 | <varlistentry> |
433 | <term><option>--tpm2-public-key=</option><arg>PATH</arg></term> | |
434 | <term><option>--tpm2-public-key-pcrs=</option><arg rep="repeat">PCR</arg></term> | |
435 | <term><option>--tpm2-signature=</option><arg>PATH</arg></term> | |
436 | ||
437 | <listitem><para>Configures a TPM2 signed PCR policy to bind encryption to. The | |
438 | <option>--tpm2-public-key=</option> option accepts a path to a PEM encoded RSA public key, to bind | |
439 | the encryption to. If this is not specified explicitly, but a file | |
440 | <filename>tpm2-pcr-public-key.pem</filename> exists in one of the directories | |
441 | <filename>/etc/systemd/</filename>, <filename>/run/systemd/</filename>, | |
442 | <filename>/usr/lib/systemd/</filename> (searched in this order), it is automatically used. The | |
443 | <option>--tpm2-public-key-pcrs=</option> option takes a list of TPM2 PCR indexes to bind to (same | |
444 | syntax as <option>--tpm2-pcrs=</option> described above). If not specified defaults to 11 (i.e. this | |
445 | binds the policy to any unified kernel image for which a PCR signature can be provided).</para> | |
446 | ||
447 | <para>Note the difference between <option>--tpm2-pcrs=</option> and | |
448 | <option>--tpm2-public-key-pcrs=</option>: the former binds decryption to the current, specific PCR | |
449 | values; the latter binds decryption to any set of PCR values for which a signature by the specified | |
450 | public key can be provided. The latter is hence more useful in scenarios where software updates shell | |
10fa7251 ZJS |
451 | be possible without losing access to all previously encrypted LUKS2 volumes. Like with |
452 | <option>--tpm2-pcrs=</option>, names defined in the table above can also be used to specify the | |
453 | registers, for instance | |
454 | <option>--tpm2-public-key-pcrs=boot-loader-code+system-identity</option>.</para> | |
f0f4fcae | 455 | |
10fa7251 ZJS |
456 | <para>The <option>--tpm2-signature=</option> option takes a path to a TPM2 PCR signature file as |
457 | generated by the | |
f0f4fcae | 458 | <citerefentry><refentrytitle>systemd-measure</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
10fa7251 | 459 | tool. If this is not specified explicitly, a suitable signature file |
f0f4fcae | 460 | <filename>tpm2-pcr-signature.json</filename> is searched for in <filename>/etc/systemd/</filename>, |
10fa7251 ZJS |
461 | <filename>/run/systemd/</filename>, <filename>/usr/lib/systemd/</filename> (in this order) and used. |
462 | If a signature file is specified or found it is used to verify if the volume can be unlocked with it | |
463 | given the current PCR state, before the new slot is written to disk. This is intended as safety net | |
464 | to ensure that access to a volume is not lost if a public key is enrolled for which no valid | |
465 | signature for the current PCR state is available. If the supplied signature does not unlock the | |
f0f4fcae LP |
466 | current PCR state and public key combination, no slot is enrolled and the operation will fail. If no |
467 | signature file is specified or found no such safety verification is done.</para></listitem> | |
468 | </varlistentry> | |
469 | ||
cf1e172d LP |
470 | <varlistentry> |
471 | <term><option>--wipe-slot=</option><arg rep="repeat">SLOT</arg></term> | |
472 | ||
473 | <listitem><para>Wipes one or more LUKS2 key slots. Takes a comma separated list of numeric slot | |
474 | indexes, or the special strings <literal>all</literal> (for wiping all key slots), | |
475 | <literal>empty</literal> (for wiping all key slots that are unlocked by an empty passphrase), | |
476 | <literal>password</literal> (for wiping all key slots that are unlocked by a traditional passphrase), | |
477 | <literal>recovery</literal> (for wiping all key slots that are unlocked by a recovery key), | |
478 | <literal>pkcs11</literal> (for wiping all key slots that are unlocked by a PKCS#11 token), | |
479 | <literal>fido2</literal> (for wiping all key slots that are unlocked by a FIDO2 token), | |
480 | <literal>tpm2</literal> (for wiping all key slots that are unlocked by a TPM2 chip), or any | |
481 | combination of these strings or numeric indexes, in which case all slots matching either are | |
482 | wiped. As safety precaution an operation that wipes all slots without exception (so that the volume | |
483 | cannot be unlocked at all anymore, unless the volume key is known) is refused.</para> | |
484 | ||
485 | <para>This switch may be used alone, in which case only the requested wipe operation is executed. It | |
486 | may also be used in combination with any of the enrollment options listed above, in which case the | |
487 | enrollment is completed first, and only when successful the wipe operation executed — and the newly | |
488 | added slot is always excluded from the wiping. Combining enrollment and slot wiping may thus be used to | |
489 | update existing enrollments:</para> | |
490 | ||
491 | <programlisting>systemd-cryptenroll /dev/sda1 --wipe-slot=tpm2 --tpm2-device=auto</programlisting> | |
492 | ||
45861042 | 493 | <para>The above command will enroll the TPM2 chip, and then wipe all previously created TPM2 |
cf1e172d LP |
494 | enrollments on the LUKS2 volume, leaving only the newly created one. Combining wiping and enrollment |
495 | may also be used to replace enrollments of different types, for example for changing from a PKCS#11 | |
496 | enrollment to a FIDO2 one:</para> | |
497 | ||
498 | <programlisting>systemd-cryptenroll /dev/sda1 --wipe-slot=pkcs11 --fido2-device=auto</programlisting> | |
499 | ||
500 | <para>Or for replacing an enrolled empty password by TPM2:</para> | |
501 | ||
502 | <programlisting>systemd-cryptenroll /dev/sda1 --wipe-slot=empty --tpm2-device=auto</programlisting> | |
503 | </listitem> | |
504 | </varlistentry> | |
505 | ||
506 | <xi:include href="standard-options.xml" xpointer="help" /> | |
507 | <xi:include href="standard-options.xml" xpointer="version" /> | |
508 | </variablelist> | |
509 | ||
510 | </refsect1> | |
511 | ||
512 | <refsect1> | |
513 | <title>Exit status</title> | |
514 | ||
515 | <para>On success, 0 is returned, a non-zero failure code otherwise.</para> | |
516 | </refsect1> | |
517 | ||
518 | <refsect1> | |
519 | <title>See Also</title> | |
520 | <para> | |
521 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
522 | <citerefentry><refentrytitle>systemd-cryptsetup@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
523 | <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
f0f4fcae LP |
524 | <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
525 | <citerefentry><refentrytitle>systemd-measure</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
cf1e172d LP |
526 | </para> |
527 | </refsect1> | |
528 | ||
529 | </refentry> |