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.\" 27*3008333dSChristian S.J. Peron.Dd March 14, 2018 28ca0716f5SRobert Watson.Dt GETAUDIT 2 29ca0716f5SRobert Watson.Os 30ca0716f5SRobert Watson.Sh NAME 31ca0716f5SRobert Watson.Nm getaudit , 32ca0716f5SRobert Watson.Nm getaudit_addr 33bc168a6cSRobert Watson.Nd "retrieve audit session state" 34ca0716f5SRobert Watson.Sh SYNOPSIS 35ca0716f5SRobert Watson.In bsm/audit.h 36ca0716f5SRobert Watson.Ft int 37ca0716f5SRobert Watson.Fn getaudit "auditinfo_t *auditinfo" 38ca0716f5SRobert Watson.Ft int 39ca0716f5SRobert Watson.Fn getaudit_addr "auditinfo_addr_t *auditinfo_addr" "u_int length" 40ca0716f5SRobert Watson.Sh DESCRIPTION 41bc168a6cSRobert WatsonThe 42ca0716f5SRobert Watson.Fn getaudit 43bc168a6cSRobert Watsonsystem call 44ca0716f5SRobert Watsonretrieves the active audit session state for the current process via the 45ca0716f5SRobert Watson.Vt auditinfo_t 46ca0716f5SRobert Watsonpointed to by 47bc168a6cSRobert Watson.Fa auditinfo . 48bc168a6cSRobert WatsonThe 49ca0716f5SRobert Watson.Fn getaudit_addr 50bc168a6cSRobert Watsonsystem call 51ca0716f5SRobert Watsonretrieves extended state via 52bc168a6cSRobert Watson.Fa auditinfo_addr 53ca0716f5SRobert Watsonand 54bc168a6cSRobert Watson.Fa length . 55ca0716f5SRobert Watson.Pp 5652267f74SRobert WatsonThe 5752267f74SRobert Watson.Fa auditinfo_t 5852267f74SRobert Watsondata structure is defined as follows: 5952267f74SRobert Watson.Bd -literal -offset indent 6052267f74SRobert Watsonstruct auditinfo { 6152267f74SRobert Watson au_id_t ai_auid; /* Audit user ID */ 6252267f74SRobert Watson au_mask_t ai_mask; /* Audit masks */ 6352267f74SRobert Watson au_tid_t ai_termid; /* Terminal ID */ 6452267f74SRobert Watson au_asid_t ai_asid; /* Audit session ID */ 65*3008333dSChristian S.J. Peron au_asflgs_t ai_flags; /* Audit session flags. */ 6652267f74SRobert Watson}; 6752267f74SRobert Watsontypedef struct auditinfo auditinfo_t; 6852267f74SRobert Watson.Ed 6952267f74SRobert Watson.Pp 7052267f74SRobert WatsonThe 7152267f74SRobert Watson.Fa ai_auid 7252267f74SRobert Watsonvariable contains the audit identifier which is recorded in the audit log for 7352267f74SRobert Watsoneach event the process caused. 7452267f74SRobert Watson.Pp 7552267f74SRobert WatsonThe 7652267f74SRobert Watson.Fa au_mask_t 7752267f74SRobert Watsondata structure defines the bit mask for auditing successful and failed events 7852267f74SRobert Watsonout of the predefined list of event classes. 7952267f74SRobert WatsonIt is defined as follows: 8052267f74SRobert Watson.Bd -literal -offset indent 8152267f74SRobert Watsonstruct au_mask { 8252267f74SRobert Watson unsigned int am_success; /* success bits */ 8352267f74SRobert Watson unsigned int am_failure; /* failure bits */ 8452267f74SRobert Watson}; 8552267f74SRobert Watsontypedef struct au_mask au_mask_t; 8652267f74SRobert Watson.Ed 8752267f74SRobert Watson.Pp 8852267f74SRobert WatsonThe 8952267f74SRobert Watson.Fa au_termid_t 9052267f74SRobert Watsondata structure defines the Terminal ID recorded with every event caused by the 9152267f74SRobert Watsonprocess. 9252267f74SRobert WatsonIt is defined as follows: 9352267f74SRobert Watson.Bd -literal -offset indent 9452267f74SRobert Watsonstruct au_tid { 9552267f74SRobert Watson dev_t port; 9652267f74SRobert Watson u_int32_t machine; 9752267f74SRobert Watson}; 9852267f74SRobert Watsontypedef struct au_tid au_tid_t; 9952267f74SRobert Watson.Ed 10052267f74SRobert Watson.Pp 10152267f74SRobert WatsonThe 10252267f74SRobert Watson.Fa ai_asid 10352267f74SRobert Watsonvariable contains the audit session ID which is recorded with every event 10452267f74SRobert Watsoncaused by the process. 10552267f74SRobert Watson.Pp 10652267f74SRobert WatsonThe 10752267f74SRobert Watson.Fn getaudit_addr 10852267f74SRobert Watsonsystem call 10952267f74SRobert Watsonuses the expanded 11052267f74SRobert Watson.Fa auditinfo_addr_t 11152267f74SRobert Watsondata structure and supports Terminal IDs with larger addresses 11252267f74SRobert Watsonsuch as those used in IP version 6. 11352267f74SRobert WatsonIt is defined as follows: 11452267f74SRobert Watson.Bd -literal -offset indent 11552267f74SRobert Watsonstruct auditinfo_addr { 11652267f74SRobert Watson au_id_t ai_auid; /* Audit user ID. */ 11752267f74SRobert Watson au_mask_t ai_mask; /* Audit masks. */ 11852267f74SRobert Watson au_tid_addr_t ai_termid; /* Terminal ID. */ 11952267f74SRobert Watson au_asid_t ai_asid; /* Audit session ID. */ 12052267f74SRobert Watson}; 12152267f74SRobert Watsontypedef struct auditinfo_addr auditinfo_addr_t; 12252267f74SRobert Watson.Ed 12352267f74SRobert Watson.Pp 12452267f74SRobert WatsonThe 12552267f74SRobert Watson.Fa au_tid_addr_t 12652267f74SRobert Watsondata structure which includes a larger address storage field and an additional 12752267f74SRobert Watsonfield with the type of address stored: 12852267f74SRobert Watson.Bd -literal -offset indent 12952267f74SRobert Watsonstruct au_tid_addr { 13052267f74SRobert Watson dev_t at_port; 13152267f74SRobert Watson u_int32_t at_type; 13252267f74SRobert Watson u_int32_t at_addr[4]; 13352267f74SRobert Watson}; 13452267f74SRobert Watsontypedef struct au_tid_addr au_tid_addr_t; 13552267f74SRobert Watson.Ed 13652267f74SRobert Watson.Pp 137bc168a6cSRobert WatsonThese system calls require an appropriate privilege to complete. 138ca0716f5SRobert Watson.Sh RETURN VALUES 139bc168a6cSRobert Watson.Rv -std getaudit getaudit_addr 14052267f74SRobert Watson.Sh ERRORS 14152267f74SRobert WatsonThe 14252267f74SRobert Watson.Fn getaudit 14352267f74SRobert Watsonfunction will fail if: 14452267f74SRobert Watson.Bl -tag -width Er 14552267f74SRobert Watson.It Bq Er EFAULT 14652267f74SRobert WatsonA failure occurred while data transferred to or from 14752267f74SRobert Watsonthe kernel failed. 14852267f74SRobert Watson.It Bq Er EINVAL 14952267f74SRobert WatsonIllegal argument was passed by a system call. 15052267f74SRobert Watson.It Bq Er EPERM 15152267f74SRobert WatsonThe process does not have sufficient permission to complete 15252267f74SRobert Watsonthe operation. 15352267f74SRobert Watson.It Bq Er EOVERFLOW 15452267f74SRobert WatsonThe 15552267f74SRobert Watson.Fa length 15652267f74SRobert Watsonargument indicates an overflow condition will occur. 15752267f74SRobert Watson.It Bq Er E2BIG 15852267f74SRobert WatsonThe address is too big and, therefore, 15952267f74SRobert Watson.Fn getaudit_addr 16052267f74SRobert Watsonshould be used instead. 16152267f74SRobert Watson.El 162ca0716f5SRobert Watson.Sh SEE ALSO 163ca0716f5SRobert Watson.Xr audit 2 , 164ca0716f5SRobert Watson.Xr auditon 2 , 165ca0716f5SRobert Watson.Xr getauid 2 , 166ca0716f5SRobert Watson.Xr setaudit 2 , 167bc168a6cSRobert Watson.Xr setauid 2 , 168ca0716f5SRobert Watson.Xr libbsm 3 169bc168a6cSRobert Watson.Sh HISTORY 170bc168a6cSRobert WatsonThe OpenBSM implementation was created by McAfee Research, the security 171bc168a6cSRobert Watsondivision of McAfee Inc., under contract to Apple Computer Inc.\& in 2004. 172bc168a6cSRobert WatsonIt was subsequently adopted by the TrustedBSD Project as the foundation for 173bc168a6cSRobert Watsonthe OpenBSM distribution. 174ca0716f5SRobert Watson.Sh AUTHORS 175bc168a6cSRobert Watson.An -nosplit 176ca0716f5SRobert WatsonThis software was created by McAfee Research, the security research division 177ca0716f5SRobert Watsonof McAfee, Inc., under contract to Apple Computer Inc. 178bc168a6cSRobert WatsonAdditional authors include 179bc168a6cSRobert Watson.An Wayne Salamon , 180bc168a6cSRobert Watson.An Robert Watson , 181bc168a6cSRobert Watsonand SPARTA Inc. 182ca0716f5SRobert Watson.Pp 183ca0716f5SRobert WatsonThe Basic Security Module (BSM) interface to audit records and audit event 184ca0716f5SRobert Watsonstream format were defined by Sun Microsystems. 185ca0716f5SRobert Watson.Pp 186ca0716f5SRobert WatsonThis manual page was written by 187ca0716f5SRobert Watson.An Robert Watson Aq rwatson@FreeBSD.org . 188