Vendor import of OpenBSM 1.1 alpha2, which incorporates the following
changes since the last imported OpenBSM release:
OpenBSM 1.1 alpha 2
- Include files in OpenBSM are now broken out into two parts: library builds
required solely for user space, and system includes, which may also be
required for use in the kernels of systems integrating OpenBSM. Submitted
by Stacey Son.
- Configure option --with-native-includes allows forcing the use of native
include for system includes, rather than the versions bundled with OpenBSM.
This is intended specifically for platforms that ship OpenBSM, have adapted
versions of the system includes in a kernel source tree, and will use the
OpenBSM build infrastructure with an unmodified OpenBSM distribution,
allowing the customized system includes to be used with the OpenBSM build.
Submitted by Stacey Son.
- Various strcpy()'s/strcat()'s have been changed to strlcpy()'s/strlcat()'s
or asprintf(). Added compat/strlcpy.h for Linux.
- Remove compatibility defines for old Darwin token constant names; now only
BSM token names are provided and used.
- Add support for extended header tokens, which contain space for information
on the host generating the record.
- Add support for setting extended host information in the kernel, which is
used for setting host information in extended header tokens. The
audit_control file now supports a "host" parameter which can be used by
auditd to set the information; if not present, the kernel parameters won't
be set and auditd uses unextended headers for records that it generates.
OpenBSM 1.1 alpha 1
- Add option to auditreduce(1) which allows users to invert sense of
matching, such that BSM records that do not match, are selected.
- Fix bug in audit_write() where we commit an incomplete record in the
event there is an error writing the subject token. This was submitted
by Diego Giagio.
- Build support for Mac OS X 10.5.1 submitted by Eric Hall.
- Fix a bug which resulted in host XML attributes not beingguments so that const strings can be passed
as arguments to tokens. This patch was submitted by Xin LI.
- Modify the -m option so users can select more then one audit event.
- For Mac OS X, added Mach IPC support for audit trigger messages.
- Fixed a bug in getacna() which resulted in a locking problem on Mac OS X.
- Added LOG_PERROR flag to openlog when -d option is used with auditd.
- AUE events added for Mac OS X Leopard system calls.
Obtained from: TrustedBSD Project
Sponsored by: Apple Inc.
2008-11-13 00:04:15 +00:00
|
|
|
/*-
|
2009-04-19 14:53:17 +00:00
|
|
|
* Copyright (c) 2005-2009 Apple Inc.
|
2005-05-29 16:10:33 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
2006-02-01 19:54:22 +00:00
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2008-07-31 09:54:35 +00:00
|
|
|
* 3. Neither the name of Apple Inc. ("Apple") nor the names of
|
2006-02-01 19:54:22 +00:00
|
|
|
* its contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
|
|
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
|
|
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2005-05-29 16:10:33 +00:00
|
|
|
*
|
2009-07-17 14:02:20 +00:00
|
|
|
* P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#10
|
2005-05-29 16:10:33 +00:00
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
2009-04-19 14:53:17 +00:00
|
|
|
#ifndef _BSM_AUDIT_H
|
2006-02-01 19:54:22 +00:00
|
|
|
#define _BSM_AUDIT_H
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
2009-04-19 14:53:17 +00:00
|
|
|
#include <sys/types.h>
|
2006-02-01 19:54:22 +00:00
|
|
|
|
|
|
|
#define AUDIT_RECORD_MAGIC 0x828a0f1b
|
|
|
|
#define MAX_AUDIT_RECORDS 20
|
2006-08-26 08:17:58 +00:00
|
|
|
#define MAXAUDITDATA (0x8000 - 1)
|
|
|
|
#define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA
|
2006-02-01 19:54:22 +00:00
|
|
|
#define MIN_AUDIT_FILE_SIZE (512 * 1024)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Minimum noumber of free blocks on the filesystem containing the audit
|
|
|
|
* log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0
|
|
|
|
* as the kernel does an unsigned compare, plus we want to leave a few blocks
|
|
|
|
* free so userspace can terminate the log, etc.
|
|
|
|
*/
|
|
|
|
#define AUDIT_HARD_LIMIT_FREE_BLOCKS 4
|
|
|
|
|
|
|
|
/*
|
2006-08-26 08:17:58 +00:00
|
|
|
* Triggers for the audit daemon.
|
2006-02-01 19:54:22 +00:00
|
|
|
*/
|
|
|
|
#define AUDIT_TRIGGER_MIN 1
|
2006-09-21 07:27:02 +00:00
|
|
|
#define AUDIT_TRIGGER_LOW_SPACE 1 /* Below low watermark. */
|
|
|
|
#define AUDIT_TRIGGER_ROTATE_KERNEL 2 /* Kernel requests rotate. */
|
|
|
|
#define AUDIT_TRIGGER_READ_FILE 3 /* Re-read config file. */
|
|
|
|
#define AUDIT_TRIGGER_CLOSE_AND_DIE 4 /* Terminate audit. */
|
|
|
|
#define AUDIT_TRIGGER_NO_SPACE 5 /* Below min free space. */
|
Vendor import of OpenBSM 1.1 alpha4, which incorporates the following
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.
2008-12-28 22:40:42 +00:00
|
|
|
#define AUDIT_TRIGGER_ROTATE_USER 6 /* User requests rotate. */
|
Merge OpenBSM 1.1 beta 1 from OpenBSM vendor branch to head, both
contrib/openbsm (svn merge) and src/sys/{bsm,security/audit} (manual
merge).
OpenBSM history for imported revision below for reference.
MFC after: 1 month
Sponsored by: Apple, Inc.
Obtained from: TrustedBSD Project
OpenBSM 1.1 beta 1
- The filesz parameter in audit_control(5) now accepts suffixes: 'B' for
Bytes, 'K' for Kilobytes, 'M' for Megabytes, and 'G' for Gigabytes.
For legacy support no suffix defaults to bytes.
- Audit trail log expiration support added. It is configured in
audit_control(5) with the expire-after parameter. If there is no
expire-after parameter in audit_control(5), the default, then the audit
trail files are not expired and removed. See audit_control(5) for
more information.
- Change defaults in audit_control: warn at 5% rather than 20% free for audit
partitions, rotate automatically at 2mb, and set the default policy to
cnt,argv rather than cnt so that execve(2) arguments are captured if
AUE_EXECVE events are audited. These may provide more usable defaults for
many users.
- Use au_domain_to_bsm(3) and au_socket_type_to_bsm(3) to convert
au_to_socket_ex(3) arguments to BSM format.
- Fix error encoding AUT_IPC_PERM tokens.
2009-03-02 13:29:18 +00:00
|
|
|
#define AUDIT_TRIGGER_INITIALIZE 7 /* User initialize of auditd. */
|
|
|
|
#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 /* User expiration of trails. */
|
|
|
|
#define AUDIT_TRIGGER_MAX 8
|
2006-02-01 19:54:22 +00:00
|
|
|
|
|
|
|
/*
|
2006-09-21 07:27:02 +00:00
|
|
|
* The special device filename (FreeBSD).
|
2006-02-01 19:54:22 +00:00
|
|
|
*/
|
|
|
|
#define AUDITDEV_FILENAME "audit"
|
2006-09-21 07:27:02 +00:00
|
|
|
#define AUDIT_TRIGGER_FILE ("/dev/" AUDITDEV_FILENAME)
|
2006-02-01 19:54:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Pre-defined audit IDs
|
|
|
|
*/
|
Vendor import of OpenBSM 1.1 alpha4, which incorporates the following
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.
2008-12-28 22:40:42 +00:00
|
|
|
#define AU_DEFAUDITID (uid_t)(-1)
|
|
|
|
#define AU_DEFAUDITSID 0
|
|
|
|
#define AU_ASSIGN_ASID -1
|
2006-02-01 19:54:22 +00:00
|
|
|
|
|
|
|
/*
|
2006-08-26 08:17:58 +00:00
|
|
|
* IPC types.
|
2006-02-01 19:54:22 +00:00
|
|
|
*/
|
|
|
|
#define AT_IPC_MSG ((u_char)1) /* Message IPC id. */
|
|
|
|
#define AT_IPC_SEM ((u_char)2) /* Semaphore IPC id. */
|
|
|
|
#define AT_IPC_SHM ((u_char)3) /* Shared mem IPC id. */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Audit conditions.
|
|
|
|
*/
|
|
|
|
#define AUC_UNSET 0
|
|
|
|
#define AUC_AUDITING 1
|
|
|
|
#define AUC_NOAUDIT 2
|
|
|
|
#define AUC_DISABLED -1
|
|
|
|
|
|
|
|
/*
|
|
|
|
* auditon(2) commands.
|
|
|
|
*/
|
2009-04-19 14:53:17 +00:00
|
|
|
#define A_OLDGETPOLICY 2
|
|
|
|
#define A_OLDSETPOLICY 3
|
2006-02-01 19:54:22 +00:00
|
|
|
#define A_GETKMASK 4
|
|
|
|
#define A_SETKMASK 5
|
2009-04-19 14:53:17 +00:00
|
|
|
#define A_OLDGETQCTRL 6
|
|
|
|
#define A_OLDSETQCTRL 7
|
2006-02-01 19:54:22 +00:00
|
|
|
#define A_GETCWD 8
|
|
|
|
#define A_GETCAR 9
|
|
|
|
#define A_GETSTAT 12
|
|
|
|
#define A_SETSTAT 13
|
|
|
|
#define A_SETUMASK 14
|
|
|
|
#define A_SETSMASK 15
|
2009-04-19 14:53:17 +00:00
|
|
|
#define A_OLDGETCOND 20
|
|
|
|
#define A_OLDSETCOND 21
|
2006-02-01 19:54:22 +00:00
|
|
|
#define A_GETCLASS 22
|
|
|
|
#define A_SETCLASS 23
|
|
|
|
#define A_GETPINFO 24
|
|
|
|
#define A_SETPMASK 25
|
|
|
|
#define A_SETFSIZE 26
|
|
|
|
#define A_GETFSIZE 27
|
|
|
|
#define A_GETPINFO_ADDR 28
|
|
|
|
#define A_GETKAUDIT 29
|
|
|
|
#define A_SETKAUDIT 30
|
|
|
|
#define A_SENDTRIGGER 31
|
Vendor import of OpenBSM 1.1 alpha4, which incorporates the following
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.
2008-12-28 22:40:42 +00:00
|
|
|
#define A_GETSINFO_ADDR 32
|
2009-04-19 14:53:17 +00:00
|
|
|
#define A_GETPOLICY 33
|
|
|
|
#define A_SETPOLICY 34
|
|
|
|
#define A_GETQCTRL 35
|
|
|
|
#define A_SETQCTRL 36
|
|
|
|
#define A_GETCOND 37
|
|
|
|
#define A_SETCOND 38
|
2006-02-01 19:54:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Audit policy controls.
|
|
|
|
*/
|
|
|
|
#define AUDIT_CNT 0x0001
|
|
|
|
#define AUDIT_AHLT 0x0002
|
|
|
|
#define AUDIT_ARGV 0x0004
|
|
|
|
#define AUDIT_ARGE 0x0008
|
2006-08-26 08:17:58 +00:00
|
|
|
#define AUDIT_SEQ 0x0010
|
|
|
|
#define AUDIT_WINDATA 0x0020
|
|
|
|
#define AUDIT_USER 0x0040
|
|
|
|
#define AUDIT_GROUP 0x0080
|
|
|
|
#define AUDIT_TRAIL 0x0100
|
|
|
|
#define AUDIT_PATH 0x0200
|
|
|
|
#define AUDIT_SCNT 0x0400
|
|
|
|
#define AUDIT_PUBLIC 0x0800
|
|
|
|
#define AUDIT_ZONENAME 0x1000
|
|
|
|
#define AUDIT_PERZONE 0x2000
|
2006-02-01 19:54:22 +00:00
|
|
|
|
|
|
|
/*
|
2006-09-21 07:27:02 +00:00
|
|
|
* Default audit queue control parameters.
|
2006-02-01 19:54:22 +00:00
|
|
|
*/
|
|
|
|
#define AQ_HIWATER 100
|
|
|
|
#define AQ_MAXHIGH 10000
|
|
|
|
#define AQ_LOWATER 10
|
2006-09-21 07:27:02 +00:00
|
|
|
#define AQ_BUFSZ MAXAUDITDATA
|
2006-02-01 19:54:22 +00:00
|
|
|
#define AQ_MAXBUFSZ 1048576
|
2005-05-29 16:10:33 +00:00
|
|
|
|
|
|
|
/*
|
2006-02-01 19:54:22 +00:00
|
|
|
* Default minimum percentage free space on file system.
|
2005-05-29 16:10:33 +00:00
|
|
|
*/
|
2006-02-01 19:54:22 +00:00
|
|
|
#define AU_FS_MINFREE 20
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Type definitions used indicating the length of variable length addresses
|
|
|
|
* in tokens containing addresses, such as header fields.
|
|
|
|
*/
|
|
|
|
#define AU_IPv4 4
|
|
|
|
#define AU_IPv6 16
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef uid_t au_id_t;
|
|
|
|
typedef pid_t au_asid_t;
|
2005-05-29 16:10:33 +00:00
|
|
|
typedef u_int16_t au_event_t;
|
2006-02-01 19:54:22 +00:00
|
|
|
typedef u_int16_t au_emod_t;
|
|
|
|
typedef u_int32_t au_class_t;
|
2009-07-17 14:02:20 +00:00
|
|
|
typedef u_int64_t au_asflgs_t __attribute__ ((aligned (8)));
|
2006-02-01 19:54:22 +00:00
|
|
|
|
|
|
|
struct au_tid {
|
|
|
|
dev_t port;
|
|
|
|
u_int32_t machine;
|
|
|
|
};
|
|
|
|
typedef struct au_tid au_tid_t;
|
|
|
|
|
|
|
|
struct au_tid_addr {
|
|
|
|
dev_t at_port;
|
|
|
|
u_int32_t at_type;
|
|
|
|
u_int32_t at_addr[4];
|
|
|
|
};
|
|
|
|
typedef struct au_tid_addr au_tid_addr_t;
|
|
|
|
|
|
|
|
struct au_mask {
|
|
|
|
unsigned int am_success; /* Success bits. */
|
|
|
|
unsigned int am_failure; /* Failure bits. */
|
|
|
|
};
|
|
|
|
typedef struct au_mask au_mask_t;
|
|
|
|
|
|
|
|
struct auditinfo {
|
|
|
|
au_id_t ai_auid; /* Audit user ID. */
|
|
|
|
au_mask_t ai_mask; /* Audit masks. */
|
|
|
|
au_tid_t ai_termid; /* Terminal ID. */
|
|
|
|
au_asid_t ai_asid; /* Audit session ID. */
|
|
|
|
};
|
|
|
|
typedef struct auditinfo auditinfo_t;
|
|
|
|
|
|
|
|
struct auditinfo_addr {
|
|
|
|
au_id_t ai_auid; /* Audit user ID. */
|
|
|
|
au_mask_t ai_mask; /* Audit masks. */
|
|
|
|
au_tid_addr_t ai_termid; /* Terminal ID. */
|
|
|
|
au_asid_t ai_asid; /* Audit session ID. */
|
2009-07-17 14:02:20 +00:00
|
|
|
au_asflgs_t ai_flags; /* Audit session flags. */
|
2006-02-01 19:54:22 +00:00
|
|
|
};
|
|
|
|
typedef struct auditinfo_addr auditinfo_addr_t;
|
|
|
|
|
|
|
|
struct auditpinfo {
|
|
|
|
pid_t ap_pid; /* ID of target process. */
|
|
|
|
au_id_t ap_auid; /* Audit user ID. */
|
|
|
|
au_mask_t ap_mask; /* Audit masks. */
|
|
|
|
au_tid_t ap_termid; /* Terminal ID. */
|
|
|
|
au_asid_t ap_asid; /* Audit session ID. */
|
|
|
|
};
|
|
|
|
typedef struct auditpinfo auditpinfo_t;
|
|
|
|
|
|
|
|
struct auditpinfo_addr {
|
|
|
|
pid_t ap_pid; /* ID of target process. */
|
|
|
|
au_id_t ap_auid; /* Audit user ID. */
|
|
|
|
au_mask_t ap_mask; /* Audit masks. */
|
|
|
|
au_tid_addr_t ap_termid; /* Terminal ID. */
|
|
|
|
au_asid_t ap_asid; /* Audit session ID. */
|
2009-07-17 14:02:20 +00:00
|
|
|
au_asflgs_t ap_flags; /* Audit session flags. */
|
2006-02-01 19:54:22 +00:00
|
|
|
};
|
|
|
|
typedef struct auditpinfo_addr auditpinfo_addr_t;
|
|
|
|
|
Vendor import of OpenBSM 1.1 alpha4, which incorporates the following
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.
2008-12-28 22:40:42 +00:00
|
|
|
struct au_session {
|
|
|
|
auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */
|
|
|
|
au_mask_t as_mask; /* Process Audit Masks. */
|
|
|
|
};
|
|
|
|
typedef struct au_session au_session_t;
|
|
|
|
|
2006-03-04 16:54:21 +00:00
|
|
|
/*
|
|
|
|
* Contents of token_t are opaque outside of libbsm.
|
|
|
|
*/
|
2006-02-01 19:54:22 +00:00
|
|
|
typedef struct au_token token_t;
|
|
|
|
|
|
|
|
/*
|
2009-04-19 14:53:17 +00:00
|
|
|
* Kernel audit queue control parameters:
|
|
|
|
* Default: Maximum:
|
|
|
|
* aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000)
|
|
|
|
* aq_lowater: AQ_LOWATER (10) <aq_hiwater
|
|
|
|
* aq_bufsz: AQ_BUFSZ (32767) AQ_MAXBUFSZ (1048576)
|
|
|
|
* aq_delay: 20 20000 (not used)
|
2006-02-01 19:54:22 +00:00
|
|
|
*/
|
|
|
|
struct au_qctrl {
|
2009-04-19 14:53:17 +00:00
|
|
|
int aq_hiwater; /* Max # of audit recs in queue when */
|
|
|
|
/* threads with new ARs get blocked. */
|
|
|
|
|
|
|
|
int aq_lowater; /* # of audit recs in queue when */
|
|
|
|
/* blocked threads get unblocked. */
|
|
|
|
|
|
|
|
int aq_bufsz; /* Max size of audit record for audit(2). */
|
|
|
|
int aq_delay; /* Queue delay (not used). */
|
2006-02-01 19:54:22 +00:00
|
|
|
int aq_minfree; /* Minimum filesystem percent free space. */
|
|
|
|
};
|
|
|
|
typedef struct au_qctrl au_qctrl_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure for the audit statistics.
|
|
|
|
*/
|
|
|
|
struct audit_stat {
|
|
|
|
unsigned int as_version;
|
|
|
|
unsigned int as_numevent;
|
|
|
|
int as_generated;
|
2006-06-05 12:55:45 +00:00
|
|
|
int as_nonattrib;
|
2006-02-01 19:54:22 +00:00
|
|
|
int as_kernel;
|
|
|
|
int as_audit;
|
|
|
|
int as_auditctl;
|
2006-06-05 12:55:45 +00:00
|
|
|
int as_enqueue;
|
2006-02-01 19:54:22 +00:00
|
|
|
int as_written;
|
|
|
|
int as_wblocked;
|
|
|
|
int as_rblocked;
|
|
|
|
int as_dropped;
|
|
|
|
int as_totalsize;
|
|
|
|
unsigned int as_memused;
|
|
|
|
};
|
|
|
|
typedef struct audit_stat au_stat_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure for the audit file statistics.
|
|
|
|
*/
|
|
|
|
struct audit_fstat {
|
2009-01-11 21:24:07 +00:00
|
|
|
u_int64_t af_filesz;
|
|
|
|
u_int64_t af_currsz;
|
2006-02-01 19:54:22 +00:00
|
|
|
};
|
|
|
|
typedef struct audit_fstat au_fstat_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Audit to event class mapping.
|
|
|
|
*/
|
|
|
|
struct au_evclass_map {
|
|
|
|
au_event_t ec_number;
|
|
|
|
au_class_t ec_class;
|
|
|
|
};
|
|
|
|
typedef struct au_evclass_map au_evclass_map_t;
|
|
|
|
|
2006-03-04 16:54:21 +00:00
|
|
|
/*
|
|
|
|
* Audit system calls.
|
|
|
|
*/
|
2006-02-01 19:54:22 +00:00
|
|
|
#if !defined(_KERNEL) && !defined(KERNEL)
|
|
|
|
int audit(const void *, int);
|
|
|
|
int auditon(int, void *, int);
|
|
|
|
int auditctl(const char *);
|
|
|
|
int getauid(au_id_t *);
|
|
|
|
int setauid(const au_id_t *);
|
|
|
|
int getaudit(struct auditinfo *);
|
|
|
|
int setaudit(const struct auditinfo *);
|
|
|
|
int getaudit_addr(struct auditinfo_addr *, int);
|
|
|
|
int setaudit_addr(const struct auditinfo_addr *, int);
|
2009-04-19 14:53:17 +00:00
|
|
|
|
|
|
|
#ifdef __APPLE_API_PRIVATE
|
|
|
|
#include <mach/port.h>
|
|
|
|
mach_port_name_t audit_session_self(void);
|
|
|
|
au_asid_t audit_session_join(mach_port_name_t port);
|
|
|
|
#endif /* __APPLE_API_PRIVATE */
|
|
|
|
|
2006-02-01 19:54:22 +00:00
|
|
|
#endif /* defined(_KERNEL) || defined(KERNEL) */
|
|
|
|
|
|
|
|
__END_DECLS
|
2005-05-29 16:10:33 +00:00
|
|
|
|
2006-02-01 19:54:22 +00:00
|
|
|
#endif /* !_BSM_AUDIT_H */
|