Commit Graph

79 Commits

Author SHA1 Message Date
Martin Jansa
1856a7cf43 layer.conf: update LAYERSERIES_COMPAT for nanbield
* oe-core switched to nanbield in:
  https://git.openembedded.org/openembedded-core/commit/?id=f212cb12a0db9c9de5afd3cc89b1331d386e55f6

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-09-11 07:18:19 -04:00
Armin Kuster
b9bc938785 layer: add QA_WARNINGS to all layers
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-08-06 11:31:18 -04:00
Armin Kuster
d47553303c meta-integrity: drop ima.cfg in favor of new k-cache
The upstream ima.cfg kernel-cache has been updated.
Use it instead.

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-07-31 06:18:52 -04:00
Martin Jansa
ea97a23986 *.patch: add Upstream-Status to all patches
There is new patch-status QA check in oe-core:
https://git.openembedded.org/openembedded-core/commit/?id=76a685bfcf927593eac67157762a53259089ea8a

This is temporary work around just to hide _many_ warnings from
optional patch-status (if you add it to WARN_QA).

This just added
Upstream-Status: Pending
everywhere without actually investigating what's the proper status.

This is just to hide current QA warnings and to catch new .patch files being
added without Upstream-Status, but the number of Pending patches is now terrible:

0 (0%)  	meta-parsec
N/A (0%)        meta-hardening
1 (100%)        meta-integrity
15 (68%)        meta-tpm
27 (61%)        meta-security

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-06-25 15:05:28 -04:00
Armin Kuster
ea5e2ad930 layer.conf: Insert addpylib declaration
Yocto mickledore introduced the addpylib directive for explicitly adding
layer paths to the PYTHONPATH.

Standalone OEQA test suite discovery does not require this directive but
it is required to import test cases from other layers, e.g. to extend
and modify the test cases.

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-22 09:49:16 -04:00
Stefan Berger
a0132f72ca integrity: Rename linux-%.bbappend to linux-yocto%.bbappend
To avoid having linux-%.bbappend included in targets unrelated to the
linux kernel, rename linux-%.bbappend to linux-yocto%.bbappend.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-13 06:06:29 -04:00
Stefan Berger
504f402ac5 integrity: Fix the do_configure function
Append ':append' to do_configure so it does not replace all existing
do_configure's.

Only run 'sed' when DISTRO_FEATURES contains 'ima' and the .config file
exists.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-13 06:06:29 -04:00
Stefan Berger
5dff4e47af ima: Drop kernel config option CONFIG_SQUASHFS_XATTR=y from ima.cfg
Drop the kernel config option CONFIG_SQUASHFS_XATTR=y from ima.cfg.
Instead, require projects that use squashfs to set this option.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-13 06:06:29 -04:00
Stefan Berger
25dc18d696 linux: overlayfs: Drop kernel patch resolving a file change notification issue
Revert the patch resolving a file change notitfication issue (for IMA
appraisal) since this patch fails in 'many downstream kernels'.

- https://lists.yoctoproject.org/g/yocto/message/59928
- https://lists.yoctoproject.org/g/yocto/message/59929

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-13 06:06:29 -04:00
Armin Kuster
5173c71cb4 integrity-image-minimal: adapt QEMU cmdline to new changes
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Armin Kuster
b3c7a20e1b oeqa: fix hash test to match new changes
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Stefan Berger
9de807705b ima-evm-utils: Update ima-evm-utils to v1.5 and add a patch
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Stefan Berger
319522e00d linux: overlayfs: Add kernel patch resolving a file change notification issue
Add a temporary patch that resolves a file change notification issue
with overlayfs where IMA did not become aware of the file changes
since the 'lower' inode's i_version had not changed. The issue will be
resolved in later kernels with the following patch that builds on
newly addd feature (support for STATX_CHANGE_COOKIE) in v6.3-rc1:

https://lore.kernel.org/linux-integrity/20230418-engste-gastwirtschaft-601fb389bba5@brauner/T/#m3bf84296fe9e6499abb6e3191693948add2ff459

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Stefan Berger
b9abf0e09b integrity: Update the README for IMA support
Update the README describing how IMA support can be used.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Stefan Berger
76f1f539a6 ima: Sign all executables and the ima-policy in the root filesystem
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Stefan Berger
292b49342c ima: Rename IMA_EVM_POLICY_SYSTEMD to IMA_EVM_POLICY
The IMA policy will be specified using the IMA_EVM_POLICY variable since
systemd will not be involved in loading the policy but the init script will
load it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Stefan Berger
f4f7624d2e ima: Fix the IMA kernel feature
Fix the IMA kernel feature. Remove outdated patches and add ima.cfg holding
kernel configuration options for IMA and EVM.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Stefan Berger
cb8f26d82a ima: Fix the ima_policy_appraise_all to appraise executables & libraries
Fix the ima_policy_appraise_all policy to appraise all executables
and libraries. Also update the list of files that are not appraised to not
appraise cgroup related files.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Stefan Berger
0652c9fd74 ima: Document and replace keys and adapt scripts for EC keys
For shorted file signatures use EC keys rather than RSA keys.
Document the debug keys and their purpose.
Adapt the scripts for creating these types of keys to now
create EC keys.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-05-06 07:54:09 -04:00
Mikko Rapeli
d50e7d70d9 ima-evm-utils: disable documentation from build
Building documentation fails due to missing asciidoc, xsltproc etc
so it's better to just disable building them by default.

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-03-26 16:02:07 -04:00
Martin Jansa
1550c126ce layer.conf: update LAYERSERIES_COMPAT for mickledore
* oe-core switched to mickedore in:
  https://git.openembedded.org/openembedded-core/commit/?id=57239d66b933c4313cf331d35d13ec2d0661c38f

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2023-01-04 10:32:16 -05:00
Jose Quaresma
c1c80cf0c0 meta-integrity: kernel-modsign: prevents splitting out debug symbols
Starting with [1] kernel modules symbols is being slipped in OE-core
and this breaks the kernel modules sign, so disable it.

