xref: /freebsd/contrib/openbsm/man/getaudit.2 (revision 52267f7411adcc76ede961420e08c0e42f42d415)
1ca0716f5SRobert Watson.\"-
2ca0716f5SRobert Watson.\" Copyright (c) 2005 Robert N. M. Watson
352267f74SRobert Watson.\" Copyright (c) 2008 Apple Inc.
4ca0716f5SRobert Watson.\" All rights reserved.
5ca0716f5SRobert Watson.\"
6ca0716f5SRobert Watson.\" Redistribution and use in source and binary forms, with or without
7ca0716f5SRobert Watson.\" modification, are permitted provided that the following conditions
8ca0716f5SRobert Watson.\" are met:
9ca0716f5SRobert Watson.\" 1. Redistributions of source code must retain the above copyright
10ca0716f5SRobert Watson.\"    notice, this list of conditions and the following disclaimer.
11ca0716f5SRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright
12ca0716f5SRobert Watson.\"    notice, this list of conditions and the following disclaimer in the
13ca0716f5SRobert Watson.\"    documentation and/or other materials provided with the distribution.
14ca0716f5SRobert Watson.\"
15ca0716f5SRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16ca0716f5SRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17ca0716f5SRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ca0716f5SRobert Watson.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19ca0716f5SRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20ca0716f5SRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21ca0716f5SRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22ca0716f5SRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23ca0716f5SRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24ca0716f5SRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25ca0716f5SRobert Watson.\" SUCH DAMAGE.
26ca0716f5SRobert Watson.\"
2752267f74SRobert Watson.\" $P4: //depot/projects/trustedbsd/openbsm/man/getaudit.2#10 $
28ca0716f5SRobert Watson.\"
2952267f74SRobert Watson.Dd October 19, 2008
30ca0716f5SRobert Watson.Dt GETAUDIT 2
31ca0716f5SRobert Watson.Os
32ca0716f5SRobert Watson.Sh NAME
33ca0716f5SRobert Watson.Nm getaudit ,
34ca0716f5SRobert Watson.Nm getaudit_addr
35bc168a6cSRobert Watson.Nd "retrieve audit session state"
36ca0716f5SRobert Watson.Sh SYNOPSIS
37ca0716f5SRobert Watson.In bsm/audit.h
38ca0716f5SRobert Watson.Ft int
39ca0716f5SRobert Watson.Fn getaudit "auditinfo_t *auditinfo"
40ca0716f5SRobert Watson.Ft int
41ca0716f5SRobert Watson.Fn getaudit_addr "auditinfo_addr_t *auditinfo_addr" "u_int length"
42ca0716f5SRobert Watson.Sh DESCRIPTION
43bc168a6cSRobert WatsonThe
44ca0716f5SRobert Watson.Fn getaudit
45bc168a6cSRobert Watsonsystem call
46ca0716f5SRobert Watsonretrieves the active audit session state for the current process via the
47ca0716f5SRobert Watson.Vt auditinfo_t
48ca0716f5SRobert Watsonpointed to by
49bc168a6cSRobert Watson.Fa auditinfo .
50bc168a6cSRobert WatsonThe
51ca0716f5SRobert Watson.Fn getaudit_addr
52bc168a6cSRobert Watsonsystem call
53ca0716f5SRobert Watsonretrieves extended state via
54bc168a6cSRobert Watson.Fa auditinfo_addr
55ca0716f5SRobert Watsonand
56bc168a6cSRobert Watson.Fa length .
57ca0716f5SRobert Watson.Pp
5852267f74SRobert WatsonThe
5952267f74SRobert Watson.Fa auditinfo_t
6052267f74SRobert Watsondata structure is defined as follows:
6152267f74SRobert Watson.Bd -literal -offset indent
6252267f74SRobert Watsonstruct auditinfo {
6352267f74SRobert Watson	au_id_t        ai_auid;         /* Audit user ID */
6452267f74SRobert Watson	au_mask_t      ai_mask;         /* Audit masks */
6552267f74SRobert Watson	au_tid_t       ai_termid;       /* Terminal ID */
6652267f74SRobert Watson	au_asid_t      ai_asid;         /* Audit session ID */
6752267f74SRobert Watson};
6852267f74SRobert Watsontypedef struct auditinfo        auditinfo_t;
6952267f74SRobert Watson.Ed
7052267f74SRobert Watson.Pp
7152267f74SRobert WatsonThe
7252267f74SRobert Watson.Fa ai_auid
7352267f74SRobert Watsonvariable contains the audit identifier which is recorded in the audit log for
7452267f74SRobert Watsoneach event the process caused.
7552267f74SRobert Watson.Pp
7652267f74SRobert WatsonThe
7752267f74SRobert Watson.Fa au_mask_t
7852267f74SRobert Watsondata structure defines the bit mask for auditing successful and failed events
7952267f74SRobert Watsonout of the predefined list of event classes.
8052267f74SRobert WatsonIt is defined as follows:
8152267f74SRobert Watson.Bd -literal -offset indent
8252267f74SRobert Watsonstruct au_mask {
8352267f74SRobert Watson	unsigned int    am_success;     /* success bits */
8452267f74SRobert Watson	unsigned int    am_failure;     /* failure bits */
8552267f74SRobert Watson};
8652267f74SRobert Watsontypedef struct au_mask  au_mask_t;
8752267f74SRobert Watson.Ed
8852267f74SRobert Watson.Pp
8952267f74SRobert WatsonThe
9052267f74SRobert Watson.Fa au_termid_t
9152267f74SRobert Watsondata structure defines the Terminal ID recorded with every event caused by the
9252267f74SRobert Watsonprocess.
9352267f74SRobert WatsonIt is defined as follows:
9452267f74SRobert Watson.Bd -literal -offset indent
9552267f74SRobert Watsonstruct au_tid {
9652267f74SRobert Watson	dev_t           port;
9752267f74SRobert Watson	u_int32_t       machine;
9852267f74SRobert Watson};
9952267f74SRobert Watsontypedef struct au_tid   au_tid_t;
10052267f74SRobert Watson.Ed
10152267f74SRobert Watson.Pp
10252267f74SRobert WatsonThe
10352267f74SRobert Watson.Fa ai_asid
10452267f74SRobert Watsonvariable contains the audit session ID which is recorded with every event
10552267f74SRobert Watsoncaused by the process.
10652267f74SRobert Watson.Pp
10752267f74SRobert WatsonThe
10852267f74SRobert Watson.Fn getaudit_addr
10952267f74SRobert Watsonsystem call
11052267f74SRobert Watsonuses the expanded
11152267f74SRobert Watson.Fa auditinfo_addr_t
11252267f74SRobert Watsondata structure and supports Terminal IDs with larger addresses
11352267f74SRobert Watsonsuch as those used in IP version 6.
11452267f74SRobert WatsonIt is defined as follows:
11552267f74SRobert Watson.Bd -literal -offset indent
11652267f74SRobert Watsonstruct auditinfo_addr {
11752267f74SRobert Watson	au_id_t         ai_auid;        /* Audit user ID. */
11852267f74SRobert Watson	au_mask_t       ai_mask;        /* Audit masks. */
11952267f74SRobert Watson	au_tid_addr_t   ai_termid;      /* Terminal ID. */
12052267f74SRobert Watson	au_asid_t       ai_asid;        /* Audit session ID. */
12152267f74SRobert Watson};
12252267f74SRobert Watsontypedef struct auditinfo_addr   auditinfo_addr_t;
12352267f74SRobert Watson.Ed
12452267f74SRobert Watson.Pp
12552267f74SRobert WatsonThe
12652267f74SRobert Watson.Fa au_tid_addr_t
12752267f74SRobert Watsondata structure which includes a larger address storage field and an additional
12852267f74SRobert Watsonfield with the type of address stored:
12952267f74SRobert Watson.Bd -literal -offset indent
13052267f74SRobert Watsonstruct au_tid_addr {
13152267f74SRobert Watson	dev_t           at_port;
13252267f74SRobert Watson	u_int32_t       at_type;
13352267f74SRobert Watson	u_int32_t       at_addr[4];
13452267f74SRobert Watson};
13552267f74SRobert Watsontypedef struct au_tid_addr      au_tid_addr_t;
13652267f74SRobert Watson.Ed
13752267f74SRobert Watson.Pp
138bc168a6cSRobert WatsonThese system calls require an appropriate privilege to complete.
139ca0716f5SRobert Watson.Sh RETURN VALUES
140bc168a6cSRobert Watson.Rv -std getaudit getaudit_addr
14152267f74SRobert Watson.Sh ERRORS
14252267f74SRobert WatsonThe
14352267f74SRobert Watson.Fn getaudit
14452267f74SRobert Watsonfunction will fail if:
14552267f74SRobert Watson.Bl -tag -width Er
14652267f74SRobert Watson.It Bq Er EFAULT
14752267f74SRobert WatsonA failure occurred while data transferred to or from
14852267f74SRobert Watsonthe kernel failed.
14952267f74SRobert Watson.It Bq Er EINVAL
15052267f74SRobert WatsonIllegal argument was passed by a system call.
15152267f74SRobert Watson.It Bq Er EPERM
15252267f74SRobert WatsonThe process does not have sufficient permission to complete
15352267f74SRobert Watsonthe operation.
15452267f74SRobert Watson.It Bq Er EOVERFLOW
15552267f74SRobert WatsonThe
15652267f74SRobert Watson.Fa length
15752267f74SRobert Watsonargument indicates an overflow condition will occur.
15852267f74SRobert Watson.It Bq Er E2BIG
15952267f74SRobert WatsonThe address is too big and, therefore,
16052267f74SRobert Watson.Fn getaudit_addr
16152267f74SRobert Watsonshould be used instead.
16252267f74SRobert Watson.El
163ca0716f5SRobert Watson.Sh SEE ALSO
164ca0716f5SRobert Watson.Xr audit 2 ,
165ca0716f5SRobert Watson.Xr auditon 2 ,
166ca0716f5SRobert Watson.Xr getauid 2 ,
167ca0716f5SRobert Watson.Xr setaudit 2 ,
168bc168a6cSRobert Watson.Xr setauid 2 ,
169ca0716f5SRobert Watson.Xr libbsm 3
170bc168a6cSRobert Watson.Sh HISTORY
171bc168a6cSRobert WatsonThe OpenBSM implementation was created by McAfee Research, the security
172bc168a6cSRobert Watsondivision of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
173bc168a6cSRobert WatsonIt was subsequently adopted by the TrustedBSD Project as the foundation for
174bc168a6cSRobert Watsonthe OpenBSM distribution.
175ca0716f5SRobert Watson.Sh AUTHORS
176bc168a6cSRobert Watson.An -nosplit
177ca0716f5SRobert WatsonThis software was created by McAfee Research, the security research division
178ca0716f5SRobert Watsonof McAfee, Inc., under contract to Apple Computer Inc.
179bc168a6cSRobert WatsonAdditional authors include
180bc168a6cSRobert Watson.An Wayne Salamon ,
181bc168a6cSRobert Watson.An Robert Watson ,
182bc168a6cSRobert Watsonand SPARTA Inc.
183ca0716f5SRobert Watson.Pp
184ca0716f5SRobert WatsonThe Basic Security Module (BSM) interface to audit records and audit event
185ca0716f5SRobert Watsonstream format were defined by Sun Microsystems.
186ca0716f5SRobert Watson.Pp
187ca0716f5SRobert WatsonThis manual page was written by
188ca0716f5SRobert Watson.An Robert Watson Aq rwatson@FreeBSD.org .
189