openssl-util: Query engine/provider pin via ask-password (#34948)
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 3 Nov 2024 11:54:20 +0000 (12:54 +0100)
committerGitHub <noreply@github.com>
Sun, 3 Nov 2024 11:54:20 +0000 (12:54 +0100)
commitc32e54456e45b62996d69faada6fb3f2a5cd38e6
tree2aa1779ac0bf55b9521f3753977faffca2fa5f30
parentd980aee1e8e057b12fcbd20e8300248091d000d5
parenta07864a4fe8c7330ca0ccdc0213ee8e4f7e3721e
openssl-util: Query engine/provider pin via ask-password (#34948)

In mkosi, we want to support signing via a hardware token. We already
support this in systemd-repart and systemd-measure. However, if the
hardware token is protected by a pin, the pin is asked as many as 20
times when building an image as the pin is not cached and thus requested
again for every operation.

Let's introduce a custom openssl ui when we use engines and providers
and plug systemd-ask-password into the process. With
systemd-ask-password, the pin can be cached in the kernel keyring,
allowing us to reuse it without querying the user again every time to
enter the pin.

We use the private key URI as the keyring identifier so that the cached
pin can be shared across multiple tools.