[1] https://git.openembedded.org/openembedded-core/commit/?id=e09a8fa931fe617afc05bd5e00dca5dd3fe386e8

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2022-07-05 19:26:50 -04:00
Armin Kuster
5c215dd679 layer.conf: Post release codename changes
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2022-06-07 16:58:24 -07:00
Armin Kuster
8e59bd9e0a ima-evm-utils: Update to 1.4
Switch from git to https in SRC_URI
Drop patches not upstreamed.

Passes OEQA:
RESULTS - ima.IMACheck.test_ima_enabled: PASSED (1.05s)
RESULTS - ima.IMACheck.test_ima_hash: PASSED (6.13s)
RESULTS - ima.IMACheck.test_ima_overwrite: PASSED (131.31s)
RESULTS - ima.IMACheck.test_ima_signature: PASSED (69.03s)

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2022-05-23 07:11:55 -07:00
Armin Kuster
ddb27e71d8 ima-evm-keys: don't use lnr
lnr is a script in oe-core that creates relative symlinks, with the same
behaviour as `ln --relative --symlink`.  It was added back in 2014[1] as
not all of the supported host distributions at the time shipped
coreutils 8.16, the first release with --relative.

However the oldest coreutils release in the supported distributions is
now 8.22 in CentOS 7, so lnr can be deprecated and users switched to ln.

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2022-03-11 21:08:22 -08:00
Armin Kuster
30a4227e3c layer.conf: Update to use kirkstone
Update the layers to use the kirkstone namespace. No compatibility is made
for honister due to the variable renaming.

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2022-02-20 19:39:36 -08:00
Armin Kuster
d6f8b795a8 meta-integrity: drop strongswan bbappends
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-12-27 11:47:51 -08:00
Daiane Angolini
ab90741aa2 meta-integrity: kernel-modsign: Change weak default value
Assign a weak default value for MODSIGN_KEY_DIR so the other layers can
set a default value for them as well.

Signed-off-by: Daiane Angolini <daiane.angolini@foundries.io>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-08-26 21:43:35 -07:00
Martin Jansa
68be8afc6b layer.conf: Update to honister
This marks the layers as compatible with honister now they use the new override
syntax.

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2021-08-01 08:47:08 -07:00
Armin Kuster
b8554aae23 meta-integrity: Convert to new override syntax
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-08-01 08:47:08 -07:00
Armin Kuster
48c7b34ec3 meta-integrity/recipe-kernel: use sanity check
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-06-06 13:03:37 -07:00
Armin Kuster
6e75e751ff meta-integrity: add sanity check
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-06-06 13:03:37 -07:00
Ming Liu
076e75d5cc 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-12 07:07:11 -07:00
Ming Liu
995f25bcb9 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-02 08:21:34 -07:00
Armin Kuster
f9fdf97730 layer.conf: Add hardknott to LAYERSERIES_COMPAT
Thats codename for 3.3

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2021-03-18 08:01:19 -07:00
Ming Liu
6ada80aa3e 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-03-18 08:01:19 -07:00
Ming Liu
9504d02694 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-02 11:56:27 -08:00
Ming Liu
6612bf719f 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-02-23 20:34:51 -08:00
Ming Liu
ffab25f929 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-02-23 20:34:51 -08:00
Ming Liu
4dc646c8ce 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-02-23 20:34:51 -08:00
Ming Liu
76d1e3ecad 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-02-23 20:34:51 -08:00
Ming Liu
52bfc654e8 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-02-23 20:34:51 -08:00
Ming Liu
f70207e1c1 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-02-23 20:34:51 -08:00
Ming Liu
0f34b25763 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-02-23 20:34:51 -08:00
Ming Liu
ca1c2086ad 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-02-23 20:34:51 -08:00
Armin Kuster
58c17d008d meta-security: Add gatesgarth to LAYERSERIES_COMPAT
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2020-10-19 18:14:23 -07:00
Sajjad Ahmed
8bcc4d7057 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>
2020-10-19 18:14:13 -07:00
Armin Kuster
f876289913 meta-integrity: add dynamic-layer for strongswan
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2020-07-18 18:26:44 -07:00
Armin Kuster
9f8bdb7751 strongswan: Add bbappends for ima changes
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2020-07-18 18:26:44 -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