1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
From: Christian Kastner <ckk@kvr.at>
Date: Thu, 07 Jan 2016 23:21:25 +0100
Subject: Linux Audit support
Add support for logging using the Linux Auditing System.
Contributed by Steve Grubb.
Bug-Debian: https://bugs.debian.org/383741
Forwarded: no
Last-Update: 2015-01-07
Index: cron/Makefile
===================================================================
--- cron.orig/Makefile
+++ cron/Makefile
@@ -55,7 +55,7 @@ DESTMAN = $(DESTROOT)/share/man
INCLUDE = -I.
#INCLUDE =
#<<need getopt()>>
-LIBS = $(PAM_LIBS) $(SELINUX_LIBS)
+LIBS = $(PAM_LIBS) $(SELINUX_LIBS) $(AUDIT_LIBS)
#<<optimize or debug?>>
#OPTIM = -O
OPTIM = -g
@@ -73,7 +73,7 @@ LINTFLAGS = -hbxa $(INCLUDE) $(COMPAT) $
#<<manifest defines>>
# Allow override from command line
DEBUG_DEFS ?= -DDEBUGGING=0
-DEFS = $(DEBUG_DEFS) $(PAM_DEFS) $(SELINUX_DEFS)
+DEFS = $(DEBUG_DEFS) $(PAM_DEFS) $(SELINUX_DEFS) $(AUDIT_DEFS)
#(SGI IRIX systems need this)
#DEFS = -D_BSD_SIGNALS -Dconst=
#<<the name of the BSD-like install program>>
Index: cron/misc.c
===================================================================
--- cron.orig/misc.c
+++ cron/misc.c
@@ -35,6 +35,9 @@ static char rcsid[] = "$Id: misc.c,v 2.9
#include <errno.h>
#include <string.h>
#include <fcntl.h>
+#ifdef WITH_AUDIT
+#include <libaudit.h>
+#endif
#if defined(SYSLOG)
# include <syslog.h>
#endif
@@ -476,6 +479,15 @@ allowed(username)
isallowed = !in_file(username, deny);
#endif
+#ifdef WITH_AUDIT
+ /* Log an audit message if the user is rejected */
+ if (isallowed == FALSE) {
+ int audit_fd = audit_open();
+ audit_log_user_message(audit_fd, AUDIT_USER_START, "cron deny",
+ NULL, NULL, NULL, 0);
+ close(audit_fd);
+ }
+#endif
return isallowed;
}
Index: cron/cron.8
===================================================================
--- cron.orig/cron.8
+++ cron/cron.8
@@ -120,6 +120,8 @@ PAM support,
.IP \(em
SELinux support,
.IP \(em
+auditlog support,
+.IP \(em
Debian-specific file locations and commands,
.IP \(em
Debian-specific configuration (/etc/default/cron),
|