SYSTEMD-CRYPTENROLL(1) systemd-cryptenroll SYSTEMD-CRYPTENROLL(1) systemd-cryptenroll - / PKCS#11 FIDO2 TPM2 LUKS2 systemd-cryptenroll [OPTIONS...] [DEVICE] systemd-cryptenroll LUKS2 . : 1. PKCS#11 RSA EC ( YubiKey ) 2. FIDO2 "hmac-secret" ( FIDO2 YubiKey) 3. TPM2 4. 5. . (entropy) . . QR. LUKS2 . . . . LUKS2 LUKS2 JSON . systemd-cryptsetup /var/ . ( /var/ .) PCRs TPM2 (PCRs) ( " ") . --tpm2-pcrs= . : PCR . . +initrd +initrd . --tpm2-public-key= --tpm2-public-key-pcrs= --tpm2-signature= . UAPI.7 Linux TPM PCR Registry[1] PCRs . PCRs systemd. 1. PCR +----+---------------------+-------------------------------------------------------------------+ |PCR | | | +----+---------------------+-------------------------------------------------------------------+ |0 | platform-code | | | | | | | | | | | | | | | | | | +----+---------------------+-------------------------------------------------------------------+ |1 | platform-config | | | | | | | | | / | | | | | | | | | | | | | | | | | | | | // | +----+---------------------+-------------------------------------------------------------------+ |2 | external-code | | | | | | | | | | | | | (ROMs) | | | | | | | | | +----+---------------------+-------------------------------------------------------------------+ |3 | external-config | | | | | | | | | | | | | | | | | | +----+---------------------+-------------------------------------------------------------------+ |4 | boot-loader-code | | | | | PE | | | | | | | | | | | | . | | | | sd-stub(7) | | | | ESP | | | | ( systemd-sysext(8)). | +----+---------------------+-------------------------------------------------------------------+ |5 | boot-loader-config | GPT | | | | | | | | | +----+---------------------+-------------------------------------------------------------------+ |7 | secure-boot-policy | | | | | / | | | | UEFI | | | | | | | | (PK KEK | | | | db dbx ...). | +----+---------------------+-------------------------------------------------------------------+ |9 | kernel-initrd | | | | | initrds | | | | PCR . | +----+---------------------+-------------------------------------------------------------------+ |10 | ima | IMA | | | | PCR | | | | . | +----+---------------------+-------------------------------------------------------------------+ |11 | kernel-boot | systemd-stub(7) ELF | | | | initrd | | | | PE | | | | PCR . | | | | systemd-pcrphase.service(8) | | | | PCR | | | | | | | | . | +----+---------------------+-------------------------------------------------------------------+ |12 | kernel-config | systemd-boot(7) | | | | PCR . | | | | systemd-stub(7) | | | | ( | | | | | | | | PE ) | | | | | | | | PCR . | +----+---------------------+-------------------------------------------------------------------+ |13 | sysexts | systemd-stub(7) systemd-sysext(8) | | | | | | | | PCR . | +----+---------------------+-------------------------------------------------------------------+ |14 | shim-policy | shim "MOK" | | | | PCR | | | | . | +----+---------------------+-------------------------------------------------------------------+ |15 | system-identity | systemd-cryptsetup(8) | | | | LUKS | | | | PCR . | | | | systemd-pcrmachine.service(8) | | | | machine-id(5) PCR . | | | | systemd-pcrfs@.service(8) | | | | | | | | UUIDs | | | | UUID | | | | /var/ | | | | PCR . | +----+---------------------+-------------------------------------------------------------------+ |16 | debug | | +----+---------------------+-------------------------------------------------------------------+ |23 | application-support | | +----+---------------------+-------------------------------------------------------------------+ PCRs 7 11 14 ( shim/MOK). PCRs 0 2 PCR 7. / : . UAPI.7 Linux TPM PCR Registry[1] . FIDO2 TPM2. PKCS#11 PKCS#11 . FIDO2 TPM2 . FIDO2 . FIDO2 systemd-cryptsetup . FIDO2 (UV ) . PIN . PKCS#11. systemd . TPM2 FIDO2 PKCS#11 systemd. : o systemd-cryptsetup@.service(8). o : systemd-cryptenroll systemd-cryptsetup. systemd-cryptenroll systemd-cryptsetup . systemd. : --unlock-key-file=PATH / . PATH . --key-file-offset= --key-file-size= . 252. --unlock-fido2-device=PATH FIDO2 / . hidraw FIDO2 ( /dev/hidraw1). "auto" ( ). --fido2-device= . FIDO2 LUKS2 ( --fido2-parameters-in-header=no) . 253. --unlock-tpm2-device=PATH TPM2 / . TPM2 ( /dev/tpmrm0). "auto" TPM2 ( ). 256. : --password / . cryptsetup luksAddKey --wipe-slot= . 248. --recovery-key . . (QR code). 248. PKCS#11 PKCS#11: --pkcs11-token-uri= PKCS#11 ( YubiKey). PKCS#11 X.509 . . "auto" . "list" PKCS#11 . PKCS#11 RSA EC LUKS2. RSA LUKS2 JSON. . ECC ECDH: EC EC . . LUKS2 JSON. . . LUKS2 PKCS#11 pkcs11-uri= /etc/crypttab : myvolume /dev/sda1 none pkcs11-uri=auto crypttab(5) systemd-cryptenroll /etc/crypttab . 248. FIDO2 FIDO2: --fido2-device= FIDO2 "hmac-secret" ( YubiKey). hidraw FIDO2 ( /dev/hidraw1). "auto" ( ). --unlock-fido2-device= . "list" FIDO2 . FIDO2 PKCS#11 . FIDO2 . LUKS2 FIDO2 fido2-device= /etc/crypttab : myvolume /dev/sda1 none fido2-device=auto crypttab(5) systemd-cryptenroll /etc/crypttab . 248. --fido2-credential-algorithm= COSE . "es256". "es256" "rs256" "eddsa". "es256" ECDSA NIST P-256 SHA-256. "rs256" RSA 2048 PKCS#1.5 SHA-256. "eddsa" EDDSA Curve25519 SHA-512. . 251. --fido2-salt-file= FIDO2 AF_UNIX (salt) HMAC FIDO2. . 257. --fido2-parameters-in-header=_ FIDO2 FIDO2 LUKS2 (superblock). "yes". "no" fido2-cid= /etc/crypttab . crypttab(5) . 257. --fido2-with-client-pin=_ FIDO2 PIN ( FIDO2 "clientPin"). "yes". (: "clientPin" .) 249. --fido2-with-user-presence=_ FIDO2 ( FIDO2 "up") . "yes". (: "up" .) 249. --fido2-with-user-verification=_ FIDO2 ( FIDO2 "uv"). "no". (: "uv" .) 249. TPM2 TPM2: --tpm2-device= TPM2. TPM2 ( /dev/tpmrm0). "auto" TPM2 ( ). "list" TPM2 . LUKS2 TPM2 tpm2-device= /etc/crypttab : myvolume /dev/sda1 none tpm2-device=auto crypttab(5) systemd-cryptenroll /etc/crypttab . --tpm2-pcrs= ( ) TPM2 PCR . 248. --tpm2-device-key= TPM2 . TPM2 TPM2B_PUBLIC. --tpm2-device= TPM2 TPM2 . TPM2 . (SRK) TPM2 . ( SRK) --tpm2-seal-key-handle=. systemd-tpm2-setup.service(8) SRK /run/systemd/tpm2-srk-public-key.tpm2b_public . systemd-analyze srk SRK TPM2 . systemd-analyze(1) . : systemd-analyze srk > srk.tpm2b_public 255. --tpm2-seal-key-handle= (sealing) () TPM . "" () " " ( ) . 32 "0x". ("0x81000000"-"0x81ffffff") ("0x80000000"-"0x80ffffff"). TPM TPM . (SRK) "0x81000001". 0 . SRK TPM TPM . . 255. --tpm2-pcrs=PCR[+PCR...] (TPM2 PCRs) --tpm2-device=. PCR 0...23 ":" ( PCR) "=" . PCR "+". PCR ( ). PCR . : --tpm2-pcrs=boot-loader-code+platform-config+boot-loader-config PCR 4 1 5. : --tpm2-pcrs=7:sha256 PCR 7 SHA256. : --tpm2-pcrs=4:sha1=3a3f780f11a4b49969fcaa80cd6e3957c33b2275 PCR 4 SHA1 3a3f780f11a4b49969fcaa80cd6e3957c33b2275 PCR . 248. --tpm2-with-pin=_ TPM2 PIN PCR TPM2. "no". PIN . PIN TPM . TPM systemd-cryptenroll . tpm2-tss tpm2_getcap(1) tpm2_dictionarylockout(1) . 251. --tpm2-public-key= --tpm2-public-key-pcrs=PCR[+PCR...] --tpm2-signature= PCR TPM2 . --tpm2-public-key= RSA PEM . tpm2-pcr-public-key.pem /etc/systemd/ /run/systemd/ /usr/lib/systemd/ ( ) . --tpm2-public-key-pcrs= TPM2 PCR ( --tpm2-pcrs= ). 11 ( PCR ). --tpm2-pcrs= --tpm2-public-key-pcrs=: PCR PCR . LUKS2 . --tpm2-pcrs= --tpm2-public-key-pcrs=boot-loader-code+system-identity. --tpm2-signature= TPM2 PCR systemd-measure(1). tpm2-pcr-signature.json /etc/systemd/ /run/systemd/ /usr/lib/systemd/ ( ) . PCR (slot) . PCR . PCR . . 252. --tpm2-pcrlock= pcrlock TPM2 . pcrlock systemd-pcrlock(8). TPM2 pcrlock.json /run/systemd/ /var/lib/systemd/ . . 255. : --wipe-slot=[,...] LUKS2 . "all" ( ) "empty" ( ) "password" ( ) "recovery" ( ) "pkcs11" ( PKCS#11) "fido2" ( FIDO2) "tpm2" ( TPM2) . ( ). . -- . : systemd-cryptenroll /dev/sda1 --wipe-slot=tpm2 --tpm2-device=auto --unlock-tpm2-device=auto TPM2 TPM2 LUKS2 . PKCS#11 FIDO2: systemd-cryptenroll /dev/sda1 --wipe-slot=pkcs11 --fido2-device=auto TPM2: systemd-cryptenroll /dev/sda1 --wipe-slot=empty --tpm2-device=auto 248. --list-devices . LUKS . hmac-secret . 257. -h --help . --version . --no-pager (pager). systemd-cryptenroll ImportCredential=/LoadCredential=/SetCredential= ( systemd.exec(5) ). : cryptenroll.passphrase cryptenroll.new-passphrase / . 256. cryptenroll.tpm2-pin cryptenroll.new-tpm2-pin PIN TPM2 / . 256. cryptenroll.fido2-pin FIDO2 PIN . 256. cryptenroll.pkcs11-pin PKCS#11 PIN . 256. 0 . crypttab(5) systemd-measure(1) systemd-cryptenroll. systemd(1) systemd-cryptsetup@.service(8) crypttab(5) cryptsetup(8) systemd-measure(1) 1. UAPI.7 Linux TPM PCR https://uapi-group.org/specifications/specs/linux_tpm_pcr_registry/ 3 . . : . systemd 260.1 SYSTEMD-CRYPTENROLL(1)