diff options
author | Armin Kuster <akuster808@gmail.com> | 2022-06-17 22:09:47 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2022-06-23 18:47:59 -0700 |
commit | 1f113890893e6655779518d508c394911ae0d542 (patch) | |
tree | bca2abe25b468291b22c2f8fdaa1c6f0544fd6d2 | |
parent | a0665584abfe79e8f55e1f479fa35d0a85478765 (diff) | |
download | meta-security-1f113890893e6655779518d508c394911ae0d542.tar.gz |
aide: add native support for build time db creation
This will help create a aide db during build that is
then installed on the rootfs for verification at boot time.
This work was inspired by:
Marco Cavallini
Yocto Project Ambassador
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | recipes-ids/aide/aide_0.17.4.bb | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/recipes-ids/aide/aide_0.17.4.bb b/recipes-ids/aide/aide_0.17.4.bb index 87b690d..7ce0729 100644 --- a/recipes-ids/aide/aide_0.17.4.bb +++ b/recipes-ids/aide/aide_0.17.4.bb | |||
@@ -10,7 +10,7 @@ SRC_URI = "https://github.com/aide/aide/releases/download/v${PV}/${BPN}-${PV}.ta | |||
10 | 10 | ||
11 | SRC_URI[sha256sum] = "c81505246f3ffc2e76036d43a77212ae82895b5881d9b9e25c1361b1a9b7a846" | 11 | SRC_URI[sha256sum] = "c81505246f3ffc2e76036d43a77212ae82895b5881d9b9e25c1361b1a9b7a846" |
12 | 12 | ||
13 | inherit autotools pkgconfig | 13 | inherit autotools pkgconfig aide-base |
14 | 14 | ||
15 | PACKAGECONFIG ??=" mhash zlib e2fsattrs posix capabilities curl \ | 15 | PACKAGECONFIG ??=" mhash zlib e2fsattrs posix capabilities curl \ |
16 | ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux audit', '', d)} \ | 16 | ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux audit', '', d)} \ |
@@ -27,10 +27,31 @@ PACKAGECONFIG[e2fsattrs] = "--with-e2fsattrs, --without-e2fsattrs, e2fsprogs, e2 | |||
27 | PACKAGECONFIG[capabilities] = "--with-capabilities, --without-capabilities, libcap, libcap" | 27 | PACKAGECONFIG[capabilities] = "--with-capabilities, --without-capabilities, libcap, libcap" |
28 | PACKAGECONFIG[posix] = "--with-posix-acl, --without-posix-acl, acl, acl" | 28 | PACKAGECONFIG[posix] = "--with-posix-acl, --without-posix-acl, acl, acl" |
29 | 29 | ||
30 | |||
31 | do_install[nostamp] = "1" | ||
32 | |||
30 | do_install:append () { | 33 | do_install:append () { |
31 | install -d ${D}${libdir}/${PN}/logs | 34 | install -d ${D}${libdir}/${PN}/logs |
32 | install -d ${D}${sysconfdir} | 35 | install -d ${D}${sysconfdir} |
33 | install ${WORKDIR}/aide.conf ${D}${sysconfdir}/ | 36 | install ${WORKDIR}/aide.conf ${D}${sysconfdir}/ |
37 | |||
38 | for dir in ${AIDE_INCLUDE_DIRS}; do | ||
39 | echo "${dir} NORMAL" >> ${D}${sysconfdir}/aide.conf | ||
40 | done | ||
41 | for dir in ${AIDE_SKIP_DIRS}; do | ||
42 | echo "!${dir}" >> ${D}${sysconfdir}/aide.conf | ||
43 | done | ||
44 | } | ||
45 | |||
46 | do_install:class-native () { | ||
47 | install -d ${STAGING_AIDE_DIR}/bin | ||
48 | install -d ${STAGING_AIDE_DIR}/lib/logs | ||
49 | |||
50 | install ${B}/aide ${STAGING_AIDE_DIR}/bin | ||
51 | install ${WORKDIR}/aide.conf ${STAGING_AIDE_DIR}/ | ||
52 | |||
53 | sed -i -s "s:\@\@define DBDIR.*:\@\@define DBDIR ${STAGING_AIDE_DIR}/lib:" ${STAGING_AIDE_DIR}/aide.conf | ||
54 | sed -i -e "s:\@\@define LOGDIR.*:\@\@define LOGDIR ${STAGING_AIDE_DIR}/lib/logs:" ${STAGING_AIDE_DIR}/aide.conf | ||
34 | } | 55 | } |
35 | 56 | ||
36 | CONF_FILE = "${sysconfdir}/aide.conf" | 57 | CONF_FILE = "${sysconfdir}/aide.conf" |
@@ -38,7 +59,14 @@ CONF_FILE = "${sysconfdir}/aide.conf" | |||
38 | FILES:${PN} += "${libdir}/${PN} ${sysconfdir}/aide.conf" | 59 | FILES:${PN} += "${libdir}/${PN} ${sysconfdir}/aide.conf" |
39 | 60 | ||
40 | pkg_postinst_ontarget:${PN} () { | 61 | pkg_postinst_ontarget:${PN} () { |
41 | /usr/bin/aide -i | 62 | if [ ${AIDE_SCAN_POSTINIT} ]; then |
63 | ${bindir}/aide -i | ||
64 | fi | ||
65 | if [ ${AIDE_RESCAN_POSTINIT} && -e ${libdir}/aide/aide.db.gz ]; then | ||
66 | ${bindir}/aide -C | ||
67 | fi | ||
42 | } | 68 | } |
43 | 69 | ||
44 | RDEPENDS:${PN} = "bison libpcre" | 70 | RDEPENDS:${PN} = "bison libpcre" |
71 | |||
72 | BBCLASSEXTEND = "native" | ||