J’ai réussi à faire un déchiffrement automatique avec TPM2.
systemd-cryptenroll /dev/mdXX --tpm2-device=auto --tpm2-pcrs=7+14
Je parlais précédemment du PCR 15 mais en fait c’est plutôt le 14 qu’il faut que je teste. pour le 15, il faut que relise plus clairement le document trouvé sur internet pour comprendre pourquoi il parle du PCR 15.
┌────┬────────────────────────────────────────────────────────────────────┐
│PCR │ Explanation │
├────┼────────────────────────────────────────────────────────────────────┤
│0 │ Core system firmware executable code; changes on firmware updates │
├────┼────────────────────────────────────────────────────────────────────┤
│1 │ Core system firmware data/host platform configuration; typically │
│ │ contains serial and model numbers, changes on basic │
│ │ hardware/CPU/RAM replacements │
├────┼────────────────────────────────────────────────────────────────────┤
│2 │ Extended or pluggable executable code; includes option ROMs on │
│ │ pluggable hardware │
├────┼────────────────────────────────────────────────────────────────────┤
│3 │ Extended or pluggable firmware data; includes information about │
│ │ pluggable hardware │
├────┼────────────────────────────────────────────────────────────────────┤
│4 │ 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. sd-stub(7) measures system │
│ │ extension images read from the ESP here too (see systemd- │
│ │ sysext(8)). │
├────┼────────────────────────────────────────────────────────────────────┤
│5 │ GPT/Partition table; changes when the partitions are added, │
│ │ modified or removed │
├────┼────────────────────────────────────────────────────────────────────┤
│6 │ Power state events; changes on system suspend/sleep │
├────┼────────────────────────────────────────────────────────────────────┤
│7 │ 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. │
├────┼────────────────────────────────────────────────────────────────────┤
│9 │ The Linux kernel measures all initrds it receives into this PCR. │
├────┼────────────────────────────────────────────────────────────────────┤
│10 │ The IMA project measures its runtime state into this PCR. │
├────┼────────────────────────────────────────────────────────────────────┤
│11 │ systemd-stub(7) 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. │
│ │ systemd-pcrphase.service(8) measures boot phase strings into this │
│ │ PCR at various milestones of the boot process. │
├────┼────────────────────────────────────────────────────────────────────┤
│12 │ systemd-boot(7) measures any specified kernel command line into │
│ │ this PCR. systemd-stub(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. (Note that if systemd-boot and systemd-stub are used in │
│ │ combination the command line might be measured twice!) │
├────┼────────────────────────────────────────────────────────────────────┤
│13 │ systemd-stub(7) measures any systemd-sysext(8) images it loads and │
│ │ passed to the booted kernel into this PCR. │
├────┼────────────────────────────────────────────────────────────────────┤
│14 │ The shim project measures its "MOK" certificates and hashes into │
│ │ this PCR. │
└────┴────────────────────────────────────────────────────────────────────┘
Mais dans tous les cas, il faut toujours entrer la passphrase au niveau de EUFI et en clavier QWERTY.
Je pense que seul l’UKI permettra de se passer de cette partie. Ou alors il faut recréer le shimx64.efi avec le bon keymap, et le chiffrer pour soit en accord avec les clef du Secure Boot.
Sachant, sauf erreur de ma part, que les PCR 0 à 7 sont tous résumé dans le PCR 7.
Pour le PCR 9, il faut refaire le systemd-cryptenroll
à chaque fois que le grub est modifié (i.e.: en utilisant update-grub
).