Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 1 | # This recipe creates a module for the initramfs-framework in OE-core |
| 2 | # which initializes IMA by loading a policy before transferring |
| 3 | # control to the init process in the rootfs. The advantage over having |
| 4 | # that init process doing the policy loading (which systemd could do) |
| 5 | # is that already the integrity of the init binary itself will be |
| 6 | # checked by the kernel. |
| 7 | |
| 8 | SUMMARY = "IMA module for the modular initramfs system" |
| 9 | LICENSE = "MIT" |
| 10 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
| 11 | |
| 12 | # This policy file will get installed as /etc/ima/ima-policy. |
| 13 | # It is located via the normal file search path, so a .bbappend |
| 14 | # to this recipe can just point towards one of its own files. |
Brad Bishop | 1fdf4aa | 2019-09-09 14:56:41 -0400 | [diff] [blame] | 15 | IMA_POLICY ?= "ima-policy-hashed" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 16 | |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 17 | # Force proceed IMA procedure even 'no_ima' boot parameter is available. |
| 18 | IMA_FORCE ?= "false" |
| 19 | |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 20 | SRC_URI = " file://ima" |
| 21 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 22 | inherit features_check |
| 23 | REQUIRED_DISTRO_FEATURES = "ima" |
| 24 | |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 25 | do_install () { |
| 26 | install -d ${D}/${sysconfdir}/ima |
| 27 | install -d ${D}/init.d |
| 28 | install ${WORKDIR}/ima ${D}/init.d/20-ima |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 29 | |
| 30 | sed -i "s/@@FORCE_IMA@@/${IMA_FORCE}/g" ${D}/init.d/20-ima |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 31 | } |
| 32 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 33 | FILES:${PN} = "/init.d ${sysconfdir}" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 34 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 35 | RDEPENDS:${PN} = "keyutils ima-evm-keys ${IMA_POLICY}" |
| 36 | RDEPENDS:${PN} += "initramfs-framework-base" |