Debian Codegraph @

upstream/debian-unstable/man1/systemd-cryptenroll.1

raw
1 '\" t
2 .TH "SYSTEMD\-CRYPTENROLL" "1" "" "systemd 261~rc3" "systemd-cryptenroll"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd-cryptenroll \- Enroll PKCS#11, FIDO2, TPM2 token/devices to LUKS2 encrypted volumes
24 .SH "SYNOPSIS"
25 .HP \w'\fBsystemd\-cryptenroll\fR\ 'u
26 \fBsystemd\-cryptenroll\fR [OPTIONS...] [DEVICE]
27 .SH "DESCRIPTION"
28 .PP
29 \fBsystemd\-cryptenroll\fR
30 is a tool for enrolling hardware security tokens and devices into a LUKS2 encrypted volume, which may then be used to unlock the volume during boot\&. Specifically, it supports tokens and credentials of the following kind to be enrolled:
31 .sp
32 .RS 4
33 .ie n \{\
34 \h'-04' 1.\h'+01'\c
35 .\}
36 .el \{\
37 .sp -1
38 .IP " 1." 4.2
39 .\}
40 PKCS#11 security tokens and smartcards that may carry an RSA or EC key pair (e\&.g\&. various YubiKeys)
41 .RE
42 .sp
43 .RS 4
44 .ie n \{\
45 \h'-04' 2.\h'+01'\c
46 .\}
47 .el \{\
48 .sp -1
49 .IP " 2." 4.2
50 .\}
51 FIDO2 security tokens that implement the
52 "hmac\-secret"
53 extension (most FIDO2 keys, including YubiKeys)
54 .RE
55 .sp
56 .RS 4
57 .ie n \{\
58 \h'-04' 3.\h'+01'\c
59 .\}
60 .el \{\
61 .sp -1
62 .IP " 3." 4.2
63 .\}
64 TPM2 security devices
65 .RE
66 .sp
67 .RS 4
68 .ie n \{\
69 \h'-04' 4.\h'+01'\c
70 .\}
71 .el \{\
72 .sp -1
73 .IP " 4." 4.2
74 .\}
75 Regular passphrases
76 .RE
77 .sp
78 .RS 4
79 .ie n \{\
80 \h'-04' 5.\h'+01'\c
81 .\}
82 .el \{\
83 .sp -1
84 .IP " 5." 4.2
85 .\}
86 Recovery keys\&. These are similar to regular passphrases, however are randomly generated on the computer and thus generally have higher entropy than user\-chosen passphrases\&. Their character set has been designed to ensure they are easy to type in, while having high entropy\&. They may also be scanned off screen using QR codes\&. Recovery keys may be used for unlocking LUKS2 volumes wherever passphrases are accepted\&. They are intended to be used in combination with an enrolled hardware security token, as a recovery option when the token is lost\&.
87 .RE
88 .PP
89 In addition, the tool may be used to enumerate currently enrolled security tokens and wipe a subset of them\&. The latter may be combined with the enrollment operation of a new security token, in order to update or replace enrollments\&.
90 .PP
91 The tool supports only LUKS2 volumes, as it stores token meta\-information in the LUKS2 JSON token area, which is not available in other encryption formats\&.
92 .PP
93 \fBsystemd\-cryptsetup\fR
94 operates on the device backing
95 /var/
96 if no device is specified explicitly, and no wipe operation is requested\&. (Note that in the typical case where
97 /var/
98 is on the same file system as the root file system, this hence enrolls a key into the backing device of the root file system\&.)
99 .SS "TPM2 PCRs and policies"
100 .PP
101 PCRs allow binding of the encryption of secrets to specific software versions and system state, so that the enrolled key is only accessible (may be "unsealed") if specific trusted software and/or configuration is used\&. Such bindings may be created with the option
102 \fB\-\-tpm2\-pcrs=\fR
103 described below\&.
104 .PP
105 Secrets may also be bound indirectly: a signed policy for a state of some combination of PCR values is provided, and the secret is bound to the public part of the key used to sign this policy\&. This means that the owner of a key can generate a sequence of signed policies, for specific software versions and system states, and the secret can be decrypted as long as the machine state matches one of those policies\&. For example, a vendor may provide such a policy for each kernel+initrd update, allowing users to encrypt secrets so that they can be decrypted when running any kernel+initrd signed by the vendor\&. Such bindings may be created with the options
106 \fB\-\-tpm2\-public\-key=\fR,
107 \fB\-\-tpm2\-public\-key\-pcrs=\fR,
108 \fB\-\-tpm2\-signature=\fR
109 described below\&.
110 .PP
111 See
112 \m[blue]\fBUAPI\&.7 Linux TPM PCR Registry\fR\m[]\&\s-2\u[1]\d\s+2
113 for an authoritative list of PCRs and how they are updated\&. The table below contains a quick reference, describing in particular the PCRs modified by systemd\&.
114 .sp
115 .it 1 an-trap
116 .nr an-no-space-flag 1
117 .nr an-break-flag 1
118 .br
119 .B Table\ \&1.\ \&Well\-known PCR Definitions
120 .TS
121 allbox tab(:);
122 lB lB lB.
123 T{
124 PCR
125 T}:T{
126 name
127 T}:T{
128 Explanation
129 T}
130 .T&
131 l l l
132 l l l
133 l l l
134 l l l
135 l l l
136 l l l
137 l l l
138 l l l
139 l l l
140 l l l
141 l l l
142 l l l
143 l l l
144 l l l
145 l l l
146 l l l.
147 T{
148 0
149 T}:T{
150 platform\-code
151 T}:T{
152 Core system firmware executable code; changes on firmware updates
153 T}
154 T{
155 1
156 T}:T{
157 platform\-config
158 T}:T{
159 Core system firmware data/host platform configuration; typically contains serial and model numbers, changes on basic hardware/CPU/RAM replacements
160 T}
161 T{
162 2
163 T}:T{
164 external\-code
165 T}:T{
166 Extended or pluggable executable code; includes option ROMs on pluggable hardware
167 T}
168 T{
169 3
170 T}:T{
171 external\-config
172 T}:T{
173 Extended or pluggable firmware data; includes information about pluggable hardware
174 T}
175 T{
176 4
177 T}:T{
178 boot\-loader\-code
179 T}:T{
180 Boot loader and additional drivers, PE binaries invoked by the boot loader; changes on boot loader updates\&. \fBsd-stub\fR(7) measures system extension images read from the ESP here too (see \fBsystemd-sysext\fR(8))\&.
181 T}
182 T{
183 5
184 T}:T{
185 boot\-loader\-config
186 T}:T{
187 GPT/Partition table; changes when the partitions are added, modified, or removed
188 T}
189 T{
190 7
191 T}:T{
192 secure\-boot\-policy
193 T}:T{
194 Secure Boot state; changes when UEFI SecureBoot mode is enabled/disabled, or firmware certificates (PK, KEK, db, dbx, \&...) changes\&.
195 T}
196 T{
197 9
198 T}:T{
199 kernel\-initrd
200 T}:T{
201 The Linux kernel measures all initrds it receives into this PCR\&.
202 T}
203 T{
204 10
205 T}:T{
206 ima
207 T}:T{
208 The IMA project measures its runtime state into this PCR\&.
209 T}
210 T{
211 11
212 T}:T{
213 kernel\-boot
214 T}:T{
215 \fBsystemd-stub\fR(7) measures the ELF kernel image, embedded initrd and other payload of the PE image it is placed in into this PCR\&. \fBsystemd-pcrphase.service\fR(8) measures boot phase strings into this PCR at various milestones of the boot process\&.
216 T}
217 T{
218 12
219 T}:T{
220 kernel\-config
221 T}:T{
222 \fBsystemd-boot\fR(7) measures the kernel command line into this PCR\&. \fBsystemd-stub\fR(7) 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\&.
223 T}
224 T{
225 13
226 T}:T{
227 sysexts
228 T}:T{
229 \fBsystemd-stub\fR(7) measures any \fBsystemd-sysext\fR(8) images it passes to the booted kernel into this PCR\&.
230 T}
231 T{
232 14
233 T}:T{
234 shim\-policy
235 T}:T{
236 The shim project measures its "MOK" certificates and hashes into this PCR\&.
237 T}
238 T{
239 15
240 T}:T{
241 system\-identity
242 T}:T{
243 \fBsystemd-cryptsetup\fR(8) optionally measures the volume key of activated LUKS volumes into this PCR\&. \fBsystemd-pcrmachine.service\fR(8) measures the \fBmachine-id\fR(5) into this PCR\&. \[email protected]\fR(8) measures mount points, file system UUIDs, labels, partition UUIDs of the root and /var/ filesystems into this PCR\&.
244 T}
245 T{
246 16
247 T}:T{
248 debug
249 T}:T{
250 Debug
251 T}
252 T{
253 23
254 T}:T{
255 application\-support
256 T}:T{
257 Application Support
258 T}
259 .TE
260 .sp 1
261 .PP
262 In general, encrypted volumes would be bound to some combination of PCRs 7, 11, and 14 (if shim/MOK is used)\&. In order to allow firmware and OS version updates, it is typically not advisable to use PCRs such as 0 and 2, since the program code they cover should already be covered indirectly through the certificates measured into PCR 7\&. Validation through certificates hashes is typically preferable over validation through direct measurements as it is less brittle in context of OS/firmware updates: the measurements will change on every update, but signatures should remain unchanged\&. See the
263 \m[blue]\fBUAPI\&.7 Linux TPM PCR Registry\fR\m[]\&\s-2\u[1]\d\s+2
264 for more discussion\&.
265 .SH "LIMITATIONS"
266 .PP
267 Note that currently when enrolling a new key of one of the five supported types listed above, it is required to first provide a passphrase, a recovery key, a FIDO2 token, or a TPM2 key\&. It\*(Aqs currently not supported to unlock a device with a PKCS#11 key in order to enroll a new PKCS#11 key\&. Thus, if in future key roll\-over is desired it is generally recommended to ensure a passphrase, a recovery key, a FIDO2 token, or a TPM2 key is always enrolled\&.
268 .PP
269 Also note that support for enrolling multiple FIDO2 tokens is currently limited\&. When multiple FIDO2 tokens are enrolled,
270 \fBsystemd\-cryptsetup\fR
271 will perform pre\-flight requests to attempt to identify which of the enrolled tokens are currently plugged in\&. However, this is not possible for FIDO2 tokens with user verification (UV, usually via biometrics), in which case it will fall back to attempting each enrolled token one by one\&. This will result in multiple prompts for PIN and user verification\&. This limitation does not apply to PKCS#11 tokens\&.
272 .SH "COMPATIBILITY"
273 .PP
274 Security technology both in systemd and in the general industry constantly evolves\&. In order to provide best security guarantees, the way TPM2, FIDO2, PKCS#11 devices are enrolled is regularly updated in newer versions of systemd\&. Whenever this happens the following compatibility guarantees are given:
275 .sp
276 .RS 4
277 .ie n \{\
278 \h'-04'\(bu\h'+03'\c
279 .\}
280 .el \{\
281 .sp -1
282 .IP \(bu 2.3
283 .\}
284 Old enrollments continue to be supported and may be unlocked with newer versions of
285 \[email protected]\fR(8)\&.
286 .RE
287 .sp
288 .RS 4
289 .ie n \{\
290 \h'-04'\(bu\h'+03'\c
291 .\}
292 .el \{\
293 .sp -1
294 .IP \(bu 2.3
295 .\}
296 The opposite is not guaranteed however: it might not be possible to unlock volumes with enrollments done with a newer version of
297 \fBsystemd\-cryptenroll\fR
298 with an older version of
299 \fBsystemd\-cryptsetup\fR\&.
300 .RE
301 .PP
302 That said, it is generally recommended to use matching versions of
303 \fBsystemd\-cryptenroll\fR
304 and
305 \fBsystemd\-cryptsetup\fR, since this is best tested and supported\&.
306 .PP
307 It might be advisable to re\-enroll existing enrollments to take benefit of newer security features, as they are added to systemd\&.
308 .SH "UNLOCKING"
309 .PP
310 The following options are understood that may be used to unlock the device in preparation of the enrollment operations:
311 .PP
312 \fB\-\-unlock\-key\-file=\fR\fB\fIPATH\fR\fR
313 .RS 4
314 Use a file instead of a password/passphrase read from stdin to unlock the volume\&. Expects the PATH to the file containing your key to unlock the volume\&. Currently there is nothing like
315 \fB\-\-key\-file\-offset=\fR
316 or
317 \fB\-\-key\-file\-size=\fR
318 so this file has to only contain the full key\&.
319 .sp
320 Added in version 252\&.
321 .RE
322 .PP
323 \fB\-\-unlock\-fido2\-device=\fR\fB\fIPATH\fR\fR
324 .RS 4
325 Use a FIDO2 device instead of a password/passphrase read from stdin to unlock the volume\&. Expects a
326 hidraw
327 device referring to the FIDO2 device (e\&.g\&.
328 /dev/hidraw1)\&. Alternatively the special value
329 "auto"
330 may be specified, in order to automatically determine the device node of a currently plugged in security token (of which there must be exactly one)\&. This automatic discovery is unsupported if
331 \fB\-\-fido2\-device=\fR
332 option is also specified\&. Note that currently FIDO2 devices enrolled without an accompanying LUKS2 token (i\&.e\&.
333 \fB\-\-fido2\-parameters\-in\-header=no\fR) cannot be used for unlocking\&.
334 .sp
335 Added in version 253\&.
336 .RE
337 .PP
338 \fB\-\-unlock\-tpm2\-device=\fR\fB\fIPATH\fR\fR
339 .RS 4
340 Use a TPM2 device instead of a password/passphrase read from stdin to unlock the volume\&. Expects a device node path referring to the TPM2 chip (e\&.g\&.
341 /dev/tpmrm0)\&. Alternatively the special value
342 "auto"
343 may be specified, in order to automatically determine the device node of a currently discovered TPM2 device (of which there must be exactly one)\&.
344 .sp
345 Added in version 256\&.
346 .RE
347 .SH "SIMPLE ENROLLMENT"
348 .PP
349 The following options are understood that may be used to enroll simple user input based unlocking:
350 .PP
351 \fB\-\-password\fR
352 .RS 4
353 Enroll a regular password/passphrase\&. This command is mostly equivalent to
354 \fBcryptsetup luksAddKey\fR, however may be combined with
355 \fB\-\-wipe\-slot=\fR
356 in one call, see below\&.
357 .sp
358 Added in version 248\&.
359 .RE
360 .PP
361 \fB\-\-recovery\-key\fR
362 .RS 4
363 Enroll a recovery key\&. Recovery keys are mostly identical to passphrases, but are computer\-generated instead of being chosen by a human, and thus have a guaranteed high entropy\&. The key uses a character set that is easy to type in, and may be scanned off screen via a QR code\&.
364 .sp
365 Added in version 248\&.
366 .RE
367 .SH "PKCS#11 ENROLLMENT"
368 .PP
369 The following option is understood that may be used to enroll PKCS#11 tokens:
370 .PP
371 \fB\-\-pkcs11\-token\-uri=\fR\fB\fIURI\fR\fR
372 .RS 4
373 Enroll a PKCS#11 security token or smartcard (e\&.g\&. a YubiKey)\&. Expects a PKCS#11 URI that allows finding an X\&.509 certificate or a public key on the token\&. The URI must also be suitable to find a related private key after changing the type of object in it\&. Alternatively the special value
374 "auto"
375 may be specified, in order to automatically determine the suitable URI if a single security token containing a single key pair is plugged in\&. The special value
376 "list"
377 may be used to enumerate all suitable PKCS#11 tokens currently plugged in\&.
378 .sp
379 The PKCS#11 token must contain an RSA or EC key pair which will be used to unlock a LUKS2 volume\&. For RSA, a randomly generated volume key is encrypted with a public key in the token, and stored in the LUKS2 JSON token header area\&. To unlock a volume, the stored encrypted volume key will be decrypted with a private key in the token\&. For ECC, ECDH algorithm is used: we generate a pair of EC keys in the same EC group, then derive a shared secret using the generated private key and the public key in the token\&. The derived shared secret is used as a volume key\&. The generated public key is stored in the LUKS2 JSON token header area\&. The generated private key is erased\&. To unlock a volume, we derive the shared secret with the stored public key and a private key in the token\&.
380 .sp
381 In order to unlock a LUKS2 volume with an enrolled PKCS#11 security token, specify the
382 \fBpkcs11\-uri=\fR
383 option in the respective
384 /etc/crypttab
385 line:
386 .sp
387 .if n \{\
388 .RS 4
389 .\}
390 .nf
391 myvolume /dev/sda1 none pkcs11\-uri=auto
392 .fi
393 .if n \{\
394 .RE
395 .\}
396 .sp
397 See
398 \fBcrypttab\fR(5)
399 for a more comprehensive example of a
400 \fBsystemd\-cryptenroll\fR
401 invocation and its matching
402 /etc/crypttab
403 line\&.
404 .sp
405 Added in version 248\&.
406 .RE
407 .SH "FIDO2 ENROLLMENT"
408 .PP
409 The following options are understood that may be used to enroll FIDO2 tokens:
410 .PP
411 \fB\-\-fido2\-device=\fR\fB\fIPATH\fR\fR
412 .RS 4
413 Enroll a FIDO2 security token that implements the
414 "hmac\-secret"
415 extension (e\&.g\&. a YubiKey)\&. Expects a
416 hidraw
417 device referring to the FIDO2 device (e\&.g\&.
418 /dev/hidraw1)\&. Alternatively the special value
419 "auto"
420 may be specified, in order to automatically determine the device node of a currently plugged in security token (of which there must be exactly one)\&. This automatic discovery is unsupported if
421 \fB\-\-unlock\-fido2\-device=\fR
422 option is also specified\&. The special value
423 "list"
424 may be used to enumerate all suitable FIDO2 tokens currently plugged in\&. Note that many hardware security tokens that implement FIDO2 also implement the older PKCS#11 standard\&. Typically FIDO2 is preferable, given it is simpler to use and more modern\&.
425 .sp
426 In order to unlock a LUKS2 volume with an enrolled FIDO2 security token, specify the
427 \fBfido2\-device=\fR
428 option in the respective
429 /etc/crypttab
430 line:
431 .sp
432 .if n \{\
433 .RS 4
434 .\}
435 .nf
436 myvolume /dev/sda1 none fido2\-device=auto
437 .fi
438 .if n \{\
439 .RE
440 .\}
441 .sp
442 See
443 \fBcrypttab\fR(5)
444 for a more comprehensive example of a
445 \fBsystemd\-cryptenroll\fR
446 invocation and its matching
447 /etc/crypttab
448 line\&.
449 .sp
450 Added in version 248\&.
451 .RE
452 .PP
453 \fB\-\-fido2\-credential\-algorithm=\fR\fB\fISTRING\fR\fR
454 .RS 4
455 Specify COSE algorithm used in credential generation\&. The default value is
456 "es256"\&. Supported values are
457 "es256",
458 "rs256"
459 and
460 "eddsa"\&.
461 .sp
462 "es256"
463 denotes ECDSA over NIST P\-256 with SHA\-256\&.
464 "rs256"
465 denotes 2048\-bit RSA with PKCS#1\&.5 padding and SHA\-256\&.
466 "eddsa"
467 denotes EDDSA over Curve25519 with SHA\-512\&.
468 .sp
469 Note that your authenticator may choose not to support some algorithms\&.
470 .sp
471 Added in version 251\&.
472 .RE
473 .PP
474 \fB\-\-fido2\-salt\-file=\fR\fB\fIPATH\fR\fR
475 .RS 4
476 When enrolling a FIDO2 security token, specifies the path to a file or an
477 \fBAF_UNIX\fR
478 socket from which we should read the salt value to be used in the HMAC operation performed by the FIDO2 security token\&. If this option is not specified, the salt will be randomly generated\&.
479 .sp
480 Added in version 257\&.
481 .RE
482 .PP
483 \fB\-\-fido2\-parameters\-in\-header=\fR\fB\fIBOOL\fR\fR
484 .RS 4
485 When enrolling a FIDO2 security token, controls whether to store FIDO2 parameters in a token in the LUKS2 superblock\&. Defaults to
486 "yes"\&. If set to
487 "no", the
488 \fBfido2\-cid=\fR
489 option has to be specified manually in the respective
490 /etc/crypttab
491 line along with a key file\&. See
492 \fBcrypttab\fR(5)
493 for details\&.
494 .sp
495 Added in version 257\&.
496 .RE
497 .PP
498 \fB\-\-fido2\-with\-client\-pin=\fR\fB\fIBOOL\fR\fR
499 .RS 4
500 When enrolling a FIDO2 security token, controls whether to require the user to enter a PIN when unlocking the volume (the FIDO2
501 "clientPin"
502 feature)\&. Defaults to
503 "yes"\&. (Note: this setting is without effect if the security token does not support the
504 "clientPin"
505 feature at all, or does not allow enabling or disabling it\&.)
506 .sp
507 Added in version 249\&.
508 .RE
509 .PP
510 \fB\-\-fido2\-with\-user\-presence=\fR\fB\fIBOOL\fR\fR
511 .RS 4
512 When enrolling a FIDO2 security token, controls whether to require the user to verify presence (tap the token, the FIDO2
513 "up"
514 feature) when unlocking the volume\&. Defaults to
515 "yes"\&. (Note: this setting is without effect if the security token does not support the
516 "up"
517 feature at all, or does not allow enabling or disabling it\&.)
518 .sp
519 Added in version 249\&.
520 .RE
521 .PP
522 \fB\-\-fido2\-with\-user\-verification=\fR\fB\fIBOOL\fR\fR
523 .RS 4
524 When enrolling a FIDO2 security token, controls whether to require user verification when unlocking the volume (the FIDO2
525 "uv"
526 feature)\&. Defaults to
527 "no"\&. (Note: this setting is without effect if the security token does not support the
528 "uv"
529 feature at all, or does not allow enabling or disabling it\&.)
530 .sp
531 Added in version 249\&.
532 .RE
533 .SH "TPM2 ENROLLMENT"
534 .PP
535 The following options are understood that may be used to enroll TPM2 devices:
536 .PP
537 \fB\-\-tpm2\-device=\fR\fB\fIPATH\fR\fR
538 .RS 4
539 Enroll a TPM2 security chip\&. Expects a device node path referring to the TPM2 chip (e\&.g\&.
540 /dev/tpmrm0)\&. Alternatively the special value
541 "auto"
542 may be specified, in order to automatically determine the device node of a currently discovered TPM2 device (of which there must be exactly one)\&. The special value
543 "list"
544 may be used to enumerate all suitable TPM2 devices currently discovered\&.
545 .sp
546 In order to unlock a LUKS2 volume with an enrolled TPM2 security chip, specify the
547 \fBtpm2\-device=\fR
548 option in the respective
549 /etc/crypttab
550 line:
551 .sp
552 .if n \{\
553 .RS 4
554 .\}
555 .nf
556 myvolume /dev/sda1 none tpm2\-device=auto
557 .fi
558 .if n \{\
559 .RE
560 .\}
561 .sp
562 See
563 \fBcrypttab\fR(5)
564 for a more comprehensive example of a
565 \fBsystemd\-cryptenroll\fR
566 invocation and its matching
567 /etc/crypttab
568 line\&.
569 .sp
570 Use
571 \fB\-\-tpm2\-pcrs=\fR
572 (see below) to configure which TPM2 PCR indexes to bind the enrollment to\&.
573 .sp
574 Added in version 248\&.
575 .RE
576 .PP
577 \fB\-\-tpm2\-device\-key=\fR\fB\fIPATH\fR\fR
578 .RS 4
579 Enroll a TPM2 security chip using its public key\&. Expects a path referring to the TPM2 public key in TPM2B_PUBLIC format\&. This cannot be used with
580 \fB\-\-tpm2\-device=\fR, as it performs the same operation, but without connecting to the TPM2 security chip; instead the enrollment is calculated using the provided TPM2 key\&. This is useful in situations where the TPM2 security chip is not available at the time of enrollment\&.
581 .sp
582 The key, in most cases, should be the Storage Root Key (SRK) from a local TPM2 security chip\&. If a key from a different handle (not the SRK) is used, you must specify its handle index using
583 \fB\-\-tpm2\-seal\-key\-handle=\fR\&.
584 .sp
585 The
586 \fBsystemd-tpm2-setup.service\fR(8)
587 service writes the SRK to
588 /run/systemd/tpm2\-srk\-public\-key\&.tpm2b_public
589 automatically during boot, in the correct format\&.
590 .sp
591 Alternatively, you may use
592 \fBsystemd\-analyze srk\fR
593 to retrieve the SRK from the TPM2 security chip explicitly\&. See
594 \fBsystemd-analyze\fR(1)
595 for details\&. Example:
596 .sp
597 .if n \{\
598 .RS 4
599 .\}
600 .nf
601 systemd\-analyze srk > srk\&.tpm2b_public
602 .fi
603 .if n \{\
604 .RE
605 .\}
606 .sp
607 Added in version 255\&.
608 .RE
609 .PP
610 \fB\-\-tpm2\-seal\-key\-handle=\fR\fB\fIHANDLE\fR\fR
611 .RS 4
612 Configures which parent key to use for sealing, using the TPM handle (index) of the key\&. This is used to "seal" (encrypt) a secret and must be used later to "unseal" (decrypt) the secret\&. Expects a hexadecimal 32bit integer, optionally prefixed with
613 "0x"\&. Allowable values are any handle index in the persistent ("0x81000000"\-"0x81ffffff") or transient ("0x80000000"\-"0x80ffffff") ranges\&. Since transient handles are lost after a TPM reset, and may be flushed during TPM context switching, they should not be used except for very specific use cases, e\&.g\&. testing\&.
614 .sp
615 The default is the Storage Root Key (SRK) handle index
616 "0x81000001"\&. A value of 0 will use the default\&. For the SRK handle, a new key will be created and stored in the TPM if one does not already exist; for any other handle, the key must already exist in the TPM at the specified handle index\&.
617 .sp
618 This should not be changed unless you know what you are doing\&.
619 .sp
620 Added in version 255\&.
621 .RE
622 .PP
623 \fB\-\-tpm2\-pcrs=\fR\fB\fIPCR\fR\fI[+PCR\&.\&.\&.]\fR\fR
624 .RS 4
625 Configures the TPM2 PCRs (Platform Configuration Registers) to bind to when enrollment is requested via
626 \fB\-\-tpm2\-device=\fR\&. Takes a list of PCR entries, where each entry starts with a name or numeric index in the range 0\&...23, optionally followed by
627 ":"
628 and a hash algorithm name (specifying the PCR bank), optionally followed by
629 "="
630 and a hash digest value\&. Multiple PCR entries are separated by
631 "+"\&. If an empty string is specified, binds the enrollment to no PCRs at all (this is also the default, if this option is not used)\&. See the table above for a list of available PCRs\&.
632 .sp
633 Example:
634 \fB\-\-tpm2\-pcrs=boot\-loader\-code+platform\-config+boot\-loader\-config\fR
635 specifies that PCR registers 4, 1, and 5 should be used\&.
636 .sp
637 Example:
638 \fB\-\-tpm2\-pcrs=7:sha256\fR
639 specifies that PCR register 7 from the SHA256 bank should be used\&.
640 .sp
641 Example:
642 \fB\-\-tpm2\-pcrs=4:sha1=3a3f780f11a4b49969fcaa80cd6e3957c33b2275\fR
643 specifies that PCR register 4 from the SHA1 bank should be used, and a hash digest value of 3a3f780f11a4b49969fcaa80cd6e3957c33b2275 will be used instead of reading the current PCR value\&.
644 .sp
645 Added in version 248\&.
646 .RE
647 .PP
648 \fB\-\-tpm2\-with\-pin=\fR\fB\fIBOOL\fR\fR
649 .RS 4
650 When enrolling a TPM2 device, controls whether to require the user to enter a PIN when unlocking the volume in addition to PCR binding, based on TPM2 policy authentication\&. Defaults to
651 "no"\&. Despite being called PIN, any character can be used, not just numbers\&.
652 .sp
653 Note that incorrect PIN entry when unlocking increments the TPM dictionary attack lockout mechanism, and may lock out users for a prolonged time, depending on its configuration\&. The lockout mechanism is a global property of the TPM,
654 \fBsystemd\-cryptenroll\fR
655 does not control or configure the lockout mechanism\&. You may use tpm2\-tss tools to inspect or configure the dictionary attack lockout, with
656 \fBtpm2_getcap\fR(1)
657 and
658 \fBtpm2_dictionarylockout\fR(1)
659 commands, respectively\&.
660 .sp
661 Added in version 251\&.
662 .RE
663 .PP
664 \fB\-\-tpm2\-public\-key=\fR\fB\fIPATH\fR\fR, \fB\-\-tpm2\-public\-key\-pcrs=\fR\fB\fIPCR\fR\fI[+PCR\&.\&.\&.]\fR\fR, \fB\-\-tpm2\-signature=\fR\fB\fIPATH\fR\fR
665 .RS 4
666 Configures a TPM2 signed PCR policy to bind encryption to\&. The
667 \fB\-\-tpm2\-public\-key=\fR
668 option accepts a path to a PEM encoded RSA public key, to bind the encryption to\&. If this is not specified explicitly, but a file
669 tpm2\-pcr\-public\-key\&.pem
670 exists in one of the directories
671 /etc/systemd/,
672 /run/systemd/,
673 /usr/lib/systemd/
674 (searched in this order), it is automatically used\&. The
675 \fB\-\-tpm2\-public\-key\-pcrs=\fR
676 option takes a list of TPM2 PCR indexes to bind to (same syntax as
677 \fB\-\-tpm2\-pcrs=\fR
678 described above)\&. If not specified, defaults to 11 (i\&.e\&. this binds the policy to any unified kernel image for which a PCR signature can be provided)\&.
679 .sp
680 Note the difference between
681 \fB\-\-tpm2\-pcrs=\fR
682 and
683 \fB\-\-tpm2\-public\-key\-pcrs=\fR: the former binds decryption to the current, specific PCR values; the latter binds decryption to any set of PCR values for which a signature by the specified public key can be provided\&. The latter is hence more useful in scenarios where software updates shall be possible without losing access to all previously encrypted LUKS2 volumes\&. Like with
684 \fB\-\-tpm2\-pcrs=\fR, names defined in the table above can also be used to specify the registers, for instance
685 \fB\-\-tpm2\-public\-key\-pcrs=boot\-loader\-code+system\-identity\fR\&.
686 .sp
687 The
688 \fB\-\-tpm2\-signature=\fR
689 option takes a path to a TPM2 PCR signature file as generated by the
690 \fBsystemd-measure\fR(1)
691 tool\&. If this is not specified explicitly, a suitable signature file
692 tpm2\-pcr\-signature\&.json
693 is searched for in
694 /etc/systemd/,
695 /run/systemd/,
696 /usr/lib/systemd/
697 (in this order) and used\&. If a signature file is specified or found it is used to verify if the volume can be unlocked with it given the current PCR state, before the new slot is written to disk\&. This is intended as safety net to ensure that access to a volume is not lost if a public key is enrolled for which no valid signature for the current PCR state is available\&. If the supplied signature does not unlock the current PCR state and public key combination, no slot is enrolled and the operation will fail\&. If no signature file is specified or found no such safety verification is done\&.
698 .sp
699 Added in version 252\&.
700 .RE
701 .PP
702 \fB\-\-tpm2\-pcrlock=\fR\fB\fIPATH\fR\fR
703 .RS 4
704 Configures a TPM2 pcrlock policy to bind encryption to\&. Expects a path to a pcrlock policy file as generated by the
705 \fBsystemd-pcrlock\fR(8)
706 tool\&. If a TPM2 device is enrolled and this option is not used but a file
707 pcrlock\&.json
708 is found in
709 /run/systemd/
710 or
711 /var/lib/systemd/
712 it is automatically used\&. Assign an empty string to turn this behaviour off\&.
713 .sp
714 Added in version 255\&.
715 .RE
716 .SH "OTHER OPTIONS"
717 .PP
718 The following additional options are understood:
719 .PP
720 \fB\-\-wipe\-slot=\fR\fB\fISLOT\fR\fI[,SLOT\&.\&.\&.]\fR\fR
721 .RS 4
722 Wipes one or more LUKS2 key slots\&. Takes a comma separated list of numeric slot indexes, or the special strings
723 "all"
724 (for wiping all key slots),
725 "empty"
726 (for wiping all key slots that are unlocked by an empty passphrase),
727 "password"
728 (for wiping all key slots that are unlocked by a traditional passphrase),
729 "recovery"
730 (for wiping all key slots that are unlocked by a recovery key),
731 "pkcs11"
732 (for wiping all key slots that are unlocked by a PKCS#11 token),
733 "fido2"
734 (for wiping all key slots that are unlocked by a FIDO2 token),
735 "tpm2"
736 (for wiping all key slots that are unlocked by a TPM2 chip), or any combination of these strings or numeric indexes, in which case all slots matching either are wiped\&. As safety precaution an operation that wipes all slots without exception (so that the volume cannot be unlocked at all anymore, unless the volume key is known) is refused\&.
737 .sp
738 This switch may be used alone, in which case only the requested wipe operation is executed\&. It may also be used in combination with any of the enrollment options listed above, in which case the enrollment is completed first, and only when successful the wipe operation executed \(em and the newly added slot is always excluded from the wiping\&. Combining enrollment and slot wiping may thus be used to update existing enrollments:
739 .sp
740 .if n \{\
741 .RS 4
742 .\}
743 .nf
744 systemd\-cryptenroll /dev/sda1 \-\-wipe\-slot=tpm2 \-\-tpm2\-device=auto \-\-unlock\-tpm2\-device=auto
745 .fi
746 .if n \{\
747 .RE
748 .\}
749 .sp
750 The above command will enroll the TPM2 chip, and then wipe all previously created TPM2 enrollments on the LUKS2 volume, leaving only the newly created one\&. Combining wiping and enrollment may also be used to replace enrollments of different types, for example for changing from a PKCS#11 enrollment to a FIDO2 one:
751 .sp
752 .if n \{\
753 .RS 4
754 .\}
755 .nf
756 systemd\-cryptenroll /dev/sda1 \-\-wipe\-slot=pkcs11 \-\-fido2\-device=auto
757 .fi
758 .if n \{\
759 .RE
760 .\}
761 .sp
762 Or for replacing an enrolled empty password by TPM2:
763 .sp
764 .if n \{\
765 .RS 4
766 .\}
767 .nf
768 systemd\-cryptenroll /dev/sda1 \-\-wipe\-slot=empty \-\-tpm2\-device=auto
769 .fi
770 .if n \{\
771 .RE
772 .\}
773 .sp
774 Added in version 248\&.
775 .RE
776 .PP
777 \fB\-\-list\-devices\fR
778 .RS 4
779 Show a list of candidate block devices this command may operate on\&. Specifically, this enumerates block devices currently present that contain a LUKS superblock, and shows their device node paths along with any of their symlinks\&. The devices must implement the
780 \fBhmac\-secret\fR
781 extension to be usable\&.
782 .sp
783 Added in version 257\&.
784 .RE
785 .PP
786 \fB\-h\fR, \fB\-\-help\fR
787 .RS 4
788 Print a short help text and exit\&.
789 .RE
790 .PP
791 \fB\-\-version\fR
792 .RS 4
793 Print a short version string and exit\&.
794 .RE
795 .PP
796 \fB\-\-no\-pager\fR
797 .RS 4
798 Do not pipe output into a pager\&.
799 .RE
800 .SH "CREDENTIALS"
801 .PP
802 \fBsystemd\-cryptenroll\fR
803 supports the service credentials logic as implemented by
804 \fIImportCredential=\fR/\fILoadCredential=\fR/\fISetCredential=\fR
805 (see
806 \fBsystemd.exec\fR(5)
807 for details)\&. The following credentials are used when passed in:
808 .PP
809 \fIcryptenroll\&.passphrase\fR, \fIcryptenroll\&.new\-passphrase\fR
810 .RS 4
811 May contain the passphrase to unlock the volume with/to newly enroll\&.
812 .sp
813 Added in version 256\&.
814 .RE
815 .PP
816 \fIcryptenroll\&.tpm2\-pin\fR, \fIcryptenroll\&.new\-tpm2\-pin\fR
817 .RS 4
818 May contain the TPM2 PIN to unlock the volume with/to newly enroll\&.
819 .sp
820 Added in version 256\&.
821 .RE
822 .PP
823 \fIcryptenroll\&.fido2\-pin\fR
824 .RS 4
825 If a FIDO2 token is enrolled this may contain the PIN of the token\&.
826 .sp
827 Added in version 256\&.
828 .RE
829 .PP
830 \fIcryptenroll\&.pkcs11\-pin\fR
831 .RS 4
832 If a PKCS#11 token is enrolled this may contain the PIN of the token\&.
833 .sp
834 Added in version 256\&.
835 .RE
836 .SH "EXIT STATUS"
837 .PP
838 On success, 0 is returned, a non\-zero failure code otherwise\&.
839 .SH "EXAMPLES"
840 .PP
841 \fBcrypttab\fR(5)
842 and
843 \fBsystemd-measure\fR(1)
844 contain various examples employing
845 \fBsystemd\-cryptenroll\fR\&.
846 .SH "SEE ALSO"
847 .PP
848 \fBsystemd\fR(1), \[email protected]\fR(8), \fBcrypttab\fR(5), \fBcryptsetup\fR(8), \fBsystemd-measure\fR(1)
849 .SH "NOTES"
850 .IP " 1." 4
851 UAPI.7 Linux TPM PCR Registry
852 .RS 4
853 \%https://uapi-group.org/specifications/specs/linux_tpm_pcr_registry/
854 .RE