Skip to content

Commit

Permalink
Vendor import of OpenBSM 1.1 alpha4, which incorporates the following
Browse files Browse the repository at this point in the history
changes since the last imported OpenBSM release:

OpenBSM 1.1 alpha 4

- With the addition of BSM error number mapping, we also need to map the
  local error number passed to audit_submit(3) to a BSM error number,
  rather than have the caller perform that conversion.
- Reallocate user audit events to avoid collisions with Solaris; adopt a
  more formal allocation scheme, and add some events allocated in Solaris
  that will be of immediate use on other platforms.
- Add an event for Calife.
- Add au_strerror(3), which allows generating strings for BSM errors
  directly, rather than requiring applications to map to the local error
  space, which might not be able to entirely represent the BSM error
  number space.
- Major auditd rewrite for launchd(8) support.  Add libauditd library
  that is shared between launchd and auditd.
- Add AUDIT_TRIGGER_INITIALIZE trigger (sent via 'audit -i') for
  (re)starting auditing under launchd(8) on Mac OS X.
- Add 'current' symlink to active audit trail.
- Add crash recovery of previous audit trail file when detected on audit
  startup that it has not been properly terminated.
- Add the event AUE_audit_recovery to indicated when an audit trail file
  has been recovered from not being properly terminated.  This event is
  stored in the new audit trail file and includes the path of recovered
  audit trail file.
- Mac OS X and FreeBSD dependent code in auditd.c is separated into
  auditd_darwin.c and auditd_fbsd.c files.
- Add an event for the posix_spawn(2) and fsgetpath(2) Mac OS X system
  calls.
- For Mac OS X, we use ASL(3) instead of syslog(3) for logging.
- Add support for NOTICE level logging.

OpenBSM 1.1 alpha 3

- Add two new functions, au_bsm_to_errno() and au_errno_to_bsm(), to map
  between BSM error numbers (largely the Solaris definitions) and local
  errno(2) values for 32-bit and 64-bit return tokens.  This is required
  as operating systems don't agree on some of the values of more recent
  error numbers.
- Fix a bug how au_to_exec_args(3) and au_to_exec_env(3) calculates the
  total size for the token.  This bug resulted in "unknown" tokens being
  printed after the exec args/env tokens.
- Support for AUT_SOCKET_EX extended socket tokens, which describe a
  socket using a pair of IPv4/IPv6 and port tuples.
- OpenBSM BSM file header version bumped for 1.1 release.
- Deprecated Darwin constants, such as TRAILER_PAD_MAGIC, removed.

Obtained from:	TrustedBSD Project
Sponsored by:	Apple Inc.
  • Loading branch information
rwatson committed Dec 28, 2008
1 parent a5c6cfa commit 980b6e4
Show file tree
Hide file tree
Showing 125 changed files with 4,893 additions and 1,184 deletions.
12 changes: 10 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
#
# $P4: //depot/projects/trustedbsd/openbsm/Makefile.am#3 $
# $P4: //depot/projects/trustedbsd/openbsm/Makefile.am#4 $
#

SUBDIRS = \
bsm \
bsm

if HAVE_AUDIT_SYSCALLS
SUBDIRS += \
libauditd
endif

SUBDIRS += \
libbsm \
bin \
man \
modules \
sys


EXTRA_DIST = \
CHANGELOG \
LICENSE \
Expand Down
16 changes: 6 additions & 10 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@SET_MAKE@

#
# $P4: //depot/projects/trustedbsd/openbsm/Makefile.in#8 $
# $P4: //depot/projects/trustedbsd/openbsm/Makefile.in#9 $
#
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
Expand All @@ -35,6 +35,9 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@HAVE_AUDIT_SYSCALLS_TRUE@am__append_1 = \
@HAVE_AUDIT_SYSCALLS_TRUE@ libauditd

subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/config/config.h.in \
Expand Down Expand Up @@ -63,7 +66,7 @@ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DIST_SUBDIRS = bsm libauditd libbsm bin man modules sys
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
Expand Down Expand Up @@ -183,14 +186,7 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = \
bsm \
libbsm \
bin \
man \
modules \
sys

