Skip to contentSkip to conversation

audit: upgrade 3.1.2 -> 4.0

PATCH New Yi Zhao 1 participant 1 message Feb 23, 2024

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

PATCH 1/1 audit: upgrade 3.1.2 -> 4.0

ChangeLog:
https://github.com/linux-audit/audit-userspace/releases/tag/v4.0
Major changes:
Separate loading rules and logging events into separate services, audit-rules.service and auditd.service.
Drop support for python2 and SysVinit.
The auvirt and autrace programs have been dropped.
The syscall and interpretation tables have been updated for the 6.8 kernel.

* Backport patch to fix build error with musl
* Clean up configure options
* Use its own systemd service files
* Refresh patches
* Fix indentation

---
 ...-Fixed-swig-host-contamination-issue.patch |  16 +--
 ...te_malloc__-with-__attribute__-__ma.patch} |  24 +++-
 .../0002-Add-attribute-declarations.patch     |  35 ++++++
 .../audit/audit/auditd.service                |  28 -----
 meta-oe/recipes-security/audit/audit_3.1.2.bb | 116 ------------------
 meta-oe/recipes-security/audit/audit_4.0.bb   | 103 ++++++++++++++++
 6 files changed, 165 insertions(+), 157 deletions(-)
 rename meta-oe/recipes-security/audit/audit/{0002-Replace-__attribute_malloc__-with-__attribute__-__ma.patch => 0001-Replace-__attribute_malloc__-with-__attribute__-__ma.patch} (54%)
 create mode 100644 meta-oe/recipes-security/audit/audit/0002-Add-attribute-declarations.patch
 delete mode 100644 meta-oe/recipes-security/audit/audit/auditd.service
 delete mode 100644 meta-oe/recipes-security/audit/audit_3.1.2.bb
 create mode 100644 meta-oe/recipes-security/audit/audit_4.0.bb
meta-oe/recipes-security/audit/audit/0001-Fixed-swig-host-contamination-issue.patch +8 -8
index 5f2ecc141..f2755d5c0 100644
@@ -1,4 +1,4 @@
-From 9a32d42dfc6713fd0085dd4563a934afc30ec097 Mon Sep 17 00:00:00 2001
+From 5cdc667aeb7a014cdc1f8c7df8f8080408773dbe Mon Sep 17 00:00:00 2001
 From: Li xin <[email protected]>
 Date: Sun, 19 Jul 2015 02:42:58 +0900
 Subject: [PATCH] Fixed swig host contamination issue
@@ -19,7 +19,7 @@ Signed-off-by: Yi Zhao <[email protected]>
  2 files changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/bindings/swig/python3/Makefile.am b/bindings/swig/python3/Makefile.am
-index 6131e80d..2fb7207b 100644
+index c2c6def4..bcc2836c 100644
 --- a/bindings/swig/python3/Makefile.am
 +++ b/bindings/swig/python3/Makefile.am
 @@ -23,6 +23,7 @@
@@ -28,9 +28,9 @@ index 6131e80d..2fb7207b 100644
  AM_CPPFLAGS = -I. -I$(top_builddir) -I${top_srcdir}/lib $(PYTHON3_INCLUDES)
 +STDINC ?= /usr/include
  LIBS = $(top_builddir)/lib/libaudit.la
- SWIG_FLAGS = -python -py3 -modern
+ SWIG_FLAGS = -python
  SWIG_INCLUDES = -I. -I$(top_builddir) -I${top_srcdir}/lib $(PYTHON3_INCLUDES)
-@@ -37,7 +38,7 @@ _audit_la_DEPENDENCIES =${top_srcdir}/lib/libaudit.h ${top_builddir}/lib/libaudi
+@@ -37,7 +38,7 @@ _audit_la_DEPENDENCIES =${top_srcdir}/lib/audit_logging.h ${top_builddir}/lib/li
  _audit_la_LIBADD = ${top_builddir}/lib/libaudit.la
  nodist__audit_la_SOURCES  = audit_wrap.c
  audit.py audit_wrap.c: ${srcdir}/../src/auditswig.i 
@@ -40,18 +40,18 @@ index 6131e80d..2fb7207b 100644
  CLEANFILES = audit.py* audit_wrap.c *~
  
 diff --git a/bindings/swig/src/auditswig.i b/bindings/swig/src/auditswig.i
-index 9a2c5661..6cbb7295 100644
+index 6b267844..5a4e442f 100644
 --- a/bindings/swig/src/auditswig.i
 +++ b/bindings/swig/src/auditswig.i
-@@ -43,7 +43,7 @@ typedef unsigned uid_t;
-  * generating setters against them: https://github.com/swig/swig/issues/1699
+@@ -50,7 +50,7 @@ typedef unsigned uid_t;
   */
  %ignore audit_rule_data::buf;
+ 
 -%include "/usr/include/linux/audit.h"
 +%include "../lib/audit.h"
  #define __extension__ /*nothing*/
  %include <stdint.i>
- %include "../lib/libaudit.h"
+ %include "../lib/audit-records.h"
 -- 
 2.25.1
 
