linux-yocto%.bbappend: Add audit.cfg
PATCH 1/2 linux-yocto%.bbappend: Add audit.cfg
Add audit.cfg configuration fragment. By default it is not appended to SRC_URI. It allows enabling the audit kernel subsystem which may help to debug appraisal issues. Boot with "integrity_audit=1" to capture a more complete set of events in /var/log/audit/.
Previously the same configuration fragment was provided by layer meta-security-framework but it is no longer maintained therefore it makes sense to have audit.cfg in layer meta-integrity.
--- meta-integrity/README.md | 8 ++++++-- meta-integrity/recipes-kernel/linux/linux-yocto%.bbappend | 2 ++ meta-integrity/recipes-kernel/linux/linux/audit.cfg | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 meta-integrity/recipes-kernel/linux/linux/audit.cfg
meta-integrity/README.md +6 -2
@@ -219,12 +219,16 @@ executing the file is no longer allowed: -sh: /usr/bin/rpm: Permission denied Enabling the audit kernel subsystem may help to debug appraisal -issues. Enable it by adding the meta-security-framework layer and +issues. Enable it by adding a kernel configuration fragment and changing your local.conf: SRC_URI:append:pn-linux-yocto = " file://audit.cfg" CORE_IMAGE_EXTRA_INSTALL += "auditd" -Then boot with "ima_appraise=log ima_appraise_tcb". +Then boot with "ima_appraise=log ima_appraise_tcb integrity_audit=1". +For example, for QEMU by changing variable QB_KERNEL_CMDLINE_APPEND +in your local.conf: + QB_KERNEL_CMDLINE_APPEND:remove:pn-integrity-image-minimal = "ima_policy=tcb ima_appraise=fix" + QB_KERNEL_CMDLINE_APPEND:append:pn-integrity-image-minimal = " ima_appraise=log ima_appraise_tcb integrity_audit=1" Adding auditd is not strictly necessary but helps to capture a more complete set of events in /var/log/audit/ and search in
meta-integrity/recipes-kernel/linux/linux-yocto%.bbappend +2 -0
@@ -1 +1,3 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/linux:" + require ${@bb.utils.contains_any('DISTRO_FEATURES', 'integrity ', 'linux_ima.inc', '', d)}
meta-integrity/recipes-kernel/linux/linux/audit.cfg new file +2 -0
@@ -0,0 +1,2 @@ +CONFIG_AUDIT=y +CONFIG_AUDITSYSCALL=y
Signature · 1 line
2.34.1
PATCH 2/2 integrity-image-minimal: Fix IMAGE_INSTALL
Append to IMAGE_INSTALL rather than directly setting the variable and does it after inheriting core-image.bbclass because in it IMAGE_INSTALL is set with a default value CORE_IMAGE_BASE_INSTALL.
Variable CORE_IMAGE_BASE_INSTALL includes CORE_IMAGE_EXTRA_INSTALL so the change allows adding auditd to CORE_IMAGE_EXTRA_INSTALL as per the instructions in meta-integrity/README.md.
--- .../recipes-core/images/integrity-image-minimal.bb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
meta-integrity/recipes-core/images/integrity-image-minimal.bb +4 -6
@@ -2,18 +2,16 @@ DESCRIPTION = "An image as an exmaple for Ima support" IMAGE_FEATURES += "ssh-server-openssh" +LICENSE = "MIT" + +inherit core-image -IMAGE_INSTALL = "\ +IMAGE_INSTALL += "\ packagegroup-base \ packagegroup-core-boot \ packagegroup-ima-evm-utils \ os-release" - -LICENSE = "MIT" - -inherit core-image - export IMAGE_BASENAME = "integrity-image-minimal" INHERIT += "ima-evm-rootfs"
Signature · 1 line
2.34.1