SUBDIRS = bsm $(am__append_1) libbsm bin man modules sys
EXTRA_DIST = \
CHANGELOG \
LICENSE \
Expand Down
47 changes: 46 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
OpenBSM Version History

OpenBSM 1.1 alpha 4

- With the addition of BSM error number mapping, we also need to map the
local error number passed to audit_submit(3) to a BSM error number, rather
than have the caller perform that conversion.
- Reallocate user audit events to avoid collisions with Solaris; adopt a more
formal allocation scheme, and add some events allocated in Solaris that
will be of immediate use on other platforms.
- Add an event for Calife.
- Add au_strerror(3), which allows generating strings for BSM errors
directly, rather than requiring applications to map to the local error
space, which might not be able to entirely represent the BSM error number
space.
- Major auditd rewrite for launchd(8) support. Add libauditd library that is
shared between launchd and auditd.
- Add AUDIT_TRIGGER_INITIALIZE trigger (sent via 'audit -i') for (re)starting
auditing under launchd(8) on Mac OS X.
- Add 'current' symlink to active audit trail.
- Add crash recovery of previous audit trail file when detected on audit
startup that it has not been properly terminated.
- Add the event AUE_audit_recovery to indicated when an audit trail file has
been recovered from not being properly terminated. This event is stored
in the new audit trail file and includes the path of recovered audit trail
file.
- Mac OS X and FreeBSD dependent code in auditd.c is separated into
auditd_darwin.c and auditd_fbsd.c files.
- Add an event for the posix_spawn(2) and fsgetpath(2) Mac OS X system calls.
- For Mac OS X, we use ASL(3) instead of syslog(3) for logging.
- Add support for NOTICE level logging.

OpenBSM 1.1 alpha 3

- Add two new functions, au_bsm_to_errno() and au_errno_to_bsm(), to map
between BSM error numbers (largely the Solaris definitions) and local
errno(2) values for 32-bit and 64-bit return tokens. This is required as
operating systems don't agree on some of the values of more recent error
numbers.
- Fix a bug how au_to_exec_args(3) and au_to_exec_env(3) calculates the total
size for the token. This bug resulted in "unknown" tokens being printed
after the exec args/env tokens.
- Support for AUT_SOCKET_EX extended socket tokens, which describe a socket
using a pair of IPv4/IPv6 and port tuples.
- OpenBSM BSM file header version bumped for 1.1 release.
- Deprecated Darwin constants, such as TRAILER_PAD_MAGIC, removed.

OpenBSM 1.1 alpha 2

- Include files in OpenBSM are now broken out into two parts: library builds
Expand Down Expand Up @@ -348,4 +393,4 @@ OpenBSM 1.0 alpha 1
to support reloading of kernel event table.
- Allow comments in /etc/security configuration files.

$P4: //depot/projects/trustedbsd/openbsm/NEWS#9 $
$P4: //depot/projects/trustedbsd/openbsm/NEWS#21 $
5 changes: 3 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OpenBSM 1.1 alpha 1
OpenBSM 1.1 alpha 4

Introduction

Expand All @@ -19,6 +19,7 @@ OpenBSM consists of several directories:
bsm/ Library include files for BSM
compat/ Compatibility code to build on various OS's
etc/ Sample /etc/security configuration files
libauditd Common audit management functions for auditd and launchd
libbsm/ Implementation of BSM library interfaces and man pages
man/ System call and configuration file man pages
modules/ Directory for auditfilterd module source
Expand Down Expand Up @@ -55,4 +56,4 @@ Information on TrustedBSD may be found on the TrustedBSD home page:

http://www.TrustedBSD.org/

$P4: //depot/projects/trustedbsd/openbsm/README#32 $
$P4: //depot/projects/trustedbsd/openbsm/README#34 $
4 changes: 3 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ OpenBSM TODO
- Document audit_warn event arguments.
- Allow the path /etc/security to be configured at configure-time so that
alternative locations can be used.
- NLS support for au_strerror(3), which provides error strings for BSM errors
not available on the local OS platform.

$P4: //depot/projects/trustedbsd/openbsm/TODO#11 $
$P4: //depot/projects/trustedbsd/openbsm/TODO#12 $
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
OPENBSM_1_1_ALPHA_2
OPENBSM_1_1_ALPHA_4
2 changes: 1 addition & 1 deletion bin/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@SET_MAKE@

