Projects
Mega:24.03:SP1:Everything
audit
_service:tar_scm:backport-Rewrite-legacy-servic...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-Rewrite-legacy-service-functions-in-terms-of-systemc.patch of Package audit
From 38572e7eead76015b388723038f03e2ef0b1e3c1 Mon Sep 17 00:00:00 2001 From: Steve Grubb <sgrubb@redhat.com> Date: Fri, 25 Aug 2023 10:41:20 -0400 Subject: [PATCH] Rewrite legacy service functions in terms of systemctl Reference:https://github.com/linux-audit/audit-userspace/commit/38572e7eead76015b388723038f03e2ef0b1e3c1 Conflict:init.d/Makefile.am,ChangeLog --- init.d/Makefile.am | 3 +-- init.d/audit-functions | 52 --------------------------------------- init.d/auditd.condrestart | 7 +++--- init.d/auditd.reload | 6 +---- init.d/auditd.resume | 6 +---- init.d/auditd.rotate | 6 +---- init.d/auditd.state | 4 +-- init.d/auditd.stop | 3 +-- 8 files changed, 10 insertions(+), 77 deletions(-) delete mode 100644 init.d/audit-functions diff --git a/init.d/Makefile.am b/init.d/Makefile.am index fdbf81c..3a73697 100644 --- a/init.d/Makefile.am +++ b/init.d/Makefile.am @@ -26,7 +26,7 @@ EXTRA_DIST = auditd.init auditd.service auditd.sysconfig auditd.conf \ auditd.cron libaudit.conf auditd.condrestart \ auditd.reload auditd.restart auditd.resume \ auditd.rotate auditd.state auditd.stop \ - audit-stop.rules augenrules audit-functions + audit-stop.rules augenrules libconfig = libaudit.conf if ENABLE_SYSTEMD initdir = /usr/lib/systemd/system @@ -61,7 +61,6 @@ if ENABLE_SYSTEMD $(INSTALL_SCRIPT) -D -m 750 ${srcdir}/auditd.stop ${DESTDIR}${legacydir}/stop $(INSTALL_SCRIPT) -D -m 750 ${srcdir}/auditd.restart ${DESTDIR}${legacydir}/restart $(INSTALL_SCRIPT) -D -m 750 ${srcdir}/auditd.condrestart ${DESTDIR}${legacydir}/condrestart - $(INSTALL_SCRIPT) -D -m 750 ${srcdir}/audit-functions ${DESTDIR}${libexecdir} else $(INSTALL_SCRIPT) -D ${srcdir}/auditd.init ${DESTDIR}${initdir}/auditd endif diff --git a/init.d/audit-functions b/init.d/audit-functions deleted file mode 100644 index 12f5023..0000000 --- a/init.d/audit-functions +++ /dev/null @@ -1,52 +0,0 @@ -# -*-Shell-script-*- - -# Make sure umask is sane -umask 022 - -#/usr/libexec/audit/audit-functions - -# killproc {program} [-signal] -killproc () -{ - local daemon="$1" - local sig= - [ -n "${2:-}" ] && sig=$2 - - # This matches src/auditd.c - local pid_file="/var/run/auditd.pid" - local pid_dir=$(dirname $pid_file) - - if [ ! -d "$pid_dir" ] ; then - return 4 - fi - - local pid= - if [ -f "$pid_file" ] ; then - # pid file exists, use it - while : ; do - read line - [ -z "$line" ] && break - for p in $line ; do - # pid is numeric and corresponds to a process - if [ -z "${p//[0-9]/}" ] && [ -d "/proc/$p" ] ; then - d=$(cat "/proc/$p/comm") - if [ "$d" = "$daemon" ] ; then - pid="$p" - break - fi - fi - done - done < "$pid_file" - else - # need to search /proc - p=$(pidof "$daemon") - if [ -n "$p" ] ; then - pid="$p" - fi - fi - - # At this point we should have a pid or the process is dead - if [ -n "$pid" ] && [ -n "$sig" ] ; then - kill "$sig" "$pid" >/dev/null 2>&1 - fi -} diff --git a/init.d/auditd.condrestart b/init.d/auditd.condrestart index d86e5e4..c5803ff 100644 --- a/init.d/auditd.condrestart +++ b/init.d/auditd.condrestart @@ -2,9 +2,10 @@ # Helper script to provide legacy auditd service options not # directly supported by systemd. -state=`service auditd status | awk '/^ Active/ { print $2 }'` -if [ $state = "active" ] ; then - /usr/libexec/initscripts/legacy-actions/auditd/restart +state=$(systemctl status auditd | awk '/Active:/ { print $2 }') +if [ "$state" = "active" ] ; then + /usr/libexec/initscripts/legacy-actions/auditd/stop + /bin/systemctl start auditd RETVAL="$?" exit $RETVAL fi diff --git a/init.d/auditd.reload b/init.d/auditd.reload index e689534..53ff2f4 100644 --- a/init.d/auditd.reload +++ b/init.d/auditd.reload @@ -5,13 +5,9 @@ # Check that we are root ... so non-root users stop here test $(id -u) = 0 || exit 4 -PATH=/sbin:/bin:/usr/bin:/usr/sbin -prog="auditd" -. /usr/libexec/audit-functions - printf "Reconfiguring: " /sbin/augenrules --load -killproc $prog -HUP +/sbin/auditctl --signal reload RETVAL=$? echo exit $RETVAL diff --git a/init.d/auditd.resume b/init.d/auditd.resume index 6852fd6..96189eb 100644 --- a/init.d/auditd.resume +++ b/init.d/auditd.resume @@ -5,12 +5,8 @@ # Check that we are root ... so non-root users stop here test $(id -u) = 0 || exit 4 -PATH=/sbin:/bin:/usr/bin:/usr/sbin -prog="auditd" -. /usr/libexec/audit-functions - printf "Resuming logging: " -killproc $prog -USR2 +/sbin/auditctl --signal resume RETVAL=$? echo exit $RETVAL diff --git a/init.d/auditd.rotate b/init.d/auditd.rotate index 643b935..dcb12c2 100644 --- a/init.d/auditd.rotate +++ b/init.d/auditd.rotate @@ -5,12 +5,8 @@ # Check that we are root ... so non-root users stop here test $(id -u) = 0 || exit 4 -PATH=/sbin:/bin:/usr/bin:/usr/sbin -prog="auditd" -. /usr/libexec/audit-functions - printf "Rotating logs: " -killproc $prog -USR1 +/sbin/auditctl --signal rotate RETVAL=$? echo exit $RETVAL diff --git a/init.d/auditd.state b/init.d/auditd.state index 4724c4f..6ae0845 100644 --- a/init.d/auditd.state +++ b/init.d/auditd.state @@ -6,12 +6,10 @@ test $(id -u) = 0 || exit 4 PATH=/sbin:/bin:/usr/bin:/usr/sbin -prog="auditd" state_file="/var/run/auditd.state" -. /usr/libexec/audit-functions printf "Getting auditd internal state: " -killproc $prog -CONT +/sbin/auditctl --signal state RETVAL=$? echo -e "\n" sleep 1 diff --git a/init.d/auditd.stop b/init.d/auditd.stop index d3fbc79..5049285 100644 --- a/init.d/auditd.stop +++ b/init.d/auditd.stop @@ -7,7 +7,6 @@ test $(id -u) = 0 || exit 4 PATH=/sbin:/bin:/usr/bin:/usr/sbin prog="auditd" -. /usr/libexec/audit-functions pid= p=$(pidof "$prog") if [ -n "$p" ] ; then @@ -15,7 +14,7 @@ if [ -n "$p" ] ; then fi printf "Stopping logging: " -killproc $prog -TERM +/sbin/auditctl --signal stop RETVAL=$? if [ -n "$pid" ] ; then # Wait up to 20 seconds for auditd to shutdown -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2