44 Commits

Author SHA1 Message Date
Ming Liu
93232ae6d5 initramfs-framework-ima: introduce IMA_FORCE
Introduce IMA_FORCE to allow the IMA policy be applied forcely even
'no_ima' boot parameter is available.

This ensures the end users have a way to disable 'no_ima' support if
they want to, because it may expose a security risk if an attacker can
find a way to change kernel arguments, it will easily bypass rootfs
authenticity checks.

Signed-off-by: Sergio Prado <sergio.prado@toradex.com>
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-04-27 07:16:53 -07:00
Ming Liu
633239852a meta: drop IMA_POLICY from policy recipes
IMA_POLICY is being referred as policy recipe name in some places and it
is also being referred as policy file in other places, they are
conflicting with each other which make it impossible to set a IMA_POLICY
global variable in config file.

Fix it by dropping IMA_POLICY definitions from policy recipes

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-04-27 07:16:49 -07:00
Ming Liu
13db06b36c ima-evm-keys: add file-checksums to IMA_EVM_X509
This ensures when a end user change the IMA_EVM_X509 key file,
ima-evm-keys recipe will be rebuilt.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-04-27 07:16:46 -07:00
Ming Liu
653474bdc5 ima-policy-hashed: add CGROUP2_SUPER_MAGIC fsmagic
This fixes following systemd boot issues:
[    7.455580] systemd[1]: Failed to create /init.scope control group: Permission denied
[    7.457677] systemd[1]: Failed to allocate manager object: Permission denied
[!!!!!!] Failed to allocate manager object.
[    7.459270] systemd[1]: Freezing execution.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-04 13:10:30 -08:00
Ming Liu
0cf9f630c3 ima-evm-rootfs.bbclass: avoid generating /etc/fstab for wic
Or else wic will fail without "--no-fstab-update" option.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-04 13:10:30 -08:00
Ming Liu
f697c05f2a initramfs-framework-ima: let ima_enabled return 0
Otherwise, ima script would not run as intended.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-04 13:10:30 -08:00
Ming Liu
114b662c41 README.md: update according to the refactoring in ima-evm-rootfs.bbclass
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-04 13:10:30 -08:00
Ming Liu
ec5ce3fe61 meta: refactor IMA/EVM sign rootfs
The current logic in ima-evm-rootfs.bbclass does not guarantee
ima_evm_sign_rootfs is the last function in IMAGE_PREPROCESS_COMMAND
by appending to it, for instance, if there are other "_append" being
used as it's the case in openembedded-core/meta/classes/image.bbclass:

| IMAGE_PREPROCESS_COMMAND_append = " ${@ 'systemd_preset_all;' \
| if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) \
| and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True,
| False, d) else ''} reproducible_final_image_task; "

and ima-evm-rootfs should be in IMAGE_CLASSES instead of in INHERIT
since that would impact all recipes but not only image recipes.

To fix the above issues, we introduce a ima_evm_sign_handler setting
IMA/EVM rootfs signing requirements/dependencies in event
bb.event.RecipePreFinalise, it checks 'ima' distro feature to decide if
IMA/EVM rootfs signing logic should be applied or not.

Also add ima-evm-keys to IMAGE_INSTALL.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-04 13:10:30 -08:00
Ming Liu
126e1509c2 initramfs-framework-ima: RDEPENDS on ima-evm-keys
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-04 13:10:30 -08:00
Ming Liu
8de3937af1 ima-evm-keys: add recipe
Create a recipe to package IMA/EMV public keys.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-04 13:10:30 -08:00
Ming Liu
0cee6f3c50 initramfs-framework-ima: fix a wrong path
/etc/ima-policy > /etc/ima/ima-policy.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-04 13:10:30 -08:00
Ming Liu
623c939035 ima-evm-utils: set native REQUIRED_DISTRO_FEATURES to empty
'ima' does not have to be in native DISTRO_FEATURES, unset it to avoid
sanity check for ima-evm-utils-native.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-04 13:10:23 -08:00
Armin Kuster
a8340f10ea README: updated branch for Dunfell
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2020-10-17 07:16:48 -07:00
Sajjad Ahmed
4963043a05 layer.conf: use += instead of := to update BBFILES
Updating BBFILES with := isn't the standard way and can break
parsing under certain conditions, instead use += which is widely used.