#
# $P4: //depot/projects/trustedbsd/openbsm/bin/Makefile.in#8 $
# $P4: //depot/projects/trustedbsd/openbsm/bin/Makefile.in#10 $
#
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
Expand Down
10 changes: 5 additions & 5 deletions bin/audit/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.am#4 $
# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.am#6 $
#

if USE_NATIVE_INCLUDES
Expand All @@ -13,11 +13,11 @@ audit_LDADD = $(top_builddir)/libbsm/libbsm.la
man8_MANS = audit.8

if USE_MACH_IPC
audit_SOURCES = auditd_control_user.c audit.c
CLEANFILES = auditd_control_user.c auditd_control_user.h
audit_SOURCES = auditd_controlUser.c audit.c
CLEANFILES = auditd_controlUser.c auditd_control.h

auditd_control_user.c: $(top_srcdir)/bin/auditd/auditd_control.defs
$(MIG) -user auditd_control_user.c -header auditd_control_user.h -server /dev/null -sheader /dev/null $(top_srcdir)/bin/auditd/auditd_control.defs
auditd_controlUser.c auditd_control.h: $(top_srcdir)/bin/auditd/auditd_control.defs
$(MIG) -user auditd_controlUser.c -header auditd_control.h -server /dev/null -sheader /dev/null $(top_srcdir)/bin/auditd/auditd_control.defs
else
audit_SOURCES = audit.c
endif
16 changes: 8 additions & 8 deletions bin/audit/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@SET_MAKE@

#
# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.in#9 $
# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.in#11 $
#

VPATH = @srcdir@
Expand Down Expand Up @@ -49,9 +49,9 @@ CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(sbin_PROGRAMS)
am__audit_SOURCES_DIST = audit.c auditd_control_user.c
am__audit_SOURCES_DIST = audit.c auditd_controlUser.c
@USE_MACH_IPC_FALSE@am_audit_OBJECTS = audit.$(OBJEXT)
@USE_MACH_IPC_TRUE@am_audit_OBJECTS = auditd_control_user.$(OBJEXT) \
@USE_MACH_IPC_TRUE@am_audit_OBJECTS = auditd_controlUser.$(OBJEXT) \
@USE_MACH_IPC_TRUE@ audit.$(OBJEXT)
audit_OBJECTS = $(am_audit_OBJECTS)
audit_DEPENDENCIES = $(top_builddir)/libbsm/libbsm.la
Expand Down Expand Up @@ -188,8 +188,8 @@ top_srcdir = @top_srcdir@
audit_LDADD = $(top_builddir)/libbsm/libbsm.la
man8_MANS = audit.8
@USE_MACH_IPC_FALSE@audit_SOURCES = audit.c
@USE_MACH_IPC_TRUE@audit_SOURCES = auditd_control_user.c audit.c
@USE_MACH_IPC_TRUE@CLEANFILES = auditd_control_user.c auditd_control_user.h
@USE_MACH_IPC_TRUE@audit_SOURCES = auditd_controlUser.c audit.c
@USE_MACH_IPC_TRUE@CLEANFILES = auditd_controlUser.c auditd_control.h
all: all-am

.SUFFIXES:
Expand Down Expand Up @@ -262,7 +262,7 @@ distclean-compile:
-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audit.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auditd_control_user.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auditd_controlUser.Po@am__quote@

.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
Expand Down Expand Up @@ -521,8 +521,8 @@ uninstall-man: uninstall-man8
uninstall-sbinPROGRAMS


