Talk:Trusted Platform Module
Uses and security implications
I'm still not sure what TPM is used for and whether or not it's a good idea to use it at all. It seems like TPM can be used to store LUKS private keys [1]. What's the point of that? It seems like Windows uses it so that a user only has to enter their user password both to unlock the partition and to login [2]. VeraCrypt (and previously TrueCrypt) is against the usage of TPM. [3] âThis unsigned comment is by Rdeckard (talk) 11:39, 23 February 2018. Please sign your posts with ~~~~!
PCR 0 should be avoided
This --tpm2-pcrs=0+7 flag is flat out wrong, but copied from howto to howto. :-/ (It appeared in a few blogposts, e.g. here, sometimes even with a , instead of a +, which is âdoubly wrongâ, in a way.)
The man page for systemd-cryptenroll explicitly discourages the use of PCR 0: âFor most applications it should be sufficient to bind against PCR 7âĶ âĶit's typically not advisable to include PCRs such as 0âĶâ
The reason is that the key should not be bound to PCRs that change routinely and whose changes are benign. This includes system firmware (PCR 0). On recent Lenovo laptops, for example, firmware updates (fwupdmgr refresh; fwupdmgr upgrade;) can appear often, perhaps monthly. The key enrollment should not be invalidated after each firmware upgrade.
Thatâ said, the default PCR 7 (picked in absence of the --tpm2-pcrs flag) is all thatâs needed.
Andrej (talk) 20:06, 29 March 2023 (UTC)
- I'm not an expert, but I'm not sure I agree with the advice given in the man page. Or, at least, I would like to see a source for the claim that "since the program code they cover should already be protected indirectly through the certificates measured into PCR 7." As far as I understand it, if you don't bind to PCR 0, someone could flash malicious firmware to your device, boot it up, have the TPM automatically unlock your drive (because you didn't bind to PCR 0 so it doesn't care if the firmware changed) and then use the malicious firmware to steal your data without knowing your user password. This could theoretically be done without physical access to your system, if you download malware that automatically flashes your BIOS. Of course, one could dispute the probability of this scenario, but I think it would be possible if you don't bind to PCR 0.
- I'm pretty sure Windows binds to PCRs 0 and 7 (at least). That's why if you update your UEFI on a Windows laptop it will ask you to suspend disk encryption for one reboot cycle, so it can rebind the TPM PCRs. Not that we should blindly follow whatever Microsoft does, but I don't think it's bad to consider wider industry practice. I guess, in my opinion, the firmware is the ultimate root of trust, since it's the lowest layer of software on your computer (other than maybe IME), so it's integrity should be assured before anything else. I'm open to being convinced otherwise, though, especially since the man page seems to imply that it should be indirectly measured through PCR 7. I've just never heard that before.
- Forgonewarrior (talk) 19:54, 11 April 2023 (UTC)
- If firmware is forged then PCR0 is already useless. At boot chain UEFI BIOS is inherently trusted, so an advanced Evil Maid can just forge PCR0 read output. While NIST already gave out guidelines for signed BIOS and SPI Protected Range, but the implementation is up to the manufacturers, so PCR0 is useless. Source: https://www.c7zero.info/stuff/Evil%20Maid%20Just%20Got%20Angrier.pdf
- Bitlocker doesn't use 0 and 7. It uses either 0 2 4 11 or 7 11 (the latter is preferred when 7 is bindable - for TPM 2.0, this is because PCR 7 on TPM 2.0 performs platform attestation in addition to just storing Secure Boot flag from TPM 1.2) https://learn.microsoft.com/en-us/windows-hardware/test/hlk/testref/954cf796-a640-4134-b742-eaf0ed2663ff#troubleshooting
- So conclusion, PCR0 binding is useless (BIOS firmware inherently trusted). Binding PCR 4 will require rebinding everytime bootloader update, PCR 2 need rebinding after adding PCIe and other stuffs. On TPM 2.0 binding 7 is enough, on TPM 1.2 nothing is safe but at least TPM 7 is still a decent default (maybe bind 4 and 7 + hook to rebind everytime grub updates)
- TL;DR: PCR 7 is a good default, especially for TPM 2.0. PCR 0 should not be used
- N0k0m3 (talk) 03:53, 5 May 2023 (UTC)
- Agree with the above and the notion that PCR 0 is arguably unnecessary.
- The man page as of systemd 254 advises not to use PCR 0 and 2 as it is both redundant and fragile. Putting aside whether this advice is correct or not or unnecessary, measuring against literal PCR values for this component is certainly more fragile compared to signatures as firmware upgrade would risk locking the user out.
- Unless binding to signatures are supported for PCR 0, this should not be recommended. Nu4425 (talk) 22:04, 6 October 2023 (UTC)
- N0k0m3 (talk) 03:53, 5 May 2023 (UTC)
- I've added [4] and am still in contemplation if current suffices to close the topic. Opinions/edits welcome. One consideration to keep in mind is that systemd-cryptenroll requires a prior passphrase/luks-key. So, the worst case of a user locking themself out (totally) via misconfiguration is reduced by that. --Indigo (talk) 15:02, 8 October 2023 (UTC)
- That's true. The user wouldn't be completely locked out unless TPM2 is the only method for unlocking the LUKS2 volume.
- The necessity of PCR 0 is still up for debate, and would actually be interested in another opinion. Since this is the case, it should not be included in the default example which I've already changed.
- The default example on the wiki which should be left simple--kept to systemd-cryptenroll's current defaults and recommendations. As of systemd 254 this is PCR 7. Nu4425 (talk) 05:11, 9 October 2023 (UTC)
- I've added [4] and am still in contemplation if current suffices to close the topic. Opinions/edits welcome. One consideration to keep in mind is that systemd-cryptenroll requires a prior passphrase/luks-key. So, the worst case of a user locking themself out (totally) via misconfiguration is reduced by that. --Indigo (talk) 15:02, 8 October 2023 (UTC)
- PCR[0] only really protects against UEFI downgrades. It's fine to use it, but it doesn't add much. Normally, UEFI UpdateCapsules have to be signed, so there shouldn't really be a way to tamper with UEFI, unless done physically.
- The reason being that the UEFI ROM on the mainboard can be tampered with with soldering and thus a foreign ROM could be installed. All measurements are sent from the UEFI via SPI to the TPM, so it can freely fake values in this case.
- The defence against this would be having "Platform Secure Boot" as business CPUs do. This fuses the CPU (using one-way fuses) permanently to the UEFI's signing key. Replacing the ROM doesn't work thus without also replacing the CPU and that can be detected via PPIN, see for instance https://lenovopress.lenovo.com/lp1890-enabling-ppin-on-thinksystem-servers
- PCR[2] is implicitly covered by PCR[7] as under Secure Boot all option ROMs also have to be covered.
- If you're using systemd-pcrlock, there's no harm in adding all these PCRs, even PCR[4] can be used reliably as the policy is updated. However, otherwise I would indeed recommend using PCR[7] plus a signed PCR[11] policy and maybe fixate-volume-keys= on top to prevent the UKI being booted with a foreign root file system entirely. (or if pcrlock, you can actually lock PCR[15], but this is not viable otherwise)
- But as I explained in my other comment, PCR[11] alone is a bad idea. ChrisTX (talk) 01:51, 8 October 2026 (UTC)
PCR register table
The referred UAPI table is itself not authoritative and makes exclusions like "How other operating systems â in particular Windows â use PCRs, is out of scope of this document.", which we need to cover to some extent. The PCR register itself is stable, we'd mostly remove links to our own content and a place for contextual info (e.g. users multi-booting). So, I'm against removal for now. Indigo (talk) 19:33, 6 December 2024 (UTC)
- I'm against its removal too. IMO we can improve the table to a better state than what the UAPI group or TCG has. The only thing missing from our table would be an "Extended by" column listing which software changes a PCR. -- nl6720 (talk) 07:19, 7 December 2024 (UTC)
- Thanks for putting up the talk page. I agree that the uapi table is not authoritative, but it still is more accurate right now than the wiki one. I was about to copy paste some of the missing stuff and figured this makes no sense, just like duplicating man pages.
- For most people, a lot of the PCRs really aren't useful. That's why I think focusing (1) the useful PCRs and explaining why they make sense and (2) adding info which is missing from the uapi table makes more sense than yet another table. Cvlc (talk) 22:55, 7 December 2024 (UTC)
- As soon as I find some time I'll put up an article on signed PCR policies and PCRlock, which both make more sense in my opinion and really aren't any harder to use anymore than raw PCR hashes. That's why as much as I'm interested in PCR hashes, I'm afraid keeping all this info might confuse people more than be useful to anyone. Cvlc (talk) 23:01, 7 December 2024 (UTC)
- I think these are all valid points and clearly good additions. More and more software will make use of PCR registers, so it's indeed seems useful to not only use the table as a crosslink anchor but be able to add context with a new column where applicable.
- At the same time I follow the point that most users will benefit from a structured approach to deploy the new systemd tools. Albeit they may be most useful for their main intend first - "factory"-style images/hosts/machines. Yet, that should not matter, many users will be able to apply a structured guidance for their hardware/purpose. Just keep in mind it's systemd tools. The kernel offers different API to the TPM, systemd decides on one that's useful for its purpose, but other software other use cases.
- IMO you should switch the remove template to Template:Expansion. Depending on phrasing, we can keep this item linked to it for the time being regarding scoping, or open a new one. --Indigo (talk) 20:24, 9 December 2024 (UTC)
- Changed the template to expansion. I still think the table in its actual form needs to go though :)
- Maybe a subsection per meaningful PCR, and examples as to why they make sense ? For example, the warning which is somewhere about making sure SB is enabled before tying to PCR 7 would go under PCR 7, etc.. Cvlc (talk) 23:41, 29 December 2024 (UTC)
- I changed the table slightly. IMO the PCR descriptions need a lot of improvement (I wonder from where they originated), but I still think it's worth it to keep the table. âïļâïļ nl6720 (talk) 11:24, 30 December 2024 (UTC)
- A more up to date version of this table is also being maintained here, although it is missing the bits relating to Windows. https://man.archlinux.org/man/systemd-cryptenroll.1#TPM2_PCRs_and_policies Kolly (talk) 13:34, 7 January 2025 (UTC)
- That's a neat man presentation, yes. I'd vouch to link it instead of the UAPI, but it also misses all the addendum notes that page has. Then again, it lists PCR 16/23 when the UAPI does not even mention them .. It makes sense to link it from systemd-* articles and, in my opinion, it does not hurt to crosslink all sources above the table either, maybe pointing out differences. Example: I write from a notebook which uses PCR16 optionally. It is a corner-case, but there will be a few of such. --Indigo (talk) 21:19, 7 January 2025 (UTC)
- A more up to date version of this table is also being maintained here, although it is missing the bits relating to Windows. https://man.archlinux.org/man/systemd-cryptenroll.1#TPM2_PCRs_and_policies Kolly (talk) 13:34, 7 January 2025 (UTC)
- I changed the table slightly. IMO the PCR descriptions need a lot of improvement (I wonder from where they originated), but I still think it's worth it to keep the table. âïļâïļ nl6720 (talk) 11:24, 30 December 2024 (UTC)
Using PCR policies at different stages requires separate keys
The introduction in Trusted Platform Module#PCR policies advertises separate access to secrets in the initrd and the running system. While the given example technically works in that the volumes can be unlocked, the use of single key pair for different phases results in all secrets being accessible in all phases. This defeats the purpose of the access separation and the example is misleading at best. The proper implementation of this implementation should follow Example 5 of the ukify man page (v257.8-2). For the wiki here, I would propose to:
- drop the item on manual key generation
- use separate keys for the initrd and system phase (in the example to be used for swap, but the key is bound to the system phase), e.g.
/etc/systemd/tpm2-pcr-initrd-private-key.pemand/etc/systemd/tpm2-pcr-system-private-key.pem(and corresponding public keys) - use
ukify genkey --config=/etc/kernel/uki.confto generate all keys in one go (NB: requires temporarily commenting out the SB signing keys if they already exist) - enroll policies with explicit reference to the public key to bind it to the desired phase, i.e.
# systemd-cryptenroll --wipe-slot tpm2 --tpm2-device auto --tpm2-pcrs="" --tpm2-public-key=/etc/systemd/tpm2-pcr-initrd-public-key.pem /dev/disk/by-label/root # systemd-cryptenroll --wipe-slot tpm2 --tpm2-device auto --tpm2-pcrs="" --tpm2-public-key=/etc/systemd/tpm2-pcr-system-public-key.pem /dev/disk/by-label/swap
- optionally specify which PCRs to use for the policy:
--tpm2-public-key-pcrs=11(default 11)
I am happy to incorporate these changes in the wiki page if there are no objections or further items for discussion. I Qgp (talk) 19:35, 23 August 2025 (UTC)
- Hmm, are you sure this is true ? Using this setup, I can decrypt neither the root or swap volumes from the booted system. Cvlc (talk) 18:11, 27 August 2025 (UTC)
- Indeed, the
uki.confcurrently on the wiki page only listsPhases=enter-initrd:leave-initrdfor swap decryption, i.e.sysinitandreadyare not included. Consequently, neither of the two decryptions works in the fully booted system. Root decryption only has to work in the initrd, swap decryption only in the early phase of userspace (systemd). If you wanted swap decryption to work later, you would have to extendPhaseswith the sequences includingsysinitandready. Qgp (talk) 19:58, 27 August 2025 (UTC)- That's my point, I don't see how using the same signing key breaks the assumption that the specific volume key won't be accessible after the system has switched to a subsequent phase. Isn't the most important thing that the key cannot be released from the booted system? And the example achieves that ? Cvlc (talk) 20:11, 27 August 2025 (UTC)
- The example advertises the separation of the two secrets in the two stages, i.e. initrd and early phase of userspace (systemd). That is not achieved when using the same key. So, if this separation is wanted, the current example is not enough.
- If a secret shared between initrd and early phase of userspace is enough (which is a separate question if it is), the example is overly complicated since a single stance of
[PCRSignature:sharedwith both phases, i.e.Phases=enter-initrd enter-initrd:leave-initrdwould be enough. - So, my point is that the current version is misleading in that it advertises separate policies (quote: "For example, one policy can be used for the root volume key, making it accessible only from the initrd, while another policy can be set for the swap encryption key, which needs to be available later in the boot process when the swap is mounted."), while in fact both secrets are accessible in both stages (i.e. initrd and early userspace, but indeed not in the fully booted system). Qgp (talk) 20:22, 27 August 2025 (UTC)
My understanding is that the system state is compared to the signed expected state. I don't really see how which key is used to sign the policy is relevant? Does using the same signing key for the policy really mean the two encrypted volumes share the same volume key ?Cvlc (talk) 20:30, 27 August 2025 (UTC)- Oh ok, you mean since we can provide a valid signature for the set of PCR values for both phases then the TPM would release the key everytime in both cases.
- Then I guess it would better to simplify the PCRsignature= example rather than add a different signing key, unless there's a specific reason to separate them ? My point here was mainly to have a minimal working example with a separate encrypted swap partition, and the volume key not being accessible from the booted system. Cvlc (talk) 20:53, 27 August 2025 (UTC)
- I acted on your suggestion of [PCRSignature:shared], what do you think ? I think it's more relevant to a real life use case than splitting root and swap across different signing keys ? we could also add such an example, but I guess it's covered in the man page already. Cvlc (talk) 10:45, 28 August 2025 (UTC)
- Exactly, the unsealing of the secret relies on the pcr signature, which is checked against the public key (stored in he LUKS header). With a single key, both signatures are valid for both volumes and allow the unsealing.
- Sharing access to secrets between initrd and userspace makes you vulnerable for a commonly known attack:
- you replace the root partition with one of your own for which you know a LUKS password
- the TPM2 decryption of the root partition in the initrd fails
- systemd falls back to asking you for the password - which you know for your own root partition
- you boot into your own root partition with your own userspace and now have access to the secret used for the encryption of the original root partition (userspace in your root partition is under your control, so you can retrieve secrets at any stage or control what is used for PCR extension)
- similarly, you could extract secrets for the decryption of other partitions, be it swap, home, var, ...
- So, a setup with shared access to secrets comes with an impact on security. Of course, one can consider this acceptable, but I think if you want to go for the shared secrets a warning on the security implications is due.
- My preference for a simple solution would be to use the TPM for the encryption/decryption of the root partition only and restrict access to the secret strictly to the initrd. Other partitions can then be decrypted with keys stored on the (encrypted) root partitions (the only exception of that being decryption of swap for resume, which has to happen in the initrd, which will only be supported by the upcoming systemd v258, but then this would be another secret for the initrd).
- In addition, a pointer to the example of properly separated secrets in the example of the ukify manpage could be helpful as well.
- Does this make sense to you? Qgp (talk) 11:51, 28 August 2025 (UTC)
- Makes sense; so maybe simplify the example by removing swap altogether for now (i.e. until systemd 258) ? and point to the ukify manpage for more info ? Cvlc (talk) 17:48, 29 August 2025 (UTC)
- Good for me. Let me know if I can be of any help. Qgp (talk) 12:38, 30 August 2025 (UTC)
- Can you double check my last edit ? also tried to simplify wording a little. Thanks ! Cvlc (talk) 16:31, 30 August 2025 (UTC)
- Looks good to me, thanks for the discussion and the editing :-) Qgp (talk) 18:38, 31 August 2025 (UTC)
- Thanks for pointing in the right direction. Let's see after 258 is released if it ends up working properly for swap. Cvlc (talk) 19:12, 31 August 2025 (UTC)
- Hmm it looks like this still does not work with 258 ? https://github.com/systemd/systemd/issues/35429#issuecomment-3233748500 Cvlc (talk) 08:34, 10 October 2025 (UTC)
Apparently, it also still does not work in 259, phase=enter-initrd alone is not sufficient to decrypt swap.Ok so after some testing, it seems booting and resuming from hibernation works with only phase=enter-initrd, but only with a mkosi generated initrd. So maybe something's missing in mkinicpio. I'll take it up over there. Cvlc (talk) 05:47, 4 January 2026 (UTC)
- I came across a few issues in the commands : the ukify genkey only generates tpm certificates, not the SecureBoot ones, also I see that the SecureBoot certificates are in italic, what is the meaning of that ?
- On my side I used genkey --config (as example 6 in man page) instead, which generated all the necessary certificates, is this the good way to go or are we supposed to do something with the SecureBoot certificates ?
- I think we should either move to the --config syntax and remove the italic inside the config (I can apply this modification if wanted), or specify what to do with these certificates (I don't understand this part so it might be difficult for me to edit it). Cehs (talk) 10:24, 8 January 2026 (UTC)
- italics just mean you can change the path if you want. As mentioned it's recommended to not modify the path of the tpm PCR keys and certificates as they are automatically picked up by ukify. Cvlc (talk) 13:29, 9 January 2026 (UTC)
- So you agree to use ukify genkey --config instead ? Cehs (talk) 16:23, 9 January 2026 (UTC)
- italics just mean you can change the path if you want. As mentioned it's recommended to not modify the path of the tpm PCR keys and certificates as they are automatically picked up by ukify. Cvlc (talk) 13:29, 9 January 2026 (UTC)
- Looks good to me, thanks for the discussion and the editing :-) Qgp (talk) 18:38, 31 August 2025 (UTC)
- Can you double check my last edit ? also tried to simplify wording a little. Thanks ! Cvlc (talk) 16:31, 30 August 2025 (UTC)
- Good for me. Let me know if I can be of any help. Qgp (talk) 12:38, 30 August 2025 (UTC)
- Makes sense; so maybe simplify the example by removing swap altogether for now (i.e. until systemd 258) ? and point to the ukify manpage for more info ? Cvlc (talk) 17:48, 29 August 2025 (UTC)
- That's my point, I don't see how using the same signing key breaks the assumption that the specific volume key won't be accessible after the system has switched to a subsequent phase. Isn't the most important thing that the key cannot be released from the booted system? And the example achieves that ? Cvlc (talk) 20:11, 27 August 2025 (UTC)
- Indeed, the
- Is all of this still true for systemd v262? Can we use the new `SignInitrdPCRs` to simplify down to one signing key for all phases, like this:
- [UKI]
- SignInitrdPCRs=yes
- [PCRSignature:all]
- PCRPrivateKey=/etc/systemd/tpm2-pcr-private-key.pem
- PCRPublicKey=/etc/systemd/tpm2-pcr-public-key.pem
- then enrol via systemd-cryptenroll with the new
--tpm2-public-key-policyref=initrdoption? AidanGG (talk) 11:55, 25 September 2026 (UTC)- It looks like it is the case. Somebody should experiment and check that is working as intended, and then document that in the Wiki. But we should keep the old solution. This should be provided as an alternative (an recommended?) solution. Benjarobin (talk) 12:21, 25 September 2026 (UTC)
- I am doing this and it is working, but I don't know how to verify that it is secure in the same way as it was before with separate section for initrd. AidanGG (talk) 12:24, 25 September 2026 (UTC)
- I'm in a similar boat; I switched to a similar one-key setup with
SignInitrdPCRs=yes, re-generated my initramfs and re-enrolled my TPM and it all works. In fact, I pretty much followed this version of the wiki page. Now I'm wondering if the latest edit, which re-introduced a 2-keypairs setup, is really the recommended strategy? Is there still any justified reason to default to a 2-keypairs setup in systemd v262, or is the one keypair +SignInitrdPCRs=yes(+--tpm2-public-key-policyref=initrdon thesystemd-cryptenrollcommand) considered a good and secure default? Catch-404 (talk) 07:49, 7 October 2026 (UTC)- Apparently in the last edit (https://wiki.archlinux.org/index.php?title=Trusted_Platform_Module&diff=886970&oldid=886958), @Nl6720 re-added the specific phase back. I'm not sure why this was done, as my understanding from the blog is that a signature is specific to the (phase, ref) pair, and that `SignInitrdPCRs` only creates an initrd policy ref for the `enter-initrd` phase.
- Also the old dual-section example was required because there had to be some signature for all phases, you couldn't just specify a key pair for `enter-initrd`. I don't think this was changed in 262, so wouldn't a single incomplete section also error out? AidanGG (talk) 08:31, 7 October 2026 (UTC)
- From my point of view, this modification is wrong and not supported by systemd. We must cover all boot phases somehow.
- So I really do not understand this modification! I am quite against it Benjarobin (talk) 13:30, 7 October 2026 (UTC)
- There is a reddit thread here that also asserts that the single-section setup is secure if you are careful to specify `--tpm2-public-key-policyref=initrd` during LUKS enrolment.
- https://www.reddit.com/r/archlinux/comments/1wykdmb/psa_if_youre_using_a_tpm2_luks_unlock_with_dracut/pe4h9la/ AidanGG (talk) 08:58, 7 October 2026 (UTC)
- I'm in a similar boat; I switched to a similar one-key setup with
- I am doing this and it is working, but I don't know how to verify that it is secure in the same way as it was before with separate section for initrd. AidanGG (talk) 12:24, 25 September 2026 (UTC)
- This won't work it turns out, as systemd-creds doesn't support policyref. I only just realised this as I tried using it. I've created an upstream RFE for it https://github.com/systemd/systemd/issues/44090
- As such, we need separate keys for now, since PolicyRef can only be used with systemd-cryptenroll. ChrisTX (talk) 21:24, 8 October 2026 (UTC)
- It looks like it is the case. Somebody should experiment and check that is working as intended, and then document that in the Wiki. But we should keep the old solution. This should be provided as an alternative (an recommended?) solution. Benjarobin (talk) 12:21, 25 September 2026 (UTC)
- The reason the ukify(1) manpage uses separate keys is that what these keys actually do is this:
- First, systemd-stub(1) will perform a measurement of most sections of the UKI before initrd. This anchors PCR[11] to a unique value specific for this UKI. This means all subsequent secrets are somewhat anchored.
- After that, systemd-pcrphase will measure various events like `enter-initrd`, `leave-initrd` etc. All phases need to be signed by the complete path of previous events, e.g. to sign the state `leave-initrd` you would use `enter-initrd:leave-initrd`. This signs off the expected value at that phase, but this is trust anchored in systemd-stub, not in the hardware root-of-trust mechanism - since it's only signing the PCR[11] state, nothing else.
- The idea is that as soon as an event is measured, it cannot be removed from PCR[11]. So if you used a key that only signs for `enter-initrd`, as soon as `leave-initrd` is measured, the associated TPM secrets cannot be unsealed afterwards. The state remains valid until the next phase is measured by systemd-pcrphase.
- The ukify(1) manpage uses two separate keys in its examples, one that only signs `enter-initrd`, and one that signs the phases from `leave-initrd` to `ready`. In short: The first key is valid only during initrd, the second after root switched to real root until `shutdown` is measured.
- So you'd use the initrd key to restrict TPM seals that should be used in initrd to that. This would be all your disk encryption keys for drives mounted at boot.
- The second key you'd use for e.g. systemd-creds to restrict secrets for services to the execution of the actual system.
- Now, with systemd v262, you don't strictly need to use two keys, since you could use the PolicyRef= functionality. With this, you can create separate signatures for separate purposes. So you could use one key and rely on that only. However, I would caution against this: The way it's described in the wiki atm, you would end up with one signature that's valid for all phases form enter-initrd to ready, since that's what the systemd-measure default is (see man pages, also for the ukify(1) Phases= argument). So if you ever forgot to enroll a key with the policyref argument, the command would work fine, but the key would remain valid after initrd.
- I would recommend using a first PCRSignature in the uki.conf that's Phases=enter-initrd, this way the CLI issue can't happen. Secondly, you could use either PolicyRef= with the same key or a second key for system signatures - that the user needs to enroll though.
- IMPORTANT*: These signatures are rooted in systemd-stub, as said. Without that, the PCR[11] value never changes from 0 as it will never receive measurements. So using those signatures _alone_ to bind a disk encryption secret does not provide any protection. You could boot an Arch live system (which doesn't init the TPM) and then just replay the measurements of systemd-stub and the phases and you will arrive at the same PCR[11] value as the UKI would, and thus the signatures from the UKI will be matched.
- Note that systemd-cryptenroll does not default any PCRs in its set, so the current enrollment instructions bind to PCR[11] and only PCR[11] values. This does not provide any protection, as the measurements can be replayed in the manner just described.
- You should only use these PCR policies together with PCR[7] or a similar anchor to hardware RTM. Binding to PCR[7] plus a PCR[11] policy restricts the unlock to the UKI and only during init. For systemd-creds, since that's anchored in the Storage Root Key (SRK) of systemd as well, it's fine to bind to only the policy. ChrisTX (talk) 22:01, 7 October 2026 (UTC)
- Oh, about those NvPCRs, forgot to address that: They're not used for disk encryption but rather as highly volatile "PCRs" for attestation purposes. For example: `login` receives a measurement for every user login, and cannot be removed anymore. You could modify logs on the disk, but you can't remove the measurement.
- They're anchored in a PCR Signature now to provide UKI specific initial values. If SignInitrdPCRs=yes is given, systemd grabs the first key from the uki.conf and generates an initrd PolicyRef= for it. Thus you shouldn't use PolicyRef=initrd in your uki.conf, as that will error if --sign-initrd-pcrs was passed, and IIRC mkosi-initrd does this by now on its own.
- Since you need to specify a key anyhow, I would recommend making one initrd only key as the first key. You kinda need one anyhow, and this prevents mixups on the CLI. ChrisTX (talk) 22:13, 7 October 2026 (UTC)
- Thanks Chris, I feel like I understand the interaction a bit better.
- If the main hesitation against a single key pair setup in v262 is forgetting to specify the policyref on the CLI, then I am inclined to open a PR against systemd (which I will do to get feedback from Lennart) to make `--tpm2-public-key-policyref=initrd` a default, since we have established that `SignInitrdPCRs=yes` is required anyway to avoid our original issue in systemd #43848.
- My belief is that less configuration is better, and having a single key pair at the default location, and setting up a policy at the default location that pins the secureboot authority+policy, with a default of `--tpm2-public-key-policyref=initrd` means that `systemd-cryptenroll --tpm2-device=auto /dev/xyz` would be a secure default for initrd root unlock. AidanGG (talk) 23:52, 7 October 2026 (UTC)
- I mean, signing all phases is pointless anyhow. It doesn't do anything useful. So I'd just use one signature for just enter-initrd. Then the policyref to initrd is kinda irrelevant if you forget it or not.
- You can use the same key to create a system signature if you like or add a second key. Both keys are accessible from the same point, so you either way is secure.
- I should add that cryptenroll and creds will use a key automatically if found:
- ```If this is not specified explicitly, but a file tpm2-pcr-public-key.pem exists in one of the directories /etc/systemd/, /run/systemd/, /usr/lib/systemd/ (searched in this order), it is automatically used.```
- This might not be what you'd want to have if you mix creds and cryptenroll as it can easily be bound to the wrong thing. I personally prefer to have my keys named similar to the ukify(1) man page layout just so I can't ever accidentally bind something incorrectly. There can be uses in creds in initrd (see the --with-key= option) so this feels less prone to user error to me. At least I know from myself that I'm very prone to forgetting things in a moment (AuDHD issue).
- One note: If you use two signatures (not even keys) you need to specify `PCRPKey=...` to the key that will be used in initrd and that is used for the initrd policyref by systemd. It will only add that by default if only one signature argument is given.
- For reference, this is the uki.conf I use and the same thing converted to one key with policyref: https://gist.github.com/ChrisTX/700b4c8217c00b7c23ecdbce36cea21d
- Either path would be secure and if you forgot the policyref ever since there's no signature without policyref, there will be no usable bind if you ever forgot it instead of accidentally binding the key wrong. ChrisTX (talk) 02:05, 8 October 2026 (UTC)
- After pondering over this somewhat, I decided to swap my setup to the second option.
- The reason being that --tpm2-public-key= will find it then and use this key automatically. There's no real reason to enroll any secrets without a PCR policy if you have one for initrd for one the system. This is less typing on the CLI and the main thing - you can't forget about it. If I forgot it would not be able to have a policy and the secret would not work, which will be obvious. Binding to a policy too large wouldn't be.
- It would also technically be possible to create a signature that's limited to just `ready` or similar rather than being available from switch root. But there's no real security barrier here, so I don't think this would really add any real security benefit.
- I should also point out: I'm using tpm2-openssl to bind the secure boot and initrd keys to the TPM. This makes them unextractable, so even if an attacker got in my system, they could only use the keys there but not extract them. This is easy to do, kind of similar to Unified Extensible Firmware Interface/Secure Boot#Signing with TPM sealed keys
- Probably worth documenting, as that has a benefit, and it's only a few CLI commands and then works as you'd think. For Secure Boot, you can even make the PK and KEK sealed with a PIN as they're not used regularly. KEK maybe if you want to sign Microsoft keys without enrolling theirs and need to sign UEFI dbx updates manually - but that's only for very advanced setups. ChrisTX (talk) 04:24, 8 October 2026 (UTC)
- Oh btw. I should note her that I'm severely autistic and hyperfixated on this whole disk encryption topic, TPMs, etc. I've always had a knack for cryptography.
- If you (or anyone else here) has any questions about this topic, feel free to ask or shoot me a message on e.g. Arch IRC. ChrisTX (talk) 02:07, 8 October 2026 (UTC)
- Apparently we missed something: systemd-creds does not support --tpm2-public-key-policyref= at this point, only cryptenroll does. That's something for systemd to fix, but then using separate keys will be necessary for now. I hadn't realised until I just tried to enroll secrets with it. ChrisTX (talk) 20:00, 8 October 2026 (UTC)
- @ChrisTX I am maybe wrong here, but with this version of the Wiki (https://wiki.archlinux.org/index.php?title=Trusted_Platform_Module&oldid=886958) it should work: So with an unique key covering all boot phases, and an initrd policyref provided by "SignInitrdPCRs=yes" which is useful for the systemd-cryptenroll part.
- I did not use (yet) systemd-creds, but with such configuration, with creds not bound to a policyref, it should work. I am missing something? Adding the option
--tpm2-public-key-policyref=referenced in https://github.com/systemd/systemd/issues/44090 could be useful to only allow decryption of the creds for a specific boot phase while using the same key. Benjarobin (talk) 08:46, 11 October 2026 (UTC)- Why have a key for all boot phases though? That does nothing useful, as the default is to sign from enter-initrd to ready. It would only seal secrets at shutdown. If you want only one key for just using cryptenroll during initrd, then just make one for Phases=enter-initrd. That's much better than all phases, but if you name it the default name, systemd-creds will pick it up, too.
- 44090 is the issue I made. With that you could use the same key for multiple signatures reasonable with PolicyRef=. But as is, you can only use those signatures for cryptenroll and using one PolicyRef= in a uki.conf means all signatures need to have one. ChrisTX (talk) 17:19, 11 October 2026 (UTC)
- I am not sure to understand by "using one
PolicyRef=in a uki.conf means all signatures need to have one". This statement looks wrong. You could have aPCRSignatureblock with aPolicyRef=, and another block without. - If you do not cover the current phase when you try to obtain the encrypted credential, then systemd-creds will not be able to decrypt the credential. I have double check that by reading the code of
decrypt_credential_and_warn(). Indeed if you only want to allow to be able to decrypt the credential for a specific boot phase, you can add an additionalPCRSignatureblock for that specific boot phase. But Lennart Poettering clearly expect that all boot phases to be covered! - So in summary, by covering only the initrd boot phase, various part of systemd is not going to work (e.g., the credentials). And above all, future systemd features or modification may break your system.
- When you say: "It would only seal secrets at shutdown.", I prefer to say that you can only unseal the secrets for the specified boot phases, which exclude shutdown. The secrets are always sealed, you need to unsealed them, which is allowed if there is a
PCRSignatureblock for the current boot phase. - This version of the Wiki was the right one. Yes it requires to execute again
systemd-cryptenrollwith--tpm2-public-key-policyref=initrd, but this is safe! - Yes, for advanced user we could explain how to add multiples
PCRSignatureblocks for better or advanced security. Benjarobin (talk) 19:07, 11 October 2026 (UTC)- > "You could have a
PCRSignatureblock with aPolicyRef=, and another block without." - No you can't. See ukify(1):
PolicyRef=STRING, --policyref=STRING"- [...]
On the command line, when this argument is present, it must appear the same number of times as the --pcr-private-key= option.- Doing that will error:
File /usr/bin/ukify", line 2550, in finalize_options raiseValueError('--policyref= specifications must match --pcr-private-key=')- > "So in summary, by covering only the initrd boot phase, various part of systemd is not going to work (e.g., the credentials)."
- You have to use any keys you want to employ explicitly. systemd does not automatically use any of the credentials other than the SignInitrdPCRs for NvPCRs. Any systemd-creds you need to enroll manually.
- > "The secrets are always sealed, you need to unsealed them, which is allowed if there is a PCRSignature block for the current boot phase."
- Yes precisely. If you don't specify
Phases=, it uses thesystemd-measure(1)default: If not used defaults to "enter-initrd", "enter-initrd:leave-initrd", "enter-initrd:leave-initrd:sysinit", "enter-initrd:leave-initrd:sysinit:ready", i.e. calculates expected PCR values for the boot phase in the initrd, during early boot, during later boot, and during system runtime, but excluding the phases before the initrd or when shutting down.- This is utterly pointless to bind anything to. systemd-creds requires a different key if you want to use secrets during initrd (
--with-key=auto-initrd). - The entire point of PCR[11] signatures is to restrict secret availability during boot phases. A signature with that is useless to systemd-creds.
- > "This version of the Wiki was the right one. Yes it requires to execute again systemd-cryptenroll with --tpm2-public-key-policyref=initrd, but this is safe!"
- It's safe but entirely pointless. You have an additional signature on your UKI that makes no sense. If you wanted this, what you could do is to make the key use
Phases=enter-initrd:leave-initrd enter-initrd:leave-initrd:sysinit enter-initrd:leave-initrd:sysinit:readyand then use--tpm2-public-key-policyref=initrdto for passing secrets to systemd-cryptenroll during initrd. This would make sense, but an all phases key is pointless in comparison. - However this seems a bit prone to human error on the CLI: Since you can't PolicyRef= your system signature, if this is named the default value of tpm2-pcr-public-key.pem, forgetting that PolicyRef will still bind to PCR[11] but the wrong phase. You should notice immediately though that it doesn't work. ChrisTX (talk) 19:04, 12 October 2026 (UTC)
- > No you can't. See ukify(1)
- You have read and understood the man incorrectly. This is possible, there is just is small bug in the Python. But you can workaround this bug by explicitly specify the phase. See this example: https://paste.c-net.org/SocketFringe
- > The entire point of PCR[11] signatures is to restrict secret availability during boot phases.
- As explained in https://systemd.io/TPM2_PCR_MEASUREMENTS/ the goal of PCR[11] signatures is to restrict secret availability during specific boot phases.
enter-initrd:leave-initrd:sysinit:readyis a valid boot phase, and we may want to access (some) secret from that boot phase. - You forgot, or dismiss the purpose of
systemd-creds, typically it could be used to provide secrets for a service started when the system is fully started/ready (so in thereadyphase). If you do not cover thereadyphase how can the service could access these secrets. systemd-cryptenrollis one use case, and yes in this case we only want to be able to unseal the associated secret from initrd phase. And thanks to the policyref we can now do that with the same key, instead of using multiple PCR keys.- And I am sure there are much more use cases.
- See this talk which I attended at the Embedded Linux Conference (sadly he had not yet provided the slides). Benjarobin (talk) 20:18, 12 October 2026 (UTC)
- > You have read and understood the man incorrectly.
- Nope, this is really buggy atm and won't work properly. I'm to be honest not sure if this is intended to work or not.
- Either way, systemd in finalize_options() in ukify has a bug that creates the property list incorrectly. Any config key is padded up until it first appears. So yours works because you added PolicyRef= to the last key. Try omitting that and put the command on a separate key. It will error.
- I don't know how this is intended by upstream, whether PolicyRef= should be forced on all signatures or not. Either way this is completely buggy atm and can't be recommended.
- I will do a writeup on the issue and notify upstream though.
- > enter-initrd:leave-initrd:sysinit:ready is a valid boot phase, and we may want to access (some) secret from that boot phase.
- Yes absolutely. I do in fact - but this would be for systemd-creds. I have several more keys for that.
- But:
- 1. there's zero point in having such secrets valid in enter-initrd, too. You need to specifically enroll initrd systemd-creds with --with-key=auto-initrd and they won't remain valid beyond that. This is what I was saying about all phases being useless. It doesn't restrict anything cause the secret remains accessible during the entire system runtime.
- 2. systemd-creds can't use PolicyRef= keys: systemd-creds has no
--tpm2-public-key-policyref=initrd. See the manpage: https://man.archlinux.org/man/systemd-creds.1#OPTIONS - I also tried it, it's not implemented.
- So right now, using keys for later phases with PolicyRef is quite useless.
- Once https://github.com/systemd/systemd/issues/44090 is addressed, I'd recommend the single key solution though. Since that way, you can put a key under the default path and it will always be picked up. So you couldn't accidentally not restrict a secret to its right phase. ChrisTX (talk) 01:36, 13 October 2026 (UTC)
- Created https://github.com/systemd/systemd/issues/44160 for the issue. I think that mixing PolicyRef= and not *should* be intended as supported features, and that the manpage refers to CLI usage in that you need to pass --policyref= for entries that shouldn't have them. But it would also be valid to now allow this, since mixing PolicyRef and not is quite prone to user error binding the wrong thing.
- Honestly, unless that and #44090 are addressed I don't think PolicyRef= can be recommended. It's very limiting and if you want keys for later boot phases you can't use it due to systemd-creds not being supported. ChrisTX (talk) 02:07, 13 October 2026 (UTC)
- > "You could have a
- Why have a key for all boot phases though? That does nothing useful, as the default is to sign from enter-initrd to ready. It would only seal secrets at shutdown. If you want only one key for just using cryptenroll during initrd, then just make one for Phases=enter-initrd. That's much better than all phases, but if you name it the default name, systemd-creds will pick it up, too.
Move PCR Policies section to be under Usage/Luks Encryption
I think the Trusted Platform Module#PCR policies is a great addition and cleans up some ambiguities/misleading information that has been floating around the wiki. I think the Trusted Platform Module#PCR policies, however, only applies to Trusted Platform Module#LUKS encryption, and therefore should be a subsection of that. That change would then be useful for replacing the repetitive, but out of date, information at Dm-crypt/Encrypting an entire system#Enrolling the TPM and Systemd-cryptenroll#Trusted Platform Module with one or two sentences and a link to Trusted Platform Module#LUKS encryption. Does that make sense?
Following this rabbit hole deeper, Trusted Platform Module#PCR policies includes code for creating a signature for the UKI and the PCR policy. The UKI signature part is just a repeat of the information at Unified kernel image#ukify 2 without the warning note and without presenting the ability to use sbctl, dracut, or a mkinitcpio hook for signing the UKI. Does it make sense to offload the UKI signing part to Unified kernel image#Signing the UKIs for Secure Boot. Does that make sense? Dshub (talk) 19:09, 17 September 2025 (UTC)
- The solution proposed in this section is insecure. By excluding PCR7 from the TPM policy, an attacker can disable Secure Boot and boot a rogue software that will make the necessary measurements into PCR11, as the intended software would. Once the exepcted value is set to PCR11, the rogue software can use the signed policy to unseal the secret. Note that the values used to extend PCR11 can be determined by analyzing the original software, these values are not secret. Generally speaking, PCR measurements are predictable, and the security does not rely on the secrecy of these values but on the fact that the boot path cannot be tampered without affecting these measurements. Dylanjan (talk) 19:31, 17 September 2025 (UTC)
- I am not sure why PCR7 is left out (and why this is the new default in systemd v258). It seems like tpm2-pcrlock should take care of this, but it is not described at all in the wiki. While there should be a warning about the security implications of the PCR choices, the point of my comment is to try and consolidate the information that is spread out across the wiki into a single place where users can compare different approaches to using the TPM to decrypt the root volume. Right now there are critical security warnings spread out across multiple pages that all recommend slightly different things. Dshub (talk) 20:26, 17 September 2025 (UTC)
- See [5] for why PCR 7 literal hash is left out. We do need an article about pcrlock and combining it with pcr policies. Cvlc (talk) 12:52, 6 November 2025 (UTC)
- As someone who does not really know much about all of this stuff (yet), I agree that it'd be helpful to make this information more easily accessible. For example, I had Grub with sbctl for Secure Boot set up, I now changed that to UKIs + systemd-boot, keeping sbctl (which also is recommended in many places on the wiki). I plan on setting up LUKS encryption with TPM, so reading this page, which linked to that page for further information, where it says to read this page's PCR policies section, I feel more confused than when I started, e.g. on how I'd (properly) set that up with sbctl. Especially with stuff like this, where you can't just change some config file until it kinda works and where setting it up correctly is pretty important for it to actually be secure, it'd be pretty tedious to work out by myself (and possibly cause damage to my system). So yeah, it'd be great if someone more knowledgeable than me could make this topic a little easier to get into. CraftingShadowDE (talk) 20:39, 1 February 2026 (UTC)
- systemd-pcrlock is very difficult to use at this point. For it to be really useful, you need quite a bit of scripting. pcrlock maintains a constant policy state and it can only update or do anything if that state is maintained, so even post-boot locks like systemd-pcrfs@ which measures into PCR[15] have their use and effect.
- I have a setup working locally for the maximal set:
- PCRs in protection mask: 0 (platform-code), 1 (platform-config), 2 (external-code), 3 (external-config), 4 (boot-loader-code), 5 (boot-loader-config), 7 (secure-boot-policy), 11 (kernel-boot), 13 (sysexts), 14 (shim-policy), 15 (system-identity)
- However, my secure boot policy doesn't require Microsoft and their dbx (no dual boot, OpROMs signed myself), and I have a mainboard supporting EFI Capsule on Disk, so fwupd isn't gonna mess with my PCR[4]. Also, my PCR[15] script atm doesn't handle multiple drives.
- I want to publish this eventually when I've got it in a more cleaned up state and also addressed these issues. But so far, this isn't exactly easy and user friendly.
- I think with some scripting it would be possible to make it such that it can be used easily. In theory, pcrlock provides passive security because everything (cryptenroll, creds, etc.) picks it up and only allows access if in compliance. ChrisTX (talk) 02:21, 8 October 2026 (UTC)
- This is entirely correct, btw. PCR policies are anchored in systemd-stub trust, and so you need something else to ensure the integrity of systemd-stub. PCR[7] is the usual choice, but with systemd-pcrlock you could also add PCR[4].
- You can use pcr policies without PCR[7] for systemd-creds usage though, as they are also anchored otherwise in the SRK. ChrisTX (talk) 02:15, 8 October 2026 (UTC)
- I am not sure why PCR7 is left out (and why this is the new default in systemd v258). It seems like tpm2-pcrlock should take care of this, but it is not described at all in the wiki. While there should be a warning about the security implications of the PCR choices, the point of my comment is to try and consolidate the information that is spread out across the wiki into a single place where users can compare different approaches to using the TPM to decrypt the root volume. Right now there are critical security warnings spread out across multiple pages that all recommend slightly different things. Dshub (talk) 20:26, 17 September 2025 (UTC)