meta-oe/recipes-security/audit/audit/0001-Replace-__attribute_malloc__-with-__attribute__-__ma.patch renamed from meta-oe/recipes-security/audit/audit/0002-Replace-__attribute_malloc__-with-__attribute__-__ma.patch +19 -5
similarity index 54%
rename from meta-oe/recipes-security/audit/audit/0002-Replace-__attribute_malloc__-with-__attribute__-__ma.patch
rename to meta-oe/recipes-security/audit/audit/0001-Replace-__attribute_malloc__-with-__attribute__-__ma.patch
index 7f0af74a8..b1f324f22 100644
@@ -1,4 +1,4 @@
-From 679cb57fa93984fed345dd3890cdbcbaa24e8518 Mon Sep 17 00:00:00 2001
+From 88c9b2c5cebebf13f90890baebbadc60d9fe8d16 Mon Sep 17 00:00:00 2001
 From: Khem Raj <[email protected]>
 Date: Tue, 9 Aug 2022 23:57:03 -0700
 Subject: [PATCH] Replace __attribute_malloc__ with __attribute__((__malloc__))
@@ -14,14 +14,28 @@ Upstream-Status: Pending
 
 Signed-off-by: Khem Raj <[email protected]>
 ---
- auparse/auparse.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+ audisp/plugins/remote/queue.h | 2 +-
+ auparse/auparse.h             | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
 
+diff --git a/audisp/plugins/remote/queue.h b/audisp/plugins/remote/queue.h
+index 36b70d04..031507dc 100644
+--- a/audisp/plugins/remote/queue.h
++++ b/audisp/plugins/remote/queue.h
+@@ -53,7 +53,7 @@ void q_close(struct queue *q);
+  * On error, return NULL and set errno. */
+ struct queue *q_open(int q_flags, const char *path, size_t num_entries,
+ 		     size_t entry_size)
+-	__attribute_malloc__ __attr_dealloc (q_close, 1) __wur;
++	__attribute__((__malloc__)) __attr_dealloc (q_close, 1) __wur;
+ 
+ /* Add DATA to tail of Q. Return 0 on success, -1 on error and set errno. */
+ int q_append(struct queue *q, const char *data);
 diff --git a/auparse/auparse.h b/auparse/auparse.h
-index 5cb7402e..39156eff 100644
+index c27f1ff9..87c52965 100644
 --- a/auparse/auparse.h
 +++ b/auparse/auparse.h
-@@ -54,7 +54,7 @@ typedef void (*auparse_callback_ptr)(auparse_state_t *au,
+@@ -55,7 +55,7 @@ typedef void (*auparse_callback_ptr)(auparse_state_t *au,
  void auparse_destroy(auparse_state_t *au);
  void auparse_destroy_ext(auparse_state_t *au, auparse_destroy_what_t what);
  auparse_state_t *auparse_init(ausource_t source, const void *b)
meta-oe/recipes-security/audit/audit/0002-Add-attribute-declarations.patch new file +35 -0
new file mode 100644
index 000000000..349142580
@@ -0,0 +1,35 @@
+From 64cb48e1e5137b8a389c7528e611617a98389bc7 Mon Sep 17 00:00:00 2001
+From: Steve Grubb <[email protected]>
+Date: Thu, 25 Jan 2024 15:14:51 -0500
+Subject: [PATCH] Add attribute declarations
+
+Upstream-Status: Backport
+[https://github.com/linux-audit/audit-userspace/commit/64cb48e1e5137b8a389c7528e611617a98389bc7]
+
+Signed-off-by: Yi Zhao <[email protected]>
+---
+ audisp/plugins/remote/queue.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/audisp/plugins/remote/queue.h b/audisp/plugins/remote/queue.h
+index 36b70d04..2c70e839 100644
+--- a/audisp/plugins/remote/queue.h
++++ b/audisp/plugins/remote/queue.h
+@@ -1,5 +1,5 @@
+ /* queue.h -- a queue abstraction
+- * Copyright 2009, 2011 Red Hat Inc., Durham, North Carolina.
++ * Copyright 2009, 2011 Red Hat Inc.
+  * All Rights Reserved.
+  *
+  * This library is free software; you can redistribute it and/or
+@@ -25,6 +25,7 @@
+ #define QUEUE_HEADER
+ 
+ #include <sys/types.h>
++#include "common.h"   // attribute decls
+ 
+ struct queue;
+ 
+-- 
+2.25.1
+
meta-oe/recipes-security/audit/audit/auditd.service deleted +0 -28
deleted file mode 100644
index 06c63f0e5..000000000
@@ -1,28 +0,0 @@
-[Unit]
-Description=Security Auditing Service
-DefaultDependencies=no
-After=local-fs.target systemd-tmpfiles-setup.service
-Before=sysinit.target shutdown.target
-Conflicts=shutdown.target
-ConditionKernelCommandLine=!audit=0
-
-[Service]
-Type=forking
-PIDFile=/run/auditd.pid
-ExecStart=/sbin/auditd
-## To use augenrules, uncomment the next line and comment/delete the auditctl line.
-## NOTE: augenrules expect any rules to be added to /etc/audit/rules.d/
-#ExecStartPost=-/sbin/augenrules --load
-ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules
-# By default we don't clear the rules on exit.
-# To enable this, uncomment the next line.
-#ExecStopPost=/sbin/auditctl -R /etc/audit/audit-stop.rules
-
-### Security Settings ###
-MemoryDenyWriteExecute=true
-LockPersonality=true
-ProtectControlGroups=true
-ProtectKernelModules=true
-
-[Install]
-WantedBy=multi-user.target
meta-oe/recipes-security/audit/audit_3.1.2.bb deleted +0 -116

116 lines not on this page · raw message

meta-oe/recipes-security/audit/audit_4.0.bb new file +103 -0

103 lines not on this page · raw message

Signature · 1 line
2.25.1