]> git.ipfire.org Git - thirdparty/systemd.git/commit
dissect-image: optionally, validate dm-verity signatures in userspace
authorLennart Poettering <lennart@poettering.net>
Thu, 9 Sep 2021 15:55:36 +0000 (17:55 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 28 Sep 2021 15:03:31 +0000 (17:03 +0200)
commitc2fa92e7e8907d9658646595261fa2d3433e6e4b
tree770cf1806ec34eea966caf8c7a3a1c8f628b07f6
parentd5fcc5b0532269d2450ed15a2bddca937f123ea9
dissect-image: optionally, validate dm-verity signatures in userspace

Getting certificates for dm-verity roothash signing into the trusted
kernel keychain is a royal PITA (means recompiling or rebooting with
shim), hence let's add a minimal userspace PKCS7 validation as well.

The mechanism is really simple and compatible with the verification the
kernel does. The only difference is that the certificates are searched
in /etc/verity.d/*.crt (and similar dirs in /usr/lib/, …).

We'll first try validation by passing the PKCS#7 data to the kernel, but
if that doesn't work we'll see if one of the certificates found that way
works and then attempt to attach the image without passing the PKCS#7
data to the kernel.

This makes it very easy to have fully validated GPT disk images. For
example, just copy the 'mkosi.secure-boot.crt' file you have in your
mkosi build dir to /etc/verity.d/ and things should just work.
src/resolve/resolved-dnstls-openssl.c
src/shared/dissect-image.c
src/shared/openssl-util.h