@USE_MACH_IPC_TRUE@auditd_control_user.c: $(top_srcdir)/bin/auditd/auditd_control.defs
@USE_MACH_IPC_TRUE@ $(MIG) -user auditd_control_user.c -header auditd_control_user.h -server /dev/null -sheader /dev/null $(top_srcdir)/bin/auditd/auditd_control.defs
@USE_MACH_IPC_TRUE@auditd_controlUser.c auditd_control.h: $(top_srcdir)/bin/auditd/auditd_control.defs
@USE_MACH_IPC_TRUE@ $(MIG) -user auditd_controlUser.c -header auditd_control.h -server /dev/null -sheader /dev/null $(top_srcdir)/bin/auditd/auditd_control.defs
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
23 changes: 19 additions & 4 deletions bin/audit/audit.8
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,31 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.8#11 $
.\" $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.8#13 $
.\"
.Dd October 2, 2006
.Dd December 11, 2008
.Dt AUDIT 8
.Os
.Sh NAME
.Nm audit
.Nd audit management utility
.Sh SYNOPSIS
.Nm
.Fl n | s | t
.Fl i | n | s | t
.Sh DESCRIPTION
The
.Nm
utility controls the state of the audit system.
One of the following flags is required as an argument to
.Nm :
.Bl -tag -width indent
.It Fl i
Initializes and starts auditing.
This option is currently for Mac OS X only
and requires
.Xr auditd 8
to be configured to run under
.Xr launchd 8 .
.It Fl n
Forces the audit system to close the existing audit log file and rotate to
a new log file in a location specified in the audit control file.
Expand All @@ -59,6 +66,13 @@ and renamed to indicate the time of the shutdown.
The
.Xr auditd 8
daemon must already be running.
Optionally, it can be configured to be started
on-demand by
.Xr launchd 8
(Mac OS X only).
The
.Nm
utility requires audit administrator privileges for successful operation.
.Sh FILES
.Bl -tag -width ".Pa /etc/security/audit_control" -compact
.It Pa /etc/security/audit_control
Expand All @@ -67,7 +81,8 @@ Audit policy file used to configure the auditing system.
.Sh SEE ALSO
.Xr audit 4 ,
.Xr audit_control 5 ,
.Xr auditd 8
.Xr auditd 8 ,
.Xr launchd 8
.Sh HISTORY
The OpenBSM implementation was created by McAfee Research, the security
division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
Expand Down
33 changes: 27 additions & 6 deletions bin/audit/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.c#11 $
* $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.c#13 $
*/
/*
* Program to trigger the audit daemon with a message that is either:
Expand All @@ -47,6 +47,7 @@

#include <bsm/libbsm.h>

#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -64,7 +65,15 @@ static int send_trigger(unsigned int);
#include <mach/host_special_ports.h>
#include <servers/bootstrap.h>

#include "auditd_control_user.h"
#include "auditd_control.h"

/*
* XXX the following is temporary until this can be added to the kernel
* audit.h header.
*/
#ifndef AUDIT_TRIGGER_INITIALIZE
#define AUDIT_TRIGGER_INITIALIZE 7
#endif

static int
send_trigger(unsigned int trigger)
Expand All @@ -74,7 +83,12 @@ send_trigger(unsigned int trigger)

error = host_get_audit_control_port(mach_host_self(), &serverPort);
if (error != KERN_SUCCESS) {
mach_error("Cannot get auditd_control Mach port: ", error);
if (geteuid() != 0) {
errno = EPERM;
perror("audit requires root privileges");
} else
mach_error("Cannot get auditd_control Mach port:",
error);
return (-1);
}

Expand All @@ -96,7 +110,10 @@ send_trigger(unsigned int trigger)

error = auditon(A_SENDTRIGGER, &trigger, sizeof(trigger));
if (error != 0) {
perror("Error sending trigger");
if (error == EPERM)
perror("audit requires root privileges");
else
perror("Error sending trigger");
return (-1);
}

Expand All @@ -108,7 +125,7 @@ static void
usage(void)
{

(void)fprintf(stderr, "Usage: audit -n | -s | -t \n");
(void)fprintf(stderr, "Usage: audit -i | -n | -s | -t \n");
exit(-1);
}

Expand All @@ -124,9 +141,13 @@ main(int argc, char **argv)
if (argc != 2)
usage();

while ((ch = getopt(argc, argv, "nst")) != -1) {
while ((ch = getopt(argc, argv, "inst")) != -1) {
switch(ch) {

case 'i':
trigger = AUDIT_TRIGGER_INITIALIZE;
break;

case 'n':
trigger = AUDIT_TRIGGER_ROTATE_USER;
break;
Expand Down
Loading

0 comments on commit 980b6e4

Please sign in to comment.