summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-security
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2021-05-13 02:17:39 +0000
committerKhem Raj <raj.khem@gmail.com>2021-05-12 20:45:50 -0700
commite4ea756eebf9f742e91f31debcc4244324baa2f7 (patch)
tree8013deeeac72256dcbc46be685e3949369648802 /meta-oe/recipes-security
parent9975c11e4abc324f5e4246071f331e05afd3ac0c (diff)
downloadmeta-openembedded-e4ea756eebf9f742e91f31debcc4244324baa2f7.tar.gz
audit: migrate from meta-selinux
Move audit to a more common layer to simplify integration. Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-security')
-rw-r--r--meta-oe/recipes-security/audit/audit/Add-substitue-functions-for-strndupa-rawmemchr.patch133
-rw-r--r--meta-oe/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch57
-rw-r--r--meta-oe/recipes-security/audit/audit/audit-volatile.conf1
-rw-r--r--meta-oe/recipes-security/audit/audit/auditd153
-rw-r--r--meta-oe/recipes-security/audit/audit/auditd.service28
-rw-r--r--meta-oe/recipes-security/audit/audit_2.8.5.bb105
-rw-r--r--meta-oe/recipes-security/audit/audit_3.0.1.bb109
7 files changed, 586 insertions, 0 deletions
diff --git a/meta-oe/recipes-security/audit/audit/Add-substitue-functions-for-strndupa-rawmemchr.patch b/meta-oe/recipes-security/audit/audit/Add-substitue-functions-for-strndupa-rawmemchr.patch
new file mode 100644
index 000000000..bb6c61e80
--- /dev/null
+++ b/meta-oe/recipes-security/audit/audit/Add-substitue-functions-for-strndupa-rawmemchr.patch
@@ -0,0 +1,133 @@
1From bdcdc3dff4469aac88e718bd15958d5ed4b9392a Mon Sep 17 00:00:00 2001
2From: Steve Grubb <sgrubb@redhat.com>
3Date: Tue, 26 Feb 2019 18:33:33 -0500
4Subject: [PATCH] Add substitue functions for strndupa & rawmemchr
5
6Upstream-Status: Backport
7[https://github.com/linux-audit/audit-userspace/commit/d579a08bb1cde71f939c13ac6b2261052ae9f77e]
8---
9 auparse/auparse.c | 12 +++++++++++-
10 auparse/interpret.c | 9 ++++++++-
11 configure.ac | 14 +++++++++++++-
12 src/ausearch-lol.c | 12 +++++++++++-
13 4 files changed, 43 insertions(+), 4 deletions(-)
14
15diff --git a/auparse/auparse.c b/auparse/auparse.c
16index 650db02..2e1c737 100644
17--- a/auparse/auparse.c
18+++ b/auparse/auparse.c
19@@ -1,5 +1,5 @@
20 /* auparse.c --
21- * Copyright 2006-08,2012-17 Red Hat Inc., Durham, North Carolina.
22+ * Copyright 2006-08,2012-19 Red Hat Inc., Durham, North Carolina.
23 * All Rights Reserved.
24 *
25 * This library is free software; you can redistribute it and/or
26@@ -1118,6 +1118,16 @@ static int str2event(char *s, au_event_t *e)
27 return 0;
28 }
29
30+#ifndef HAVE_STRNDUPA
31+static inline char *strndupa(const char *old, size_t n)
32+{
33+ size_t len = strnlen(old, n);
34+ char *tmp = alloca(len + 1);
35+ tmp[len] = 0;
36+ return memcpy(tmp, old, len);
37+}
38+#endif
39+
40 /* Returns 0 on success and 1 on error */
41 static int extract_timestamp(const char *b, au_event_t *e)
42 {
43diff --git a/auparse/interpret.c b/auparse/interpret.c
44index 51c4a5e..67b7b77 100644
45--- a/auparse/interpret.c
46+++ b/auparse/interpret.c
47@@ -853,6 +853,13 @@ err_out:
48 return print_escaped(id->val);
49 }
50
51+// rawmemchr is faster. Let's use it if we have it.
52+#ifdef HAVE_RAWMEMCHR
53+#define STRCHR rawmemchr
54+#else
55+#define STRCHR strchr
56+#endif
57+
58 static const char *print_proctitle(const char *val)
59 {
60 char *out = (char *)print_escaped(val);
61@@ -863,7 +870,7 @@ static const char *print_proctitle(const char *val)
62 // Proctitle has arguments separated by NUL bytes
63 // We need to write over the NUL bytes with a space
64 // so that we can see the arguments
65- while ((ptr = rawmemchr(ptr, '\0'))) {
66+ while ((ptr = STRCHR(ptr, '\0'))) {
67 if (ptr >= end)
68 break;
69 *ptr = ' ';
70diff --git a/configure.ac b/configure.ac
71index 54bdbf1..aef07fb 100644
72--- a/configure.ac
73+++ b/configure.ac
74@@ -1,7 +1,7 @@
75 dnl
76 define([AC_INIT_NOTICE],
77 [### Generated automatically using autoconf version] AC_ACVERSION [
78-### Copyright 2005-18 Steve Grubb <sgrubb@redhat.com>
79+### Copyright 2005-19 Steve Grubb <sgrubb@redhat.com>
80 ###
81 ### Permission is hereby granted, free of charge, to any person obtaining a
82 ### copy of this software and associated documentation files (the "Software"),
83@@ -72,6 +72,18 @@ dnl; posix_fallocate is used in audisp-remote
84 AC_CHECK_FUNCS([posix_fallocate])
85 dnl; signalfd is needed for libev
86 AC_CHECK_FUNC([signalfd], [], [ AC_MSG_ERROR([The signalfd system call is necessary for auditd]) ])
87+dnl; check if rawmemchr is available
88+AC_CHECK_FUNCS([rawmemchr])
89+dnl; check if strndupa is available
90+AC_LINK_IFELSE(
91+ [AC_LANG_SOURCE(
92+ [[
93+ #define _GNU_SOURCE
94+ #include <string.h>
95+ int main() { (void) strndupa("test", 10); return 0; }]])],
96+ [AC_DEFINE(HAVE_STRNDUPA, 1, [Let us know if we have it or not])],
97+ []
98+)
99
100 ALLWARNS=""
101 ALLDEBUG="-g"
102diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c
103index 5d17a72..758c33e 100644
104--- a/src/ausearch-lol.c
105+++ b/src/ausearch-lol.c
106@@ -1,6 +1,6 @@
107 /*
108 * ausearch-lol.c - linked list of linked lists library
109-* Copyright (c) 2008,2010,2014,2016 Red Hat Inc., Durham, North Carolina.
110+* Copyright (c) 2008,2010,2014,2016,2019 Red Hat Inc., Durham, North Carolina.
111 * All Rights Reserved.
112 *
113 * This software may be freely redistributed and/or modified under the
114@@ -152,6 +152,16 @@ static int compare_event_time(event *e1, event *e2)
115 return 0;
116 }
117
118+#ifndef HAVE_STRNDUPA
119+static inline char *strndupa(const char *old, size_t n)
120+{
121+ size_t len = strnlen(old, n);
122+ char *tmp = alloca(len + 1);
123+ tmp[len] = 0;
124+ return memcpy(tmp, old, len);
125+}
126+#endif
127+
128 /*
129 * This function will look at the line and pick out pieces of it.
130 */
131--
1322.7.4
133
diff --git a/meta-oe/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch b/meta-oe/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch
new file mode 100644
index 000000000..740bcb5a7
--- /dev/null
+++ b/meta-oe/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch
@@ -0,0 +1,57 @@
1From 3d13f92c1bb293523670ba01aea7e655b00a6709 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Sun, 19 Jul 2015 02:42:58 +0900
4Subject: [PATCH] audit: Fixed swig host contamination issue
5
6The audit build uses swig to generate a python wrapper.
7Unfortunately, the swig info file references host include
8directories. Some of these were previously noticed and
9eliminated, but the one fixed here was not.
10
11Upstream-Status: Inappropriate [embedded specific]
12
13Signed-off-by: Anders Hedlund <anders.hedlund@windriver.com>
14Signed-off-by: Joe Slater <jslater@windriver.com>
15Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
16---
17 bindings/swig/python3/Makefile.am | 3 ++-
18 bindings/swig/src/auditswig.i | 2 +-
19 2 files changed, 3 insertions(+), 2 deletions(-)
20
21diff --git a/bindings/swig/python3/Makefile.am b/bindings/swig/python3/Makefile.am
22index dd9d934..61b486d 100644
23--- a/bindings/swig/python3/Makefile.am
24+++ b/bindings/swig/python3/Makefile.am
25@@ -22,6 +22,7 @@
26 CONFIG_CLEAN_FILES = *.loT *.rej *.orig
27 AM_CFLAGS = -fPIC -DPIC -fno-strict-aliasing $(PYTHON3_CFLAGS)
28 AM_CPPFLAGS = -I. -I$(top_builddir) -I${top_srcdir}/lib $(PYTHON3_INCLUDES)
29+STDINC ?= /usr/include
30 LIBS = $(top_builddir)/lib/libaudit.la
31 SWIG_FLAGS = -python -py3 -modern
32 SWIG_INCLUDES = -I. -I$(top_builddir) -I${top_srcdir}/lib $(PYTHON3_INCLUDES)
33@@ -36,7 +37,7 @@ _audit_la_DEPENDENCIES =${top_srcdir}/lib/libaudit.h ${top_builddir}/lib/libaudi
34 _audit_la_LIBADD = ${top_builddir}/lib/libaudit.la
35 nodist__audit_la_SOURCES = audit_wrap.c
36 audit.py audit_wrap.c: ${srcdir}/../src/auditswig.i
37- swig -o audit_wrap.c ${SWIG_FLAGS} ${SWIG_INCLUDES} ${srcdir}/../src/auditswig.i
38+ swig -o audit_wrap.c ${SWIG_FLAGS} ${SWIG_INCLUDES} -I$(STDINC) ${srcdir}/../src/auditswig.i
39
40 CLEANFILES = audit.py* audit_wrap.c *~
41
42diff --git a/bindings/swig/src/auditswig.i b/bindings/swig/src/auditswig.i
43index 21aafca..dd0f62c 100644
44--- a/bindings/swig/src/auditswig.i
45+++ b/bindings/swig/src/auditswig.i
46@@ -39,7 +39,7 @@ signed
47 #define __attribute(X) /*nothing*/
48 typedef unsigned __u32;
49 typedef unsigned uid_t;
50-%include "/usr/include/linux/audit.h"
51+%include "linux/audit.h"
52 #define __extension__ /*nothing*/
53 %include <stdint.i>
54 %include "../lib/libaudit.h"
55--
562.17.1
57
diff --git a/meta-oe/recipes-security/audit/audit/audit-volatile.conf b/meta-oe/recipes-security/audit/audit/audit-volatile.conf
new file mode 100644
index 000000000..9cbe1547a
--- /dev/null
+++ b/meta-oe/recipes-security/audit/audit/audit-volatile.conf
@@ -0,0 +1 @@
d /var/log/audit 0750 root root -
diff --git a/meta-oe/recipes-security/audit/audit/auditd b/meta-oe/recipes-security/audit/audit/auditd
new file mode 100644
index 000000000..6aa7f9475
--- /dev/null
+++ b/meta-oe/recipes-security/audit/audit/auditd
@@ -0,0 +1,153 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: auditd
4# Required-Start: $local_fs
5# Required-Stop: $local_fs
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: Audit Daemon
9# Description: Collects audit information from Linux 2.6 Kernels.
10### END INIT INFO
11
12# Author: Philipp Matthias Hahn <pmhahn@debian.org>
13# Based on Debians /etc/init.d/skeleton and Auditds init.d/auditd.init
14
15# June, 2012: Adopted for yocto <amy.fong@windriver.com>
16
17# PATH should only include /usr/* if it runs after the mountnfs.sh script
18PATH=/sbin:/bin:/usr/sbin:/usr/bin
19DESC="audit daemon"
20NAME=auditd
21DAEMON=/sbin/auditd
22PIDFILE=/var/run/"$NAME".pid
23SCRIPTNAME=/etc/init.d/"$NAME"
24
25# Exit if the package is not installed
26[ -x "$DAEMON" ] || exit 0
27
28# Read configuration variable file if it is present
29[ -r /etc/default/"$NAME" ] && . /etc/default/"$NAME"
30
31. /etc/default/rcS
32
33. /etc/init.d/functions
34
35#
36# Function that starts the daemon/service
37#
38do_start()
39{
40 # Return
41 # 0 if daemon has been started
42 # 1 if daemon was already running
43 # 2 if daemon could not be started
44 start-stop-daemon -S --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --test > /dev/null \
45 || return 1
46 start-stop-daemon -S --quiet --pidfile "$PIDFILE" --exec "$DAEMON" -- \
47 $EXTRAOPTIONS \
48 || return 2
49 if [ -f /etc/audit/audit.rules ]
50 then
51 /sbin/auditctl -R /etc/audit/audit.rules >/dev/null
52 fi
53}
54
55#
56# Function that stops the daemon/service
57#
58do_stop()
59{
60 # Return
61 # 0 if daemon has been stopped
62 # 1 if daemon was already stopped
63 # 2 if daemon could not be stopped
64 # other if a failure occurred
65 start-stop-daemon -K --quiet --pidfile "$PIDFILE" --name "$NAME"
66 RETVAL="$?"
67 [ "$RETVAL" = 2 ] && return 2
68 # Many daemons don't delete their pidfiles when they exit.
69 rm -f "$PIDFILE"
70 rm -f /var/run/audit_events
71 # Remove watches so shutdown works cleanly
72 case "$AUDITD_CLEAN_STOP" in
73 no|NO) ;;
74 *) /sbin/auditctl -D >/dev/null ;;
75 esac
76 return "$RETVAL"
77}
78
79#
80# Function that sends a SIGHUP to the daemon/service
81#
82do_reload() {
83 start-stop-daemon -K --signal HUP --quiet --pidfile $PIDFILE --name $NAME
84 return 0
85}
86
87if [ ! -e /var/log/audit ]; then
88 mkdir -p /var/log/audit
89 [ -x /sbin/restorecon ] && /sbin/restorecon -F $(readlink -f /var/log/audit)
90fi
91
92case "$1" in
93 start)
94 [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME"
95 do_start
96 case "$?" in
97 0|1) [ "$VERBOSE" != no ] && echo 0 ;;
98 2) [ "$VERBOSE" != no ] && echo 1 ;;
99 esac
100 ;;
101 stop)
102 [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME"
103 do_stop
104 case "$?" in
105 0|1) [ "$VERBOSE" != no ] && echo 0 ;;
106 2) [ "$VERBOSE" != no ] && echo 1 ;;
107 esac
108 ;;
109 reload|force-reload)
110 echo "Reloading $DESC" "$NAME"
111 do_reload
112 echo $?
113 ;;
114 restart)
115 echo "Restarting $DESC" "$NAME"
116 do_stop
117 case "$?" in
118 0|1)
119 do_start
120 case "$?" in
121 0) echo 0 ;;
122 1) echo 1 ;; # Old process is still running
123 *) echo 1 ;; # Failed to start
124 esac
125 ;;
126 *)
127 # Failed to stop
128 echo 1
129 ;;
130 esac
131 ;;
132 rotate)
133 echo "Rotating $DESC logs" "$NAME"
134 start-stop-daemon -K --signal USR1 --quiet --pidfile "$PIDFILE" --name "$NAME"
135 echo $?
136 ;;
137 status)
138 pidofproc "$DAEMON" >/dev/null
139 status=$?
140 if [ $status -eq 0 ]; then
141 echo "$NAME is running."
142 else
143 echo "$NAME is not running."
144 fi
145 exit $status
146 ;;
147 *)
148 echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|rotate|status}" >&2
149 exit 3
150 ;;
151esac
152
153:
diff --git a/meta-oe/recipes-security/audit/audit/auditd.service b/meta-oe/recipes-security/audit/audit/auditd.service
new file mode 100644
index 000000000..06c63f0e5
--- /dev/null
+++ b/meta-oe/recipes-security/audit/audit/auditd.service
@@ -0,0 +1,28 @@
1[Unit]
2Description=Security Auditing Service
3DefaultDependencies=no
4After=local-fs.target systemd-tmpfiles-setup.service
5Before=sysinit.target shutdown.target
6Conflicts=shutdown.target
7ConditionKernelCommandLine=!audit=0
8
9[Service]
10Type=forking
11PIDFile=/run/auditd.pid
12ExecStart=/sbin/auditd
13## To use augenrules, uncomment the next line and comment/delete the auditctl line.
14## NOTE: augenrules expect any rules to be added to /etc/audit/rules.d/
15#ExecStartPost=-/sbin/augenrules --load
16ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules
17# By default we don't clear the rules on exit.
18# To enable this, uncomment the next line.
19#ExecStopPost=/sbin/auditctl -R /etc/audit/audit-stop.rules
20
21### Security Settings ###
22MemoryDenyWriteExecute=true
23LockPersonality=true
24ProtectControlGroups=true
25ProtectKernelModules=true
26
27[Install]
28WantedBy=multi-user.target
diff --git a/meta-oe/recipes-security/audit/audit_2.8.5.bb b/meta-oe/recipes-security/audit/audit_2.8.5.bb
new file mode 100644
index 000000000..ee3b3b5e0
--- /dev/null
+++ b/meta-oe/recipes-security/audit/audit_2.8.5.bb
@@ -0,0 +1,105 @@
1SUMMARY = "User space tools for kernel auditing"
2DESCRIPTION = "The audit package contains the user space utilities for \
3storing and searching the audit records generated by the audit subsystem \
4in the Linux kernel."
5HOMEPAGE = "http://people.redhat.com/sgrubb/audit/"
6SECTION = "base"
7LICENSE = "GPLv2+ & LGPLv2+"
8LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
9
10SRC_URI = "git://github.com/linux-audit/${BPN}-userspace.git;branch=2.8_maintenance \
11 file://Add-substitue-functions-for-strndupa-rawmemchr.patch \
12 file://Fixed-swig-host-contamination-issue.patch \
13 file://auditd \
14 file://auditd.service \
15 file://audit-volatile.conf \
16"
17
18S = "${WORKDIR}/git"
19SRCREV = "5fae55c1ad15b3cefe6890eba7311af163e9133c"
20
21inherit autotools python3native update-rc.d systemd
22
23UPDATERCPN = "auditd"
24INITSCRIPT_NAME = "auditd"
25INITSCRIPT_PARAMS = "defaults"
26
27SYSTEMD_PACKAGES = "auditd"
28SYSTEMD_SERVICE_auditd = "auditd.service"
29
30DEPENDS += "python3 tcp-wrappers libcap-ng linux-libc-headers swig-native"
31
32EXTRA_OECONF += "--without-prelude \
33 --with-libwrap \
34 --enable-gssapi-krb5=no \
35 --with-libcap-ng=yes \
36 --with-python3=yes \
37 --libdir=${base_libdir} \
38 --sbindir=${base_sbindir} \
39 --without-python \
40 --without-golang \
41 --disable-zos-remote \
42 "
43EXTRA_OECONF_append_arm = " --with-arm=yes"
44EXTRA_OECONF_append_aarch64 = " --with-aarch64=yes"
45
46EXTRA_OEMAKE += "PYLIBVER='python${PYTHON_BASEVERSION}' \
47 PYINC='${STAGING_INCDIR}/$(PYLIBVER)' \
48 pyexecdir=${libdir}/python${PYTHON_BASEVERSION}/site-packages \
49 STDINC='${STAGING_INCDIR}' \
50 pkgconfigdir=${libdir}/pkgconfig \
51 "
52
53SUMMARY_audispd-plugins = "Plugins for the audit event dispatcher"
54DESCRIPTION_audispd-plugins = "The audispd-plugins package provides plugins for the real-time \
55interface to the audit system, audispd. These plugins can do things \
56like relay events to remote machines or analyze events for suspicious \
57behavior."
58
59PACKAGES =+ "audispd-plugins"
60PACKAGES += "auditd ${PN}-python"
61
62FILES_${PN} = "${sysconfdir}/libaudit.conf ${base_libdir}/libaudit.so.1* ${base_libdir}/libauparse.so.*"
63FILES_auditd += "${bindir}/* ${base_sbindir}/* ${sysconfdir}/*"
64FILES_audispd-plugins += "${sysconfdir}/audisp/audisp-remote.conf \
65 ${sysconfdir}/audisp/plugins.d/au-remote.conf \
66 ${sbindir}/audisp-remote ${localstatedir}/spool/audit \
67 "
68FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug"
69FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
70
71CONFFILES_auditd += "${sysconfdir}/audit/audit.rules"
72RDEPENDS_auditd += "bash"
73
74do_install_append() {
75 rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a
76 rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la
77
78 # reuse auditd config
79 [ ! -e ${D}/etc/default ] && mkdir ${D}/etc/default
80 mv ${D}/etc/sysconfig/auditd ${D}/etc/default
81 rmdir ${D}/etc/sysconfig/
82
83 # replace init.d
84 install -D -m 0755 ${WORKDIR}/auditd ${D}/etc/init.d/auditd
85 rm -rf ${D}/etc/rc.d
86
87 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
88 install -d ${D}${sysconfdir}/tmpfiles.d/
89 install -m 0644 ${WORKDIR}/audit-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
90 fi
91
92 # install systemd unit files
93 install -d ${D}${systemd_unitdir}/system
94 install -m 0644 ${WORKDIR}/auditd.service ${D}${systemd_unitdir}/system
95
96 # audit-2.5 doesn't install any rules by default, so we do that here
97 mkdir -p ${D}/etc/audit ${D}/etc/audit/rules.d
98 cp ${S}/rules/10-base-config.rules ${D}/etc/audit/rules.d/audit.rules
99
100 chmod 750 ${D}/etc/audit ${D}/etc/audit/rules.d
101 chmod 640 ${D}/etc/audit/auditd.conf ${D}/etc/audit/rules.d/audit.rules
102
103 # Based on the audit.spec "Copy default rules into place on new installation"
104 cp ${D}/etc/audit/rules.d/audit.rules ${D}/etc/audit/audit.rules
105}
diff --git a/meta-oe/recipes-security/audit/audit_3.0.1.bb b/meta-oe/recipes-security/audit/audit_3.0.1.bb
new file mode 100644
index 000000000..ba24d360e
--- /dev/null
+++ b/meta-oe/recipes-security/audit/audit_3.0.1.bb
@@ -0,0 +1,109 @@
1SUMMARY = "User space tools for kernel auditing"
2DESCRIPTION = "The audit package contains the user space utilities for \
3storing and searching the audit records generated by the audit subsystem \
4in the Linux kernel."
5HOMEPAGE = "http://people.redhat.com/sgrubb/audit/"
6SECTION = "base"
7LICENSE = "GPLv2+ & LGPLv2+"
8LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
9
10SRC_URI = "git://github.com/linux-audit/${BPN}-userspace.git;branch=master \
11 file://Fixed-swig-host-contamination-issue.patch \
12 file://auditd \
13 file://auditd.service \
14 file://audit-volatile.conf \
15"
16
17S = "${WORKDIR}/git"
18SRCREV = "46cb7d92443c9ec7b3af15fb0baa65f65f6415d3"
19
20inherit autotools python3native update-rc.d systemd
21
22UPDATERCPN = "auditd"
23INITSCRIPT_NAME = "auditd"
24INITSCRIPT_PARAMS = "defaults"
25
26SYSTEMD_PACKAGES = "auditd"
27SYSTEMD_SERVICE_auditd = "auditd.service"
28
29DEPENDS = "python3 tcp-wrappers libcap-ng linux-libc-headers swig-native"
30
31EXTRA_OECONF = " --with-libwrap \
32 --enable-gssapi-krb5=no \
33 --with-libcap-ng=yes \
34 --with-python3=yes \
35 --libdir=${base_libdir} \
36 --sbindir=${base_sbindir} \
37 --without-python \
38 --without-golang \
39 --disable-zos-remote \
40 --with-arm=yes \
41 --with-aarch64=yes \
42 "
43
44EXTRA_OEMAKE = "PYLIBVER='python${PYTHON_BASEVERSION}' \
45 PYINC='${STAGING_INCDIR}/$(PYLIBVER)' \
46 pyexecdir=${libdir}/python${PYTHON_BASEVERSION}/site-packages \
47 STDINC='${STAGING_INCDIR}' \
48 pkgconfigdir=${libdir}/pkgconfig \
49 "
50
51SUMMARY_audispd-plugins = "Plugins for the audit event dispatcher"
52DESCRIPTION_audispd-plugins = "The audispd-plugins package provides plugins for the real-time \
53interface to the audit system, audispd. These plugins can do things \
54like relay events to remote machines or analyze events for suspicious \
55behavior."
56
57PACKAGES =+ "audispd-plugins"
58PACKAGES += "auditd ${PN}-python"
59
60FILES_${PN} = "${sysconfdir}/libaudit.conf ${base_libdir}/libaudit.so.1* ${base_libdir}/libauparse.so.*"
61FILES_auditd = "${bindir}/* ${base_sbindir}/* ${sysconfdir}/* ${datadir}/audit/*"
62FILES_audispd-plugins = "${sysconfdir}/audit/audisp-remote.conf \
63 ${sysconfdir}/audit/plugins.d/au-remote.conf \
64 ${sysconfdir}/audit/plugins.d/syslog.conf \
65 ${base_sbindir}/audisp-remote \
66 ${base_sbindir}/audisp-syslog \
67 ${localstatedir}/spool/audit \
68 "
69FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug"
70FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
71
72CONFFILES_auditd = "${sysconfdir}/audit/audit.rules"
73RDEPENDS_auditd = "bash"
74
75do_install_append() {
76 rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a
77 rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la
78
79 # reuse auditd config
80 [ ! -e ${D}/etc/default ] && mkdir ${D}/etc/default
81 mv ${D}/etc/sysconfig/auditd ${D}/etc/default
82 rmdir ${D}/etc/sysconfig/
83
84 # replace init.d
85 install -D -m 0755 ${WORKDIR}/auditd ${D}/etc/init.d/auditd
86 rm -rf ${D}/etc/rc.d
87
88 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
89 # install systemd unit files
90 install -d ${D}${systemd_unitdir}/system
91 install -m 0644 ${WORKDIR}/auditd.service ${D}${systemd_unitdir}/system
92
93 install -d ${D}${sysconfdir}/tmpfiles.d/
94 install -m 0644 ${WORKDIR}/audit-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
95 fi
96
97 # audit-2.5 doesn't install any rules by default, so we do that here
98 mkdir -p ${D}/etc/audit ${D}/etc/audit/rules.d
99 cp ${S}/rules/10-base-config.rules ${D}/etc/audit/rules.d/audit.rules
100
101 chmod 750 ${D}/etc/audit ${D}/etc/audit/rules.d
102 chmod 640 ${D}/etc/audit/auditd.conf ${D}/etc/audit/rules.d/audit.rules
103
104 # Based on the audit.spec "Copy default rules into place on new installation"
105 cp ${D}/etc/audit/rules.d/audit.rules ${D}/etc/audit/audit.rules
106
107 # Create /var/spool/audit directory for audisp-remote
108 install -m 0700 -d ${D}${localstatedir}/spool/audit
109}