rpms/upstart/devel upstart-audit-events.patch, NONE, 1.1 upstart.spec, 1.28, 1.29
Casey Dahlin
sadmac at fedoraproject.org
Fri Apr 3 23:33:19 UTC 2009
- Previous message (by thread): rpms/arm4/F-11 arm4-README.fedora, NONE, 1.1 arm4-arm4.cron, NONE, 1.1 arm4-arm4.init, NONE, 1.1 arm4.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message (by thread): rpms/arm4/devel arm4.spec,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: sadmac
Update of /cvs/pkgs/rpms/upstart/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv4395
Modified Files:
upstart.spec
Added Files:
upstart-audit-events.patch
Log Message:
Add Steve Grubb's audit events patch
upstart-audit-events.patch:
--- NEW FILE upstart-audit-events.patch ---
diff -urp upstart-0.3.9.orig/compat/sysv/Makefile.am upstart-0.3.9/compat/sysv/Makefile.am
--- upstart-0.3.9.orig/compat/sysv/Makefile.am 2008-11-03 12:29:30.000000000 -0500
+++ upstart-0.3.9/compat/sysv/Makefile.am 2008-11-05 08:16:22.000000000 -0500
@@ -28,15 +28,17 @@ endif
reboot_SOURCES = reboot.c
reboot_LDFLAGS = -static
-reboot_LDADD = ../../upstart/libupstart.la ../../nih/libnih.la $(LTLIBINTL)
+reboot_LDADD = ../../upstart/libupstart.la ../../nih/libnih.la $(LTLIBINTL) \
+ @LIBAUDIT@
runlevel_SOURCES = runlevel.c
runlevel_LDFLAGS = -static
-runlevel_LDADD = ../../nih/libnih.la $(LTLIBINTL)
+runlevel_LDADD = ../../nih/libnih.la $(LTLIBINTL) @LIBAUDIT@
shutdown_SOURCES = shutdown.c
shutdown_LDFLAGS = -static
-shutdown_LDADD = ../../upstart/libupstart.la ../../nih/libnih.la $(LTLIBINTL)
+shutdown_LDADD = ../../upstart/libupstart.la ../../nih/libnih.la $(LTLIBINTL) \
+ @LIBAUDIT@
telinit_SOURCES = telinit.c
telinit_LDFLAGS = -static
diff -urp upstart-0.3.9.orig/compat/sysv/reboot.c upstart-0.3.9/compat/sysv/reboot.c
--- upstart-0.3.9.orig/compat/sysv/reboot.c 2008-11-03 12:29:30.000000000 -0500
+++ upstart-0.3.9/compat/sysv/reboot.c 2008-11-05 08:16:22.000000000 -0500
@@ -37,6 +37,9 @@
#include <string.h>
#include <unistd.h>
#include <utmp.h>
+#ifdef HAVE_LIBAUDIT
+#include <libaudit.h>
+#endif
#include <linux/if.h>
#include <linux/hdreg.h>
@@ -87,6 +90,7 @@ enum {
/* Prototypes for static functions */
static void down_drives (void);
static void down_interfaces (void);
+static void send_audit_event(void);
/**
@@ -277,6 +281,7 @@ main (int argc,
*/
reboot (RB_ENABLE_CAD);
kill (1, SIGTSTP);
+ send_audit_event ();
/* Sync the disks */
chdir ("/");
@@ -315,6 +320,23 @@ main (int argc,
return 0;
}
+/**
+ * send_audit_event
+ *
+ * Send system shutdown audit event
+ **/
+static void
+send_audit_event (void)
+{
+#ifdef HAVE_LIBAUDIT
+ int fd = audit_open ();
+ if (fd < 0)
+ return;
+ audit_log_user_message (fd, AUDIT_SYSTEM_SHUTDOWN, "init",
+ NULL, NULL, NULL, 1);
+ close (fd);
+#endif
+}
/**
* down_drives:
diff -urp upstart-0.3.9.orig/compat/sysv/runlevel.c upstart-0.3.9/compat/sysv/runlevel.c
--- upstart-0.3.9.orig/compat/sysv/runlevel.c 2008-11-03 12:29:30.000000000 -0500
+++ upstart-0.3.9/compat/sysv/runlevel.c 2008-11-05 08:22:17.000000000 -0500
@@ -33,6 +33,9 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#ifdef HAVE_LIBAUDIT
+#include <libaudit.h>
+#endif
#include <nih/macros.h>
#include <nih/alloc.h>
@@ -44,6 +47,7 @@
/* Prototypes for static functions */
static void store (short type, pid_t pid, const char *user);
+static void send_audit_event (int old, int level);
/**
@@ -109,6 +113,7 @@ main (int argc,
/* Store the reboot time? */
if (reboot) {
store (BOOT_TIME, 0, "reboot");
+ send_audit_event (0, 0);
exit (0);
}
@@ -143,6 +148,7 @@ main (int argc,
prev = cur;
if (! prev)
prev = 'N';
+ send_audit_event (prev, set[0]);
cur = set[0];
}
@@ -203,3 +209,35 @@ store (short type,
/* Write wtmp entry */
updwtmp (WTMP_FILE, &utmp);
}
+
+/**
+ * send_audit_event
+ * @old: current run level
+ * @level: new run level
+ *
+ * Send system runlevel change audit event. If level is 0, then
+ * we consider this to be a reboot event.
+ **/
+static void
+send_audit_event (int old, int level)
+{
+#ifdef HAVE_LIBAUDIT
+ int fd = audit_open ();
+
+ if (fd < 0)
+ return;
+
+ if (level) {
+ char buf[64];
+
+ snprintf (buf, sizeof (buf),
+ "old-level=%c new-level=%c", old, level);
+ audit_log_user_message (fd, AUDIT_SYSTEM_RUNLEVEL, buf,
+ NULL, NULL, NULL, 1);
+ } else
+ audit_log_user_message (fd, AUDIT_SYSTEM_BOOT, "init",
+ NULL, NULL, NULL, 1);
+ close (fd);
+#endif
+}
+
diff -urp upstart-0.3.9.orig/compat/sysv/shutdown.c upstart-0.3.9/compat/sysv/shutdown.c
--- upstart-0.3.9.orig/compat/sysv/shutdown.c 2008-11-03 12:29:30.000000000 -0500
+++ upstart-0.3.9/compat/sysv/shutdown.c 2008-11-05 08:16:22.000000000 -0500
@@ -38,6 +38,9 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#ifdef HAVE_LIBAUDIT
+#include <libaudit.h>
+#endif
#include <nih/macros.h>
#include <nih/alloc.h>
@@ -452,6 +455,23 @@ runlevel_setter (NihOption *option,
return 0;
}
+/**
+ * send_audit_event
+ *
+ * Send system shutdown audit event
+ **/
+static void
+send_audit_event (void)
+{
+#ifdef HAVE_LIBAUDIT
+ int fd = audit_open ();
+ if (fd < 0)
+ return;
+ audit_log_user_message (fd, AUDIT_SYSTEM_SHUTDOWN, "init",
+ NULL, NULL, NULL, 1);
+ close (fd);
+#endif
+}
/**
* shutdown_now:
@@ -496,6 +516,7 @@ shutdown_now (void)
NIH_MUST (message = upstart_message_new (NULL, UPSTART_INIT_DAEMON,
UPSTART_EVENT_EMIT,
"runlevel", args, env));
+ send_audit_event ();
/* Send the message */
if (nih_io_message_send (message, sock) < 0) {
@@ -513,7 +534,6 @@ shutdown_now (void)
nih_fatal (_("Unable to send message: %s"), err->message);
exit (1);
}
-
unlink (ETC_NOLOGIN);
nih_main_unlink_pidfile ();
diff -urp upstart-0.3.9.orig/config.h.in upstart-0.3.9/config.h.in
--- upstart-0.3.9.orig/config.h.in 2008-11-03 12:29:30.000000000 -0500
+++ upstart-0.3.9/config.h.in 2008-11-05 08:16:22.000000000 -0500
@@ -250,6 +250,9 @@
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
+/* Define to 1 if you want audit support */
+#undef HAVE_LIBAUDIT
+
/* Name of package */
#undef PACKAGE
diff -urp upstart-0.3.9.orig/configure.ac upstart-0.3.9/configure.ac
--- upstart-0.3.9.orig/configure.ac 2008-11-03 12:29:30.000000000 -0500
+++ upstart-0.3.9/configure.ac 2008-11-05 08:16:22.000000000 -0500
@@ -38,6 +38,25 @@ AC_ARG_ENABLE(compat,
esac], [compat_sysv=none])dnl
AM_CONDITIONAL(COMPAT_SYSV, test "x$compat" = "xsysv")dnl
+AC_ARG_WITH(libaudit,
+ [ --with-libaudit=[auto/yes/no] Add Linux audit support [default=auto]],,
+ with_libaudit=auto)
+
+# Check for Linux auditing API
+#
+# libaudit detection
+if test x$with_libaudit = xno ; then
+ have_libaudit=no;
+else
+ # See if we have audit daemon library
+ AC_CHECK_LIB(audit, audit_log_user_message,
+ LIBAUDIT=-laudit, LIBAUDIT="")
+fi
+AC_SUBST(LIBAUDIT)
+AM_CONDITIONAL(HAVE_LIBAUDIT, test x$LIBAUDIT != x)
+if test x$LIBAUDIT != x ; then
+ AC_DEFINE(HAVE_LIBAUDIT,1,[linux audit support])
+fi
AC_CONFIG_FILES([ Makefile m4/Makefile po/Makefile.in intl/Makefile
nih/Makefile upstart/Makefile init/Makefile util/Makefile
Index: upstart.spec
===================================================================
RCS file: /cvs/pkgs/rpms/upstart/devel/upstart.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- upstart.spec 7 Mar 2009 23:32:31 -0000 1.28
+++ upstart.spec 3 Apr 2009 23:32:49 -0000 1.29
@@ -1,6 +1,6 @@
Name: upstart
Version: 0.3.9
-Release: 22%{?dist}
+Release: 23%{?dist}
Summary: An event-driven init system
Group: System Environment/Base
@@ -101,6 +101,9 @@
%{_mandir}/man8/telinit.8.gz
%changelog
+* Fri Apr 3 2009 Casey Dahlin <cdahlin at redhat.com> - 0.3.9-23
+- Add audit events patch from Steve Grubb <sgrubb at redhat.com> (Bug #470661)
+
* Fri Jan 23 2009 Casey Dahlin <cdahlin at redhat.com> - 0.3.9-22
- Re-add 'telinit u' support along with patch to fix it (#450488). Patch due to
<pspencer at fields.utoronto.ca>
- Previous message (by thread): rpms/arm4/F-11 arm4-README.fedora, NONE, 1.1 arm4-arm4.cron, NONE, 1.1 arm4-arm4.init, NONE, 1.1 arm4.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message (by thread): rpms/arm4/devel arm4.spec,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list