]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-cryptenroll.xml
Merge pull request #25168 from valentindavid/valentindavid/umount-move-recursive...
[thirdparty/systemd.git] / man / systemd-cryptenroll.xml
CommitLineData
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>
61 </refsect1>
0bada3f8
LP
62
63 <refsect1>
64 <title>Limitations</title>
65
66 <para>Note that currently when enrolling a new key of one of the five supported types listed above, it is
67 required to first provide a passphrase or recovery key (i.e. one of the latter two key types). For
68 example, it's currently not possible to unlock a device with a FIDO2 key in order to enroll a new FIDO2
69 key. Instead, in order to enroll a new FIDO2 key, it is necessary to provide an already enrolled regular
70 passphrase or recovery key. Thus, if in future key roll-over is desired it's generally recommended to
71 combine TPM2, FIDO2, PKCS#11 key enrollment with enrolling a regular passphrase or recovery key.</para>
72
73 <para>Also note that support for enrolling multiple FIDO2 tokens is currently not too useful, as while
74 unlocking <command>systemd-cryptsetup</command> cannot identify which token is currently plugged in and
75 thus does not know which authentication request to send to the device. This limitation does not apply to
76 tokens enrolled via PKCS#11 — because tokens of this type may be identified immediately, before
77 authentication.</para>
78 </refsect1>
cf1e172d
LP
79
80 <refsect1>
81 <title>Options</title>
82
83 <para>The following options are understood:</para>
84
85 <variablelist>
86 <varlistentry>
87 <term><option>--password</option></term>
88
89 <listitem><para>Enroll a regular password/passphrase. This command is mostly equivalent to
90 <command>cryptsetup luksAddKey</command>, however may be combined with
91 <option>--wipe-slot=</option> in one call, see below.</para></listitem>
92 </varlistentry>
93
94 <varlistentry>
95 <term><option>--recovery-key</option></term>
96
880e1e07
ZJS
97 <listitem><para>Enroll a recovery key. Recovery keys are mostly identical to passphrases, but are
98 computer-generated instead of being chosen by a human, and thus have a guaranteed high entropy. The
99 key uses a character set that is easy to type in, and may be scanned off screen via a QR code.
100 </para></listitem>
cf1e172d
LP
101 </varlistentry>
102
1f419024
J
103 <varlistentry>
104 <term><option>--unlock-key-file=</option><replaceable>PATH</replaceable></term>
105
106 <listitem><para>Use a file instead of a password/passphrase read from stdin to unlock the volume.
107 Expects the PATH to the file containing your key to unlock the volume. Currently there is nothing like
108 <option>--key-file-offset=</option> or <option>--key-file-size=</option> so this file has to only
109 contain the full key.</para></listitem>
110 </varlistentry>
111
cf1e172d
LP
112 <varlistentry>
113 <term><option>--pkcs11-token-uri=</option><replaceable>URI</replaceable></term>
114
115 <listitem><para>Enroll a PKCS#11 security token or smartcard (e.g. a YubiKey). Expects a PKCS#11
be0d27ee 116 smartcard URI referring to the token. Alternatively the special value <literal>auto</literal> may
cf1e172d
LP
117 be specified, in order to automatically determine the URI of a currently plugged in security token
118 (of which there must be exactly one). The special value <literal>list</literal> may be used to
119 enumerate all suitable PKCS#11 tokens currently plugged in. The security token must contain an RSA
120 key pair which is used to encrypt the randomly generated key that is used to unlock the LUKS2
121 volume. The encrypted key is then stored in the LUKS2 JSON token header area.</para>
122
123 <para>In order to unlock a LUKS2 volume with an enrolled PKCS#11 security token, specify the
124 <option>pkcs11-uri=</option> option in the respective <filename>/etc/crypttab</filename> line:</para>
125
126 <programlisting>myvolume /dev/sda1 - pkcs11-uri=auto</programlisting>
127
128 <para>See
129 <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry> for a
130 more comprehensive example of a <command>systemd-cryptenroll</command> invocation and its matching
131 <filename>/etc/crypttab</filename> line.</para></listitem>
132 </varlistentry>
133
70e723c0
M
134 <varlistentry>
135 <term><option>--fido2-credential-algorithm=</option><replaceable>STRING</replaceable></term>
136 <listitem><para>Specify COSE algorithm used in credential generation. The default value is
137 <literal>es256</literal>. Supported values are <literal>es256</literal>, <literal>rs256</literal>
138 and <literal>eddsa</literal>.</para>
139
140 <para><literal>es256</literal> denotes ECDSA over NIST P-256 with SHA-256. <literal>rs256</literal>
141 denotes 2048-bit RSA with PKCS#1.5 padding and SHA-256. <literal>eddsa</literal> denotes
142 EDDSA over Curve25519 with SHA-512.</para>
143
144 <para>Note that your authenticator may not support some algorithms.</para></listitem>
145 </varlistentry>
146
cf1e172d
LP
147 <varlistentry>
148 <term><option>--fido2-device=</option><replaceable>PATH</replaceable></term>
149
150 <listitem><para>Enroll a FIDO2 security token that implements the <literal>hmac-secret</literal>
151 extension (e.g. a YubiKey). Expects a <filename>hidraw</filename> device referring to the FIDO2
152 device (e.g. <filename>/dev/hidraw1</filename>). Alternatively the special value
153 <literal>auto</literal> may be specified, in order to automatically determine the device node of a
154 currently plugged in security token (of which there must be exactly one). The special value
155 <literal>list</literal> may be used to enumerate all suitable FIDO2 tokens currently plugged in. Note
156 that many hardware security tokens that implement FIDO2 also implement the older PKCS#11
157 standard. Typically FIDO2 is preferable, given it's simpler to use and more modern.</para>
158
159 <para>In order to unlock a LUKS2 volume with an enrolled FIDO2 security token, specify the
160 <option>fido2-device=</option> option in the respective <filename>/etc/crypttab</filename> line:</para>
161
162 <programlisting>myvolume /dev/sda1 - fido2-device=auto</programlisting>
163
164 <para>See
165 <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry> for a
166 more comprehensive example of a <command>systemd-cryptenroll</command> invocation and its matching
167 <filename>/etc/crypttab</filename> line.</para></listitem>
168 </varlistentry>
169
cde2f860
LB
170 <varlistentry>
171 <term><option>--fido2-with-client-pin=</option><replaceable>BOOL</replaceable></term>
172
72c15422
LP
173 <listitem><para>When enrolling a FIDO2 security token, controls whether to require the user to enter
174 a PIN when unlocking the volume (the FIDO2 <literal>clientPin</literal> feature). Defaults to
175 <literal>yes</literal>. (Note: this setting is without effect if the security token does not support
176 the <literal>clientPin</literal> feature at all, or does not allow enabling or disabling
177 it.)</para></listitem>
cde2f860
LB
178 </varlistentry>
179
06f08719
LB
180 <varlistentry>
181 <term><option>--fido2-with-user-presence=</option><replaceable>BOOL</replaceable></term>
182
183 <listitem><para>When enrolling a FIDO2 security token, controls whether to require the user to
184 verify presence (tap the token, the FIDO2 <literal>up</literal> feature) when unlocking the volume.
72c15422
LP
185 Defaults to <literal>yes</literal>. (Note: this setting is without effect if the security token does not support
186 the <literal>up</literal> feature at all, or does not allow enabling or disabling it.)
06f08719
LB
187 </para></listitem>
188 </varlistentry>
189
896cc0da
LB
190 <varlistentry>
191 <term><option>--fido2-with-user-verification=</option><replaceable>BOOL</replaceable></term>
192
193 <listitem><para>When enrolling a FIDO2 security token, controls whether to require user verification
72c15422
LP
194 when unlocking the volume (the FIDO2 <literal>uv</literal> feature). Defaults to
195 <literal>no</literal>. (Note: this setting is without effect if the security token does not support
196 the <literal>uv</literal> feature at all, or does not allow enabling or disabling it.)</para></listitem>
896cc0da
LB
197 </varlistentry>
198
cf1e172d
LP
199 <varlistentry>
200 <term><option>--tpm2-device=</option><replaceable>PATH</replaceable></term>
201
202 <listitem><para>Enroll a TPM2 security chip. Expects a device node path referring to the TPM2 chip
203 (e.g. <filename>/dev/tpmrm0</filename>). Alternatively the special value <literal>auto</literal> may
204 be specified, in order to automatically determine the device node of a currently discovered TPM2
205 device (of which there must be exactly one). The special value <literal>list</literal> may be used to
206 enumerate all suitable TPM2 devices currently discovered.</para>
207
208 <para>In order to unlock a LUKS2 volume with an enrolled TPM2 security chip, specify the
209 <option>tpm2-device=</option> option in the respective <filename>/etc/crypttab</filename> line:</para>
210
211 <programlisting>myvolume /dev/sda1 - tpm2-device=auto</programlisting>
212
213 <para>See
214 <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry> for a
215 more comprehensive example of a <command>systemd-cryptenroll</command> invocation and its matching
216 <filename>/etc/crypttab</filename> line.</para>
217
218 <para>Use <option>--tpm2-pcrs=</option> (see below) to configure which TPM2 PCR indexes to bind the
219 enrollment to.</para></listitem>
220 </varlistentry>
221
222 <varlistentry>
223 <term><option>--tpm2-pcrs=</option><arg rep="repeat">PCR</arg></term>
224
225 <listitem><para>Configures the TPM2 PCRs (Platform Configuration Registers) to bind the enrollment
a1788a69
LP
226 requested via <option>--tpm2-device=</option> to. Takes a <literal>+</literal> separated list of
227 numeric PCR indexes in the range 0…23. If not used, defaults to PCR 7 only. If an empty string is
228 specified, binds the enrollment to no PCRs at all. PCRs allow binding the enrollment to specific
229 software versions and system state, so that the enrolled unlocking key is only accessible (may be
9a89ab26 230 "unsealed") if specific trusted software and/or configuration is used.</para>
cf1e172d
LP
231
232 <table>
233 <title>Well-known PCR Definitions</title>
234
9a89ab26
LP
235 <!-- See: https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/ -->
236 <!-- See: https://github.com/rhboot/shim/blob/main/README.tpm -->
237 <!-- See: https://www.gnu.org/software/grub/manual/grub/html_node/Measured-Boot.html -->
238 <!-- See: https://sourceforge.net/p/linux-ima/wiki/Home/ -->
27818e2e
LP
239 <!-- See: https://github.com/tianocore-docs/edk2-TrustedBootChain/blob/main/4_Other_Trusted_Boot_Chains.md -->
240 <!-- See: https://wiki.archlinux.org/title/Trusted_Platform_Module#Accessing_PCR_registers -->
9a89ab26 241
cf1e172d
LP
242 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
243 <colspec colname="pcr" />
244 <colspec colname="definition" />
245
246 <thead>
247 <row>
248 <entry>PCR</entry>
249 <entry>Explanation</entry>
250 </row>
251 </thead>
252
253 <tbody>
254 <row>
255 <entry>0</entry>
256 <entry>Core system firmware executable code; changes on firmware updates</entry>
257 </row>
258
259 <row>
260 <entry>1</entry>
261 <entry>Core system firmware data/host platform configuration; typically contains serial and model numbers, changes on basic hardware/CPU/RAM replacements</entry>
262 </row>
263
264 <row>
265 <entry>2</entry>
266 <entry>Extended or pluggable executable code; includes option ROMs on pluggable hardware</entry>
267 </row>
268
269 <row>
270 <entry>3</entry>
271 <entry>Extended or pluggable firmware data; includes information about pluggable hardware</entry>
272 </row>
273
274 <row>
275 <entry>4</entry>
ebf3ee41 276 <entry>Boot loader and additional drivers; changes on boot loader updates. The shim project will measure the PE binary it chain loads into this PCR. If the Linux kernel is invoked as UEFI PE binary, it is measured here, too. <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>
cf1e172d
LP
277 </row>
278
279 <row>
280 <entry>5</entry>
281 <entry>GPT/Partition table; changes when the partitions are added, modified or removed</entry>
282 </row>
283
284 <row>
285 <entry>6</entry>
286 <entry>Power state events; changes on system suspend/sleep</entry>
287 </row>
288
289 <row>
290 <entry>7</entry>
8b9f0921 291 <entry>Secure Boot state; changes when UEFI SecureBoot mode is enabled/disabled, or firmware certificates (PK, KEK, db, dbx, …) changes. The shim project will measure most of its (non-MOK) certificates and SBAT data into this PCR.</entry>
cf1e172d
LP
292 </row>
293
27818e2e
LP
294 <!-- Grub measures all its commands and the kernel command line into PCR 8… -->
295 <!-- Grub measures all files it reads (including kernel image, initrd, …) into PCR 9… -->
296
cf1e172d 297 <row>
ebf3ee41 298 <entry>9</entry>
b66a6e1a 299 <entry>The Linux kernel measures all initrds it receives into this PCR.</entry>
ebf3ee41 300 <!-- 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 -->
9a89ab26
LP
301 </row>
302
9a89ab26
LP
303 <row>
304 <entry>10</entry>
305 <entry>The IMA project measures its runtime state into this PCR.</entry>
306 </row>
307
72c97c19
LP
308 <row>
309 <entry>11</entry>
346a4e3d 310 <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. Unlike PCR 4 (where the same data should be measured into), this PCR value should be easy to pre-calculate, as this only contains static parts of the PE binary. Use this PCR to bind TPM policies to a specific kernel image, possibly with an embedded initrd. <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>
72c97c19
LP
311 </row>
312
ebf3ee41
LP
313 <row>
314 <entry>12</entry>
8b9f0921 315 <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. (Note that if <command>systemd-boot</command> and <command>systemd-stub</command> are used in combination the command line might be measured twice!)</entry>
ebf3ee41
LP
316 </row>
317
de7ad6d4
LP
318 <row>
319 <entry>13</entry>
320 <entry><citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry> measures any <citerefentry><refentrytitle>systemd-sysext</refentrytitle><manvolnum>8</manvolnum></citerefentry> images it loads and passed to the booted kernel into this PCR.</entry>
321 </row>
322
9a89ab26
LP
323 <row>
324 <entry>14</entry>
325 <entry>The shim project measures its "MOK" certificates and hashes into this PCR.</entry>
cf1e172d 326 </row>
572f7876
LP
327
328 <row>
329 <entry>15</entry>
330 <entry><citerefentry><refentrytitle>systemd-cryptsetup</refentrytitle><manvolnum>7</manvolnum></citerefentry> optionally measures the volume key of activated LUKS volumes into this PCR.</entry>
331 </row>
cf1e172d
LP
332 </tbody>
333 </tgroup>
334 </table>
335
9a89ab26
LP
336 <para>For most applications it should be sufficient to bind against PCR 7 (and possibly PCR 14, if
337 shim/MOK is desired), as this includes measurements of the trusted certificates (and possibly hashes)
338 that are used to validate all components of the boot process up to and including the OS kernel. In
339 order to simplify firmware and OS version updates it's typically not advisable to include PCRs such
340 as 0 and 2 in the binding of the enrollment, since the program code they cover should already be
341 protected indirectly through the certificates measured into PCR 7. Validation through these
342 certificates is typically preferable over validation through direct measurements as it is less
343 brittle in context of OS/firmware updates: the measurements will change on every update, but code
344 signatures likely will validate against pre-existing certificates.</para></listitem>
cf1e172d
LP
345 </varlistentry>
346
caeb5604
GG
347 <varlistentry>
348 <term><option>--tpm2-with-pin=</option><replaceable>BOOL</replaceable></term>
349
350 <listitem><para>When enrolling a TPM2 device, controls whether to require the user to enter a PIN
351 when unlocking the volume in addition to PCR binding, based on TPM2 policy authentication. Defaults
352 to <literal>no</literal>. Despite being called PIN, any character can be used, not just numbers.
353 </para>
354
f0f4fcae
LP
355 <para>Note that incorrect PIN entry when unlocking increments the TPM dictionary attack lockout
356 mechanism, and may lock out users for a prolonged time, depending on its configuration. The lockout
357 mechanism is a global property of the TPM, <command>systemd-cryptenroll</command> does not control or
358 configure the lockout mechanism. You may use tpm2-tss tools to inspect or configure the dictionary
359 attack lockout, with <citerefentry
360 project='mankier'><refentrytitle>tpm2_getcap</refentrytitle><manvolnum>1</manvolnum></citerefentry>
361 and <citerefentry
362 project='mankier'><refentrytitle>tpm2_dictionarylockout</refentrytitle><manvolnum>1</manvolnum></citerefentry>
caeb5604
GG
363 commands, respectively.</para></listitem>
364 </varlistentry>
365
f0f4fcae
LP
366 <varlistentry>
367 <term><option>--tpm2-public-key=</option><arg>PATH</arg></term>
368 <term><option>--tpm2-public-key-pcrs=</option><arg rep="repeat">PCR</arg></term>
369 <term><option>--tpm2-signature=</option><arg>PATH</arg></term>
370
371 <listitem><para>Configures a TPM2 signed PCR policy to bind encryption to. The
372 <option>--tpm2-public-key=</option> option accepts a path to a PEM encoded RSA public key, to bind
373 the encryption to. If this is not specified explicitly, but a file
374 <filename>tpm2-pcr-public-key.pem</filename> exists in one of the directories
375 <filename>/etc/systemd/</filename>, <filename>/run/systemd/</filename>,
376 <filename>/usr/lib/systemd/</filename> (searched in this order), it is automatically used. The
377 <option>--tpm2-public-key-pcrs=</option> option takes a list of TPM2 PCR indexes to bind to (same
378 syntax as <option>--tpm2-pcrs=</option> described above). If not specified defaults to 11 (i.e. this
379 binds the policy to any unified kernel image for which a PCR signature can be provided).</para>
380
381 <para>Note the difference between <option>--tpm2-pcrs=</option> and
382 <option>--tpm2-public-key-pcrs=</option>: the former binds decryption to the current, specific PCR
383 values; the latter binds decryption to any set of PCR values for which a signature by the specified
384 public key can be provided. The latter is hence more useful in scenarios where software updates shell
385 be possible without losing access to all previously encrypted LUKS2 volumes.</para>
386
387 <para>The <option>--tpm2-signature=</option> option takes a path to a TPM2 PCR signature file
388 as generated by the
389 <citerefentry><refentrytitle>systemd-measure</refentrytitle><manvolnum>1</manvolnum></citerefentry>
8b9f0921 390 tool. If this is not specified explicitly a suitable signature file
f0f4fcae
LP
391 <filename>tpm2-pcr-signature.json</filename> is searched for in <filename>/etc/systemd/</filename>,
392 <filename>/run/systemd/</filename>, <filename>/usr/lib/systemd/</filename> (in this order) and
393 used. If a signature file is specified or found it is used to verify if the volume can be unlocked
394 with it given the current PCR state, before the new slot is written to disk. This is intended as
395 safety net to ensure that access to a volume is not lost if a public key is enrolled for which no
396 valid signature for the current PCR state is available. If the supplied signature does not unlock the
397 current PCR state and public key combination, no slot is enrolled and the operation will fail. If no
398 signature file is specified or found no such safety verification is done.</para></listitem>
399 </varlistentry>
400
cf1e172d
LP
401 <varlistentry>
402 <term><option>--wipe-slot=</option><arg rep="repeat">SLOT</arg></term>
403
404 <listitem><para>Wipes one or more LUKS2 key slots. Takes a comma separated list of numeric slot
405 indexes, or the special strings <literal>all</literal> (for wiping all key slots),
406 <literal>empty</literal> (for wiping all key slots that are unlocked by an empty passphrase),
407 <literal>password</literal> (for wiping all key slots that are unlocked by a traditional passphrase),
408 <literal>recovery</literal> (for wiping all key slots that are unlocked by a recovery key),
409 <literal>pkcs11</literal> (for wiping all key slots that are unlocked by a PKCS#11 token),
410 <literal>fido2</literal> (for wiping all key slots that are unlocked by a FIDO2 token),
411 <literal>tpm2</literal> (for wiping all key slots that are unlocked by a TPM2 chip), or any
412 combination of these strings or numeric indexes, in which case all slots matching either are
413 wiped. As safety precaution an operation that wipes all slots without exception (so that the volume
414 cannot be unlocked at all anymore, unless the volume key is known) is refused.</para>
415
416 <para>This switch may be used alone, in which case only the requested wipe operation is executed. It
417 may also be used in combination with any of the enrollment options listed above, in which case the
418 enrollment is completed first, and only when successful the wipe operation executed — and the newly
419 added slot is always excluded from the wiping. Combining enrollment and slot wiping may thus be used to
420 update existing enrollments:</para>
421
422 <programlisting>systemd-cryptenroll /dev/sda1 --wipe-slot=tpm2 --tpm2-device=auto</programlisting>
423
45861042 424 <para>The above command will enroll the TPM2 chip, and then wipe all previously created TPM2
cf1e172d
LP
425 enrollments on the LUKS2 volume, leaving only the newly created one. Combining wiping and enrollment
426 may also be used to replace enrollments of different types, for example for changing from a PKCS#11
427 enrollment to a FIDO2 one:</para>
428
429 <programlisting>systemd-cryptenroll /dev/sda1 --wipe-slot=pkcs11 --fido2-device=auto</programlisting>
430
431 <para>Or for replacing an enrolled empty password by TPM2:</para>
432
433 <programlisting>systemd-cryptenroll /dev/sda1 --wipe-slot=empty --tpm2-device=auto</programlisting>
434 </listitem>
435 </varlistentry>
436
437 <xi:include href="standard-options.xml" xpointer="help" />
438 <xi:include href="standard-options.xml" xpointer="version" />
439 </variablelist>
440
441 </refsect1>
442
443 <refsect1>
444 <title>Exit status</title>
445
446 <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
447 </refsect1>
448
449 <refsect1>
450 <title>See Also</title>
451 <para>
452 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
453 <citerefentry><refentrytitle>systemd-cryptsetup@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
454 <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
f0f4fcae
LP
455 <citerefentry project='die-net'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
456 <citerefentry><refentrytitle>systemd-measure</refentrytitle><manvolnum>1</manvolnum></citerefentry>
cf1e172d
LP
457 </para>
458 </refsect1>
459
460</refentry>