[packages/audit] load audit rules only if auditd started

glen glen at pld-linux.org
Thu Jun 27 07:25:58 CEST 2013


commit 43c4857704dc966332f5f544d2ba865799a21bee
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu Jun 27 08:25:44 2013 +0300

    load audit rules only if auditd started

 auditd.init | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/auditd.init b/auditd.init
index f5d1302..7a4c090 100755
--- a/auditd.init
+++ b/auditd.init
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# auditd        This starts and stops auditd
+# auditd	This starts and stops auditd
 #
 # chkconfig: 2345 18 87
 # description: This starts the Linux Auditing System Daemon
@@ -10,6 +10,8 @@
 # config: /etc/auditd.conf
 # pidfile: /var/run/auditd.pid
 
+PATH=/sbin:/bin:/usr/bin:/usr/sbin
+
 # Source function library
 . /etc/rc.d/init.d/functions
 
@@ -26,13 +28,19 @@ start() {
 		return
 	fi
 
+	local rc
 	msg_starting auditd
 	unset HOME MAIL USER USERNAME
 	daemon /sbin/auditd "$EXTRAOPTIONS"
 	RETVAL=$?
+	# Load the default rules if daemon started
+	if [ $RETVAL -eq 0 ] && [ -f $AUDIT_RULES ]; then
+		/sbin/auditctl -R $AUDIT_RULES >/dev/null
+		rc=$?
+		# add error code, if it was an error
+		[ $rc -ne 0 ] && RETVAL=$rc
+	fi
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/auditd
-	# Load the default rules
-	[ -f $AUDIT_RULES ] && /sbin/auditctl -R $AUDIT_RULES >/dev/null
 }
 
 stop() {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/audit.git/commitdiff/43c4857704dc966332f5f544d2ba865799a21bee



More information about the pld-cvs-commit mailing list