summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2021-05-13 22:21:05 -0700
committerJoe MacDonald <joe@deserted.net>2021-05-14 09:26:05 -0400
commit29e586d1b40767a836e85bfb74c2a68b9ed76d3b (patch)
tree30c04ec652ed7900313ea2750b6983efd32ce97d
parent48038b45dc114592991c069eb66d174820c0701d (diff)
downloadmeta-selinux-29e586d1b40767a836e85bfb74c2a68b9ed76d3b.tar.gz
audit: pkg now in meta-oe
Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Joe MacDonald <joe@deserted.net>
-rw-r--r--recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch57
-rw-r--r--recipes-security/audit/audit/audit-volatile.conf1
-rw-r--r--recipes-security/audit/audit/auditd153
-rw-r--r--recipes-security/audit/audit/auditd.service28
-rw-r--r--recipes-security/audit/audit_3.0.1.bb109
5 files changed, 0 insertions, 348 deletions
diff --git a/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch b/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch
deleted file mode 100644
index 740bcb5..0000000
--- a/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch
+++ /dev/null
@@ -1,57 +0,0 @@
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/recipes-security/audit/audit/audit-volatile.conf b/recipes-security/audit/audit/audit-volatile.conf
deleted file mode 100644
index 9cbe154..0000000
--- a/recipes-security/audit/audit/audit-volatile.conf
+++ /dev/null
@@ -1 +0,0 @@
1d /var/log/audit 0750 root root -
diff --git a/recipes-security/audit/audit/auditd b/recipes-security/audit/audit/auditd
deleted file mode 100644
index 6aa7f94..0000000
--- a/recipes-security/audit/audit/auditd
+++ /dev/null
@@ -1,153 +0,0 @@
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/recipes-security/audit/audit/auditd.service b/recipes-security/audit/audit/auditd.service
deleted file mode 100644
index 06c63f0..0000000
--- a/recipes-security/audit/audit/auditd.service
+++ /dev/null
@@ -1,28 +0,0 @@
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/recipes-security/audit/audit_3.0.1.bb b/recipes-security/audit/audit_3.0.1.bb
deleted file mode 100644
index ba24d36..0000000
--- a/recipes-security/audit/audit_3.0.1.bb
+++ /dev/null
@@ -1,109 +0,0 @@
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}