diff options
author | Armin Kuster <akuster808@gmail.com> | 2021-05-13 02:17:39 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-05-12 20:45:50 -0700 |
commit | e4ea756eebf9f742e91f31debcc4244324baa2f7 (patch) | |
tree | 8013deeeac72256dcbc46be685e3949369648802 /meta-oe/recipes-security | |
parent | 9975c11e4abc324f5e4246071f331e05afd3ac0c (diff) | |
download | meta-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')
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 0000000000..bb6c61e805 --- /dev/null +++ b/meta-oe/recipes-security/audit/audit/Add-substitue-functions-for-strndupa-rawmemchr.patch | |||
@@ -0,0 +1,133 @@ | |||
1 | From bdcdc3dff4469aac88e718bd15958d5ed4b9392a Mon Sep 17 00:00:00 2001 | ||
2 | From: Steve Grubb <sgrubb@redhat.com> | ||
3 | Date: Tue, 26 Feb 2019 18:33:33 -0500 | ||
4 | Subject: [PATCH] Add substitue functions for strndupa & rawmemchr | ||
5 | |||
6 | Upstream-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 | |||
15 | diff --git a/auparse/auparse.c b/auparse/auparse.c | ||
16 | index 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 | { | ||
43 | diff --git a/auparse/interpret.c b/auparse/interpret.c | ||
44 | index 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 = ' '; | ||
70 | diff --git a/configure.ac b/configure.ac | ||
71 | index 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" | ||
102 | diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c | ||
103 | index 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 | -- | ||
132 | 2.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 0000000000..740bcb5a7f --- /dev/null +++ b/meta-oe/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | From 3d13f92c1bb293523670ba01aea7e655b00a6709 Mon Sep 17 00:00:00 2001 | ||
2 | From: Li xin <lixin.fnst@cn.fujitsu.com> | ||
3 | Date: Sun, 19 Jul 2015 02:42:58 +0900 | ||
4 | Subject: [PATCH] audit: Fixed swig host contamination issue | ||
5 | |||
6 | The audit build uses swig to generate a python wrapper. | ||
7 | Unfortunately, the swig info file references host include | ||
8 | directories. Some of these were previously noticed and | ||
9 | eliminated, but the one fixed here was not. | ||
10 | |||
11 | Upstream-Status: Inappropriate [embedded specific] | ||
12 | |||
13 | Signed-off-by: Anders Hedlund <anders.hedlund@windriver.com> | ||
14 | Signed-off-by: Joe Slater <jslater@windriver.com> | ||
15 | Signed-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 | |||
21 | diff --git a/bindings/swig/python3/Makefile.am b/bindings/swig/python3/Makefile.am | ||
22 | index 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 | |||
42 | diff --git a/bindings/swig/src/auditswig.i b/bindings/swig/src/auditswig.i | ||
43 | index 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 | -- | ||
56 | 2.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 0000000000..9cbe1547a3 --- /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 0000000000..6aa7f94751 --- /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 | ||
18 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
19 | DESC="audit daemon" | ||
20 | NAME=auditd | ||
21 | DAEMON=/sbin/auditd | ||
22 | PIDFILE=/var/run/"$NAME".pid | ||
23 | SCRIPTNAME=/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 | # | ||
38 | do_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 | # | ||
58 | do_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 | # | ||
82 | do_reload() { | ||
83 | start-stop-daemon -K --signal HUP --quiet --pidfile $PIDFILE --name $NAME | ||
84 | return 0 | ||
85 | } | ||
86 | |||
87 | if [ ! -e /var/log/audit ]; then | ||
88 | mkdir -p /var/log/audit | ||
89 | [ -x /sbin/restorecon ] && /sbin/restorecon -F $(readlink -f /var/log/audit) | ||
90 | fi | ||
91 | |||
92 | case "$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 | ;; | ||
151 | esac | ||
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 0000000000..06c63f0e5e --- /dev/null +++ b/meta-oe/recipes-security/audit/audit/auditd.service | |||
@@ -0,0 +1,28 @@ | |||
1 | [Unit] | ||
2 | Description=Security Auditing Service | ||
3 | DefaultDependencies=no | ||
4 | After=local-fs.target systemd-tmpfiles-setup.service | ||
5 | Before=sysinit.target shutdown.target | ||
6 | Conflicts=shutdown.target | ||
7 | ConditionKernelCommandLine=!audit=0 | ||
8 | |||
9 | [Service] | ||
10 | Type=forking | ||
11 | PIDFile=/run/auditd.pid | ||
12 | ExecStart=/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 | ||
16 | ExecStartPost=-/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 ### | ||
22 | MemoryDenyWriteExecute=true | ||
23 | LockPersonality=true | ||
24 | ProtectControlGroups=true | ||
25 | ProtectKernelModules=true | ||
26 | |||
27 | [Install] | ||
28 | WantedBy=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 0000000000..ee3b3b5e08 --- /dev/null +++ b/meta-oe/recipes-security/audit/audit_2.8.5.bb | |||
@@ -0,0 +1,105 @@ | |||
1 | SUMMARY = "User space tools for kernel auditing" | ||
2 | DESCRIPTION = "The audit package contains the user space utilities for \ | ||
3 | storing and searching the audit records generated by the audit subsystem \ | ||
4 | in the Linux kernel." | ||
5 | HOMEPAGE = "http://people.redhat.com/sgrubb/audit/" | ||
6 | SECTION = "base" | ||
7 | LICENSE = "GPLv2+ & LGPLv2+" | ||
8 | LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" | ||
9 | |||
10 | SRC_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 | |||
18 | S = "${WORKDIR}/git" | ||
19 | SRCREV = "5fae55c1ad15b3cefe6890eba7311af163e9133c" | ||
20 | |||
21 | inherit autotools python3native update-rc.d systemd | ||
22 | |||
23 | UPDATERCPN = "auditd" | ||
24 | INITSCRIPT_NAME = "auditd" | ||
25 | INITSCRIPT_PARAMS = "defaults" | ||
26 | |||
27 | SYSTEMD_PACKAGES = "auditd" | ||
28 | SYSTEMD_SERVICE_auditd = "auditd.service" | ||
29 | |||
30 | DEPENDS += "python3 tcp-wrappers libcap-ng linux-libc-headers swig-native" | ||
31 | |||
32 | EXTRA_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 | " | ||
43 | EXTRA_OECONF_append_arm = " --with-arm=yes" | ||
44 | EXTRA_OECONF_append_aarch64 = " --with-aarch64=yes" | ||
45 | |||
46 | EXTRA_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 | |||
53 | SUMMARY_audispd-plugins = "Plugins for the audit event dispatcher" | ||
54 | DESCRIPTION_audispd-plugins = "The audispd-plugins package provides plugins for the real-time \ | ||
55 | interface to the audit system, audispd. These plugins can do things \ | ||
56 | like relay events to remote machines or analyze events for suspicious \ | ||
57 | behavior." | ||
58 | |||
59 | PACKAGES =+ "audispd-plugins" | ||
60 | PACKAGES += "auditd ${PN}-python" | ||
61 | |||
62 | FILES_${PN} = "${sysconfdir}/libaudit.conf ${base_libdir}/libaudit.so.1* ${base_libdir}/libauparse.so.*" | ||
63 | FILES_auditd += "${bindir}/* ${base_sbindir}/* ${sysconfdir}/*" | ||
64 | FILES_audispd-plugins += "${sysconfdir}/audisp/audisp-remote.conf \ | ||
65 | ${sysconfdir}/audisp/plugins.d/au-remote.conf \ | ||
66 | ${sbindir}/audisp-remote ${localstatedir}/spool/audit \ | ||
67 | " | ||
68 | FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug" | ||
69 | FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}" | ||
70 | |||
71 | CONFFILES_auditd += "${sysconfdir}/audit/audit.rules" | ||
72 | RDEPENDS_auditd += "bash" | ||
73 | |||
74 | do_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 0000000000..ba24d360ed --- /dev/null +++ b/meta-oe/recipes-security/audit/audit_3.0.1.bb | |||
@@ -0,0 +1,109 @@ | |||
1 | SUMMARY = "User space tools for kernel auditing" | ||
2 | DESCRIPTION = "The audit package contains the user space utilities for \ | ||
3 | storing and searching the audit records generated by the audit subsystem \ | ||
4 | in the Linux kernel." | ||
5 | HOMEPAGE = "http://people.redhat.com/sgrubb/audit/" | ||
6 | SECTION = "base" | ||
7 | LICENSE = "GPLv2+ & LGPLv2+" | ||
8 | LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" | ||
9 | |||
10 | SRC_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 | |||
17 | S = "${WORKDIR}/git" | ||
18 | SRCREV = "46cb7d92443c9ec7b3af15fb0baa65f65f6415d3" | ||
19 | |||
20 | inherit autotools python3native update-rc.d systemd | ||
21 | |||
22 | UPDATERCPN = "auditd" | ||
23 | INITSCRIPT_NAME = "auditd" | ||
24 | INITSCRIPT_PARAMS = "defaults" | ||
25 | |||
26 | SYSTEMD_PACKAGES = "auditd" | ||
27 | SYSTEMD_SERVICE_auditd = "auditd.service" | ||
28 | |||
29 | DEPENDS = "python3 tcp-wrappers libcap-ng linux-libc-headers swig-native" | ||
30 | |||
31 | EXTRA_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 | |||
44 | EXTRA_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 | |||
51 | SUMMARY_audispd-plugins = "Plugins for the audit event dispatcher" | ||
52 | DESCRIPTION_audispd-plugins = "The audispd-plugins package provides plugins for the real-time \ | ||
53 | interface to the audit system, audispd. These plugins can do things \ | ||
54 | like relay events to remote machines or analyze events for suspicious \ | ||
55 | behavior." | ||
56 | |||
57 | PACKAGES =+ "audispd-plugins" | ||
58 | PACKAGES += "auditd ${PN}-python" | ||
59 | |||
60 | FILES_${PN} = "${sysconfdir}/libaudit.conf ${base_libdir}/libaudit.so.1* ${base_libdir}/libauparse.so.*" | ||
61 | FILES_auditd = "${bindir}/* ${base_sbindir}/* ${sysconfdir}/* ${datadir}/audit/*" | ||
62 | FILES_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 | " | ||
69 | FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug" | ||
70 | FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}" | ||
71 | |||
72 | CONFFILES_auditd = "${sysconfdir}/audit/audit.rules" | ||
73 | RDEPENDS_auditd = "bash" | ||
74 | |||
75 | do_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 | } | ||