Repository navigation
Conversation
|
it's a bit weird to search for the signature this way, but not also for the hash data? |
The current usage can derive the hash data from the roothash in the generator, so in practice it is not needed when that is specified. I am planning more changes to try and make that optional too, and then we'll discover more, but that's more complicated, so one thing at a time. This fixes the common use case of booting via mkosi, which did not use the signature so far, which is an issue for IPE among other things. |
If the signature is not specified manually, and sd-veritysetup is running on a device, try to find the parent and if it's a DPS-compliant GPT image with a signature partition, parse it and use it. This allows automatically using the signature on boot, which allows setting an IPE policy that enforces a validated signature on the rootfs too.
6116ae5 to
3331970
Compare
|
So, I claimed earlier that we had a protocol for finding the verity sig data, if you have a root hash already. Turns out we do not, I was talking BS. We probably should have though, for example by calulating That said, I wonder what the end game is here. I mean, if I understand your situation with this correctly you are working in an environment where roothash= is specified on the kernel cmdline but the signature partition isn't? But it sounds to me, that if you can specify the roothash you could as well specify the sgnature partition explicitly and that would be safer? (i mean, specifying the explicit root hash should disable the dissection logic I think, and not turn it on in a some indirect way?). Hence, we should fix the explicit configuration path for this first:
And then, separately from that, in a later PR:
The approach suggested in this PR currently (i.e. to do searching at moment of activation instead of during the generator/udev) I don't like very much tbh, because it means we do dissection/search at multiple somewhat redundant places, and might come to different results on each. I find it much cleaner, if we do dissection/search at as few places as we can get away with (which I guess means: find root fs triplet of parts in udev + find the rest from gpt-generator) |
This is just what mkosi does, just try it and you'll see. I don't think it can add partition numbers to the kernel command line as those appear after, so you'd need to mount it which requries privileges. Also I don't think hard-coding partition numbers in a UKI is a good idea in general, as that's a detail of the disk device, it shouldn't leak into the cmdline.
You cannot dissect in the generators, it's way too early for that, we have discussed this many times already. You are also assuming this is only for a single device, the one backing the root filesystem, but it isn't, it works just fine with any other DDI being opened by sd-veritysetup too. The gpt generator only looks at the device where the ESP was by design (and it makes sense to work that way). What happens here is the slowest operation of them all, setting up the verity devices via dm, so dissecting is really trivial and fast in comparison, it's not really a problem to do it at this point. |
This isn't a problem, UKI is built after the verity stuff is calculated by repart
You can't dissect in the initrd for the root partition, that's why Lennart says udev. You can dissect everything else just fine after switch root in generators, that's what we already do. |
Ok I thought it was the other way around, thanks - still, I don't think hard coding partition numbers in the kernel command line is the way to go
sure but again this is useful for anything that uses this service, not just for things coming from the gpt generator, and this is already going to open the device by definition as it's its job, so there's no much point optimizing it away |
|
I guess we can close this, given that 0a64b7b got merged: we can now set up verity with sig automatically, when using gpt-auto-generator |
If the signature is not specified manually, and sd-veritysetup is running on a device, try to find the parent and if it's a DPS-compliant GPT image with a signature partition, parse it and use it. This allows automatically using the signature on boot, which allows setting an IPE policy that enforces a validated signature on the rootfs too.