mirror of
https://github.com/thead-yocto-mirror/meta-openembedded
synced 2026-09-16 20:21:58 +02:00
Fix below compile errors
1. Fix build with linux 5.17+
audit errors out due to swig munging it does with kernel headers
| audit_wrap.c: In function '_wrap_audit_rule_data_buf_set':
| audit_wrap.c:4701:17: error: cast specifies array type
| 4701 | arg1->buf = (char [])(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size));
| | ^
| audit_wrap.c:4701:15: error: invalid use of flexible array member
| 4701 | arg1->buf = (char [])(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size));
| | ^
| audit_wrap.c:4703:15: error: invalid use of flexible array member
| 4703 | arg1->buf = 0;
| | ^
These errors are due to VLAIS from kernel headers, so we copy
linux/audit.h and make the needed change in local audit.h and make
needed arrangements in build to use it when building audit package
Take reference of upstream commit
ee3c680c3 audit: Upgrade to 3.0.8 and fix build with linux 5.17+
Update 0002-Fixed-swig-host-contamination-issue.patch
2. Fix ipx.h missing file bug for kernel 5.15
ipx.h header file is removed in kernel 5.15
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/net?id=6c9b40844751ea30c72f7a2f92f4d704bc6b2927
which is causing below error for system with kernel equal and
higher than 5.15
| ../../git/auparse/interpret.c:48:10: fatal error: linux/ipx.h: No such file or directory
| 48 | #include <linux/ipx.h>
| | ^~~~~~~~~~~~~
Add below patch to fix this issue.
0001-Make-IPX-packet-interpretation-dependent-on-the-ipx-header.patch
Link: 6b09724c69
Signed-off-by: Akash Hadke <akash.hadke@kpit.com>
Signed-off-by: Akash Hadke <hadkeakash4@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
116 lines
4.3 KiB
BlitzBasic
116 lines
4.3 KiB
BlitzBasic
SUMMARY = "User space tools for kernel auditing"
|
|
DESCRIPTION = "The audit package contains the user space utilities for \
|
|
storing and searching the audit records generated by the audit subsystem \
|
|
in the Linux kernel."
|
|
HOMEPAGE = "http://people.redhat.com/sgrubb/audit/"
|
|
SECTION = "base"
|
|
LICENSE = "GPL-2.0-or-later & LGPL-2.0-or-later"
|
|
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
|
|
|
|
SRC_URI = "git://github.com/linux-audit/${BPN}-userspace.git;branch=2.8_maintenance;protocol=https \
|
|
file://0001-Add-substitue-functions-for-strndupa-rawmemchr.patch \
|
|
file://0002-Fixed-swig-host-contamination-issue.patch \
|
|
file://0003-Header-definitions-need-to-be-external-when-building.patch \
|
|
file://auditd \
|
|
file://auditd.service \
|
|
file://audit-volatile.conf \
|
|
file://0001-Make-IPX-packet-interpretation-dependent-on-the-ipx-header.patch \
|
|
"
|
|
|
|
S = "${WORKDIR}/git"
|
|
SRCREV = "5fae55c1ad15b3cefe6890eba7311af163e9133c"
|
|
|
|
inherit autotools python3native update-rc.d systemd
|
|
|
|
UPDATERCPN = "auditd"
|
|
INITSCRIPT_NAME = "auditd"
|
|
INITSCRIPT_PARAMS = "defaults"
|
|
|
|
SYSTEMD_PACKAGES = "auditd"
|
|
SYSTEMD_SERVICE:auditd = "auditd.service"
|
|
|
|
DEPENDS = "python3 tcp-wrappers libcap-ng linux-libc-headers swig-native"
|
|
|
|
EXTRA_OECONF = "--without-prelude \
|
|
--with-libwrap \
|
|
--enable-gssapi-krb5=no \
|
|
--with-libcap-ng=yes \
|
|
--with-python3=yes \
|
|
--libdir=${base_libdir} \
|
|
--sbindir=${base_sbindir} \
|
|
--without-python \
|
|
--without-golang \
|
|
--disable-zos-remote \
|
|
--with-arm=yes \
|
|
--with-aarch64=yes \
|
|
"
|
|
|
|
EXTRA_OEMAKE = "PYLIBVER='python${PYTHON_BASEVERSION}' \
|
|
PYINC='${STAGING_INCDIR}/$(PYLIBVER)' \
|
|
pyexecdir=${libdir}/python${PYTHON_BASEVERSION}/site-packages \
|
|
STDINC='${STAGING_INCDIR}' \
|
|
pkgconfigdir=${libdir}/pkgconfig \
|
|
"
|
|
|
|
SUMMARY:audispd-plugins = "Plugins for the audit event dispatcher"
|
|
DESCRIPTION:audispd-plugins = "The audispd-plugins package provides plugins for the real-time \
|
|
interface to the audit system, audispd. These plugins can do things \
|
|
like relay events to remote machines or analyze events for suspicious \
|
|
behavior."
|
|
|
|
PACKAGES =+ "audispd-plugins"
|
|
PACKAGES += "auditd ${PN}-python"
|
|
|
|
FILES:${PN} = "${sysconfdir}/libaudit.conf ${base_libdir}/libaudit.so.1* ${base_libdir}/libauparse.so.*"
|
|
FILES:auditd = "${bindir}/* ${base_sbindir}/* ${sysconfdir}/*"
|
|
FILES:audispd-plugins = "${sysconfdir}/audisp/audisp-remote.conf \
|
|
${sysconfdir}/audisp/plugins.d/au-remote.conf \
|
|
${base_sbindir}/audisp-remote ${localstatedir}/spool/audit \
|
|
"
|
|
FILES:${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug"
|
|
FILES:${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
|
|
|
|
CONFFILES:auditd = "${sysconfdir}/audit/audit.rules"
|
|
RDEPENDS:auditd = "bash"
|
|
|
|
do_configure:prepend() {
|
|
sed -e 's|buf\[];|buf[0];|g' ${STAGING_INCDIR}/linux/audit.h > ${S}/lib/audit.h
|
|
sed -i -e 's|#include <linux/audit.h>|#include "audit.h"|g' ${S}/lib/libaudit.h
|
|
}
|
|
|
|
do_install:append() {
|
|
rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a
|
|
rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la
|
|
|
|
# reuse auditd config
|
|
[ ! -e ${D}/etc/default ] && mkdir ${D}/etc/default
|
|
mv ${D}/etc/sysconfig/auditd ${D}/etc/default
|
|
rmdir ${D}/etc/sysconfig/
|
|
|
|
# replace init.d
|
|
install -D -m 0755 ${WORKDIR}/auditd ${D}/etc/init.d/auditd
|
|
rm -rf ${D}/etc/rc.d
|
|
|
|
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
|
|
# install systemd unit files
|
|
install -d ${D}${systemd_unitdir}/system
|
|
install -m 0644 ${WORKDIR}/auditd.service ${D}${systemd_unitdir}/system
|
|
|
|
install -d ${D}${sysconfdir}/tmpfiles.d/
|
|
install -m 0644 ${WORKDIR}/audit-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
|
|
fi
|
|
|
|
# audit-2.5 doesn't install any rules by default, so we do that here
|
|
mkdir -p ${D}/etc/audit ${D}/etc/audit/rules.d
|
|
cp ${S}/rules/10-base-config.rules ${D}/etc/audit/rules.d/audit.rules
|
|
|
|
chmod 750 ${D}/etc/audit ${D}/etc/audit/rules.d
|
|
chmod 640 ${D}/etc/audit/auditd.conf ${D}/etc/audit/rules.d/audit.rules
|
|
|
|
# Based on the audit.spec "Copy default rules into place on new installation"
|
|
cp ${D}/etc/audit/rules.d/audit.rules ${D}/etc/audit/audit.rules
|
|
|
|
# Create /var/spool/audit directory for audisp-remote
|
|
install -m 0700 -d ${D}${localstatedir}/spool/audit
|
|
}
|