Signed-off-by: Sajjad Ahmed <sajjad_ahmed@mentor.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
(cherry picked from commit 63e1cf3ffa)
2020-10-16 07:25:01 -07:00
Martin Jansa
7f7897590c layer.conf: update LAYERSERIES_COMPAT for dunfell
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2020-03-27 16:53:25 -07:00
Armin Kuster
5d629ccb54 meta-integrity: fix issues with yocto-check-layer
[v2]
re-did solutions

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2020-01-04 10:55:26 -08:00
Armin Kuster
72b05edff5 meta-security: add layer index callouts
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-12-07 15:31:34 -08:00
Armin Kuster
a0dee993cd layer.conf: Update for zeus series
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Acked-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-10-11 07:41:01 -07:00
Armin Kuster
225c3bc7d0 initramfs-framework-ima: correct IMA_POLICY name
it had ima_policy_hashed  and did not match the recipe
ima-policy-hashed

found by yocto-check-layer

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-09-07 08:32:50 -07:00
Armin Kuster
563c2af19c integrity-image: IMA_EVM_KEY_DIR has no affect, remove
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-08-24 20:43:55 -07:00
Armin Kuster
0a32d622c8 meta-integrity: remove kernel fragments now in cache
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-08-15 20:10:33 -07:00
Dmitry Eremin-Solenikov
9549b76a90 layer.conf: switch to keyutils from meta-oe
As pointer by Martin Jansa, keyutils package is now a part of meta-oe,
so switch to using keyutils from that layer.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-08-07 07:09:50 -07:00
Dmitry Eremin-Solenikov
eebe0ff18a linux: add support for kernel modules signing
Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
2019-08-07 07:09:50 -07:00
Dmitry Eremin-Solenikov
79bc2559fe kernel-modsign.bbclass: add support for kernel modules signing
Add bbclass responsible for handling signing of kernel modules.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>

fixup class to avoid including in every configure task

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-08-07 07:09:43 -07:00
Dmitry Eremin-Solenikov
c2ddc05c20 ima-evm-utils: bump to release 1.2.1
Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-08-04 13:13:38 -07:00
Dmitry Eremin-Solenikov
c9c4e6c228 meta-integrity: rename IMA_EVM_BASE to INTEGRITY_BASE
data/debug-keys will be reused for demo modsign keys, so rename
IMA_EVM_BASE to more generic INTEGRITY_BASE.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
2019-08-04 13:12:41 -07:00
lumag
fc20f45964 ima-evm-utils: refresh xattr patch
Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-08-04 12:17:25 -07:00
lumag
2fa48c800d ima-evm-utils: bump version
Currently selected SRCREV (782224f33cd711050cbf6146a12122cd73f9136b)
comes after 1.1 ima-evm-utils release, so bump PV accordingly.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-08-04 12:17:25 -07:00
lumag
964972ea01 layer.conf: add dependency on meta-security
ima-evm-utils recipe depends on keyutils recipe which is a part of
meta-security layer.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-08-04 12:17:25 -07:00
Armin Kuster
f63db8ce1d ima-evm-utils: update to tip
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-06-26 15:47:47 -07:00
Armin Kuster
41708b0b0c image: add image for testing
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
4970243bfc runtime qa: moderize ima test
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
7b287954f7 initramfs: clean up to pull in packages.
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
d1d4e78708 data: remove policies
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
cf0123e130 policy: add ima appraise all policy
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
1293478068 ima_policy_simple: add another sample policy
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
c84f39f8e0 ima-policy-hashed: add new recipe
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
8910674d19 base-files: add appending to automount securityfs
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
e7771ce287 linux: update bbappend
remove untested code

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
f26869aef3 ima.cfg: update to 5.0 kernel
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
756a1649b7 ima-evm-utils: cleanup and update to tip
update to tip
backported patches to fix build issues.
fix native support

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
d86d3353b2 README: update
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
b2587711d1 layer.conf: add LAYERSERIES_COMPAT
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:52 -07:00
Armin Kuster
6680225c05 meta-integrity: port over from meta-intel-iot-security
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2019-05-28 07:38:41 -07:00