diff options
author | Mikko Rapeli <mikko.rapeli@linaro.org> | 2024-12-20 16:04:35 +0200 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2024-12-27 11:28:23 -0500 |
commit | 6eb3098e57881895e62fc811f714c2aa4ecfcf8f (patch) | |
tree | b7c5a9fc0af9da30c68fe51ecb5509c40424cd5d | |
parent | b22814dc2a6f76511bbf596107728e7d1506fe72 (diff) | |
download | meta-security-6eb3098e57881895e62fc811f714c2aa4ecfcf8f.tar.gz |
systemd: enable TPM support
Enable "tpm2" support if "tpm2" is in DISTRO_FEATURES.
Also enable cryptsetup, openssl and repart features which
are needed to use TPM device to encrypt filesystems with
systemd configuration. See:
https://www.freedesktop.org/software/systemd/man/latest/systemd-repart.html#--tpm2-device=
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | meta-tpm/recipes-core/systemd/systemd_%.bbappend | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/meta-tpm/recipes-core/systemd/systemd_%.bbappend b/meta-tpm/recipes-core/systemd/systemd_%.bbappend new file mode 100644 index 0000000..82b79ba --- /dev/null +++ b/meta-tpm/recipes-core/systemd/systemd_%.bbappend | |||
@@ -0,0 +1,17 @@ | |||
1 | PACKAGECONFIG:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'tpm2', 'tpm2', '', d)}" | ||
2 | |||
3 | # for encrypted filesystems | ||
4 | PACKAGECONFIG:append = " \ | ||
5 | ${@bb.utils.contains('DISTRO_FEATURES', 'tpm2', 'cryptsetup cryptsetup-plugins efi openssl repart', '', d)} \ | ||
6 | " | ||
7 | |||
8 | # ukify.py and systemd-measure don't work in cross compile environment without | ||
9 | # a tpm2 device, thus switch from measured-uki (new in v256) back to tpm2 | ||
10 | # (default before v256). | ||
11 | # TODO: use swtpm-native to calculate TPM measurements | ||
12 | do_install:append() { | ||
13 | if "${@bb.utils.contains('DISTRO_FEATURES', 'tpm2', 'true', 'false', d)}"; then | ||
14 | sed -i -e "s/^ConditionSecurity=measured-uki/ConditionSecurity=tpm2/g" \ | ||
15 | $( grep -rl ^ConditionSecurity=measured-uki ${D} ) | ||
16 | fi | ||
17 | } | ||