diff --git a/.gitignore b/.gitignore index 510693e8a..c68972a85 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ bindings/swig/python3/audit_wrap.c bindings/swig/python3/_audit.so init.d/auditd.service init.d/audit-rules.service +init.d/augenrules lib/*tabs.h lib/*tables.h ltmain.sh diff --git a/configure.ac b/configure.ac index 4ca3bbce1..f9f9ce620 100644 --- a/configure.ac +++ b/configure.ac @@ -458,7 +458,7 @@ AC_CONFIG_FILES([Makefile common/Makefile lib/Makefile lib/audit.pc bindings/python/python3/Makefile bindings/golang/Makefile bindings/swig/Makefile bindings/swig/src/Makefile bindings/swig/python3/Makefile tools/Makefile tools/aulast/Makefile - tools/aulast/test/Makefile + tools/aulast/test/Makefile init.d/augenrules tools/aulastlog/Makefile tools/ausyscall/Makefile m4/Makefile], [chmod +x auparse/test/run_auparse_tests.sh auparse/test/run_auparselol_test.sh]) AC_OUTPUT diff --git a/init.d/augenrules b/init.d/augenrules.in similarity index 94% rename from init.d/augenrules rename to init.d/augenrules.in index 8c1a670b8..7b29e236b 100644 --- a/init.d/augenrules +++ b/init.d/augenrules.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Script to concatenate rules files found in a base audit rules directory # to form a single /etc/audit/audit.rules file suitable for loading into @@ -34,20 +34,21 @@ LoadRules=0 RETVAL=0 cmd="$0" usage="Usage: $cmd [--check|--load]" +auditctl_bin=@sbindir@/auditctl # Delete the interim file on faults trap 'rm -f ${TmpRules}; exit 1' HUP INT QUIT PIPE TERM try_load() { if [ $LoadRules -eq 1 ] ; then - /sbin/auditctl -R ${DestinationFile} + $auditctl_bin -R ${DestinationFile} RETVAL=$? fi } # Check if audit is in immutable mode - exit if so check_immutable () { - if [ "$(auditctl -s | awk '$1 == "enabled" { print $2 }')" = "2" ] ; then + if [ "$($auditctl_bin -s | awk '$1 == "enabled" { print $2 }')" = "2" ] ; then echo "$cmd: Audit system is in immutable mode - exiting with no changes" exit 0 fi @@ -83,7 +84,7 @@ fi # - the last processed -e directive is emitted as the last line umask 0137 echo "## This file is automatically generated from $SourceRulesDir" >> "${TmpRules}" -for rules in $(/bin/ls -1v ${SourceRulesDir} | grep "\.rules$") ; do +for rules in $(ls -1v ${SourceRulesDir} | grep "\.rules$") ; do cat ${SourceRulesDir}/"${rules}" done | awk ' BEGIN {