!DBFhtjpqmJNENpLDOv:nixos.org

NixOS systemd

600 Members
NixOS ❤️ systemd165 Servers

Load older messages


SenderMessageTime
7 Oct 2024
@elvishjerricco:matrix.orgElvishJerriccohuh... yea I guess23:35:49
@elvishjerricco:matrix.orgElvishJerriccoI mean, this is all a number of variations on my "udev hijacking" thing I've been shouting about for like a year and a half now23:36:17
@elvishjerricco:matrix.orgElvishJerriccothough expanded beyond udev23:36:25
@elvishjerricco:matrix.orgElvishJerricco I think the most impactful solution overall is probably pcrphase, but that is a pain 23:37:45
@elvishjerricco:matrix.orgElvishJerricco I mean, I would like if I could create one .pcrsig section containing signatures of all possible phases, and then my disk could declare which phase is allowed to decrypt it. But AFAIK that's not possible with the current scheme 23:38:41
@mjm:midna.devmjmyeah i don't totally understand how to use it23:38:42
@elvishjerricco:matrix.orgElvishJerricco

mjm: The basic idea of pcrphase is that PCR 11 measures the components booted by the stub, and the current "phase". The phase is literally just a string that's measured when certain points are reached during boot. So to bind to the initrd phase, you bind to a measurement of your stub components + "enter-initrd". To bind to the "ready" phase, you bind to a measurement of your stub components + "enter-initrd" + "leave-initrd" + "sysinit" + "ready".

To make this all easier to maintain, you can predict these measurements, because PCR 11 should be zero before any of them. Then you can sign that prediction and attach it to your UKI. Your disk then is bound not to the measurements themselves, but to the public key associated with that signature. As long as the current phase as a prediction that was signed, the disk will be decrypted

23:42:14
@elvishjerricco:matrix.orgElvishJerricco *

mjm: The basic idea of pcrphase is that PCR 11 measures the components booted by the stub, and the current "phase". The phase is literally just a string that's measured when certain points are reached during boot. So to bind to the initrd phase, you bind to a measurement of your stub components + "enter-initrd". To bind to the "ready" phase, you bind to a measurement of your stub components + "enter-initrd" + "leave-initrd" + "sysinit" + "ready".

To make this all easier to maintain, you can predict these measurements, because PCR 11 should be zero before any of them. Then you can sign that prediction and attach it to your UKI. Your disk then is bound not to the measurements themselves, but to the public key associated with that signature. As long as the current phase has a prediction that was signed, the disk will be decrypted

23:43:12
@elvishjerricco:matrix.orgElvishJerriccoThe problem IMO is that I want the disk to tell me what phase is allowed to decrypt it, not the signature23:43:33
@elvishjerricco:matrix.orgElvishJerriccobecause as is, any signature for any phase is also good for any other phase23:44:04
@mjm:midna.devmjmso like for the root fs, i want to bind it to "enter-initrd"23:44:04
@elvishjerricco:matrix.orgElvishJerriccoright23:44:10
@mjm:midna.devmjmand then once the boot goes past that, the key can't be used23:44:23
@elvishjerricco:matrix.orgElvishJerriccoyep23:44:28
@elvishjerricco:matrix.orgElvishJerriccoso at that point your relying on backup keys to decrypt it23:44:44
@elvishjerricco:matrix.orgElvishJerriccowhich IMO should be the intended design of your system23:44:53
@elvishjerricco:matrix.orgElvishJerricco * so at that point you're relying on backup keys to decrypt it23:45:05
@elvishjerricco:matrix.orgElvishJerriccobut, like I said, there are two other ways to mitigate the issue. I just think pcrphase is the most hardline "you won't break this" option23:46:12
@mjm:midna.devmjmyeah23:46:46
@mjm:midna.devmjmfor a stop-gap, i could override the unlock unit to drop the condition?23:47:06
@mjm:midna.devmjmso it would always need to decrypt23:47:13
@elvishjerricco:matrix.orgElvishJerriccoI think so, yes23:47:41
@mjm:midna.devmjm at least, assuming bcachefs unlock fails if you try to do it with an unencrypted filesystem 23:48:10
@elvishjerricco:matrix.orgElvishJerricco as long as bcachefs unlock exits nonzero when used on an unencrypted file system, then the unit will fail, and sysroot.mount won't be started 23:48:13
@elvishjerricco:matrix.orgElvishJerriccothat would be mitigation style #1: "Ensure the decryption goes as planned"23:48:33
@mjm:midna.devmjmyeah23:48:37
@elvishjerricco:matrix.orgElvishJerricco scary thought: I wonder if there's any way to trick initrd into not running the ExecStop of systemd-pcrphase-initrd.service.... 23:51:25
@elvishjerricco:matrix.orgElvishJerricco Because then leave-initrd is never measured 23:51:34
@mjm:midna.devmjmyou'd have to ensure none of the later phases get measured, right?23:53:58
@elvishjerricco:matrix.orgElvishJerriccoyes23:54:09

Show newer messages


Back to Room ListRoom Version: 6