xref: /freebsd/contrib/openbsm/man/setaudit.2 (revision b626f5a73a48f44a31a200291b141e1da408a2ff)
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.\"
27ca0716f5SRobert Watson.Dd April 19, 2005
28ca0716f5SRobert Watson.Dt SETAUDIT 2
29ca0716f5SRobert Watson.Os
30ca0716f5SRobert Watson.Sh NAME
31ca0716f5SRobert Watson.Nm setaudit ,
32ca0716f5SRobert Watson.Nm setaudit_addr
33bc168a6cSRobert Watson.Nd "set audit session state"
34ca0716f5SRobert Watson.Sh SYNOPSIS
35ca0716f5SRobert Watson.In bsm/audit.h
36ca0716f5SRobert Watson.Ft int
37ca0716f5SRobert Watson.Fn setaudit "auditinfo_t *auditinfo"
38ca0716f5SRobert Watson.Ft int
39bc168a6cSRobert Watson.Fn setaudit_addr "auditinfo_addr_t *auditinfo_addr" "u_int length"
40ca0716f5SRobert Watson.Sh DESCRIPTION
41bc168a6cSRobert WatsonThe
42bc168a6cSRobert Watson.Fn setaudit
43bc168a6cSRobert Watsonsystem call
44ca0716f5SRobert Watsonsets 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 setaudit_addr
50bc168a6cSRobert Watsonsystem call
51ca0716f5SRobert Watsonsets 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:
59*aa772005SRobert Watson.Bd -literal -offset 4n
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 */
6552267f74SRobert Watson};
6652267f74SRobert Watsontypedef struct auditinfo        auditinfo_t;
67*aa772005SRobert Watson.Ed
6852267f74SRobert Watson.Pp
6952267f74SRobert WatsonThe
7052267f74SRobert Watson.Fa ai_auid
7152267f74SRobert Watsonvariable contains the audit identifier which is recorded in the audit log for
7252267f74SRobert Watsoneach event the process caused.
73*aa772005SRobert Watson.Pp
7452267f74SRobert WatsonThe
7552267f74SRobert Watson.Fa au_mask_t
7652267f74SRobert Watsondata structure defines the bit mask for auditing successful and failed events
7752267f74SRobert Watsonout of the predefined list of event classes. It is defined as follows:
78*aa772005SRobert Watson.Bd -literal -offset 4n
7952267f74SRobert Watsonstruct au_mask {
8052267f74SRobert Watson	unsigned int    am_success;     /* success bits */
8152267f74SRobert Watson	unsigned int    am_failure;     /* failure bits */
8252267f74SRobert Watson};
8352267f74SRobert Watsontypedef struct au_mask  au_mask_t;
84*aa772005SRobert Watson.Ed
85*aa772005SRobert Watson.Pp
8652267f74SRobert WatsonThe
8752267f74SRobert Watson.Fa au_termid_t
8852267f74SRobert Watsondata structure defines the Terminal ID recorded with every event caused by the
8952267f74SRobert Watsonprocess. It is defined as follows:
90*aa772005SRobert Watson.Bd -literal -offset 4n
9152267f74SRobert Watsonstruct au_tid {
9252267f74SRobert Watson	dev_t           port;
9352267f74SRobert Watson	u_int32_t       machine;
9452267f74SRobert Watson};
9552267f74SRobert Watsontypedef struct au_tid   au_tid_t;
96*aa772005SRobert Watson.Ed
97*aa772005SRobert Watson.Pp
9852267f74SRobert WatsonThe
9952267f74SRobert Watson.Fa ai_asid
10052267f74SRobert Watsonvariable contains the audit session ID which is recorded with every event
10152267f74SRobert Watsoncaused by the process.
10252267f74SRobert Watson.Pp
10352267f74SRobert WatsonThe
10452267f74SRobert Watson.Fn setaudit_addr
10552267f74SRobert Watsonsystem call
10652267f74SRobert Watsonuses the expanded
10752267f74SRobert Watson.Fa auditinfo_addr_t
10852267f74SRobert Watsondata structure supports Terminal IDs with larger addresses such as those used
10952267f74SRobert Watsonin IP version 6.  It is defined as follows:
110*aa772005SRobert Watson.Bd -literal -offset 4n
11152267f74SRobert Watsonstruct auditinfo_addr {
11252267f74SRobert Watson	au_id_t         ai_auid;        /* Audit user ID. */
11352267f74SRobert Watson	au_mask_t       ai_mask;        /* Audit masks. */
11452267f74SRobert Watson	au_tid_addr_t   ai_termid;      /* Terminal ID. */
11552267f74SRobert Watson	au_asid_t       ai_asid;        /* Audit session ID. */
11652267f74SRobert Watson};
11752267f74SRobert Watsontypedef struct auditinfo_addr   auditinfo_addr_t;
118*aa772005SRobert Watson.Ed
11952267f74SRobert Watson.Pp
12052267f74SRobert WatsonThe
12152267f74SRobert Watson.Fa au_tid_addr_t
12252267f74SRobert Watsondata structure which includes a larger address storage field and an additional
12352267f74SRobert Watsonfield with the type of address stored:
124*aa772005SRobert Watson.Bd -literal -offset 4n
12552267f74SRobert Watsonstruct au_tid_addr {
12652267f74SRobert Watson	dev_t           at_port;
12752267f74SRobert Watson	u_int32_t       at_type;
12852267f74SRobert Watson	u_int32_t       at_addr[4];
12952267f74SRobert Watson};
13052267f74SRobert Watsontypedef struct au_tid_addr      au_tid_addr_t;
131*aa772005SRobert Watson.Ed
13252267f74SRobert Watson.Pp
133bc168a6cSRobert WatsonThese system calls require an appropriate privilege to complete.
134ca0716f5SRobert Watson.Sh RETURN VALUES
135bc168a6cSRobert Watson.Rv -std setaudit setaudit_addr
13652267f74SRobert Watson.Sh ERRORS
13752267f74SRobert Watson.Bl -tag -width Er
13852267f74SRobert Watson.It Bq Er EFAULT
13952267f74SRobert WatsonA failure occurred while data transferred to or from
14052267f74SRobert Watsonthe kernel failed.
14152267f74SRobert Watson.It Bq Er EINVAL
14252267f74SRobert WatsonIllegal argument was passed by a system call.
14352267f74SRobert Watson.It Bq Er EPERM
14452267f74SRobert WatsonThe process does not have sufficient permission to complete
14552267f74SRobert Watsonthe operation.
14652267f74SRobert Watson.El
147ca0716f5SRobert Watson.Sh SEE ALSO
148ca0716f5SRobert Watson.Xr audit 2 ,
149ca0716f5SRobert Watson.Xr auditon 2 ,
150ca0716f5SRobert Watson.Xr getaudit 2 ,
151ca0716f5SRobert Watson.Xr getauid 2 ,
152ca0716f5SRobert Watson.Xr setauid 2 ,
153ca0716f5SRobert Watson.Xr libbsm 3
154bc168a6cSRobert Watson.Sh HISTORY
155bc168a6cSRobert WatsonThe OpenBSM implementation was created by McAfee Research, the security
156bc168a6cSRobert Watsondivision of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
157bc168a6cSRobert WatsonIt was subsequently adopted by the TrustedBSD Project as the foundation for
158bc168a6cSRobert Watsonthe OpenBSM distribution.
159ca0716f5SRobert Watson.Sh AUTHORS
160bc168a6cSRobert Watson.An -nosplit
161ca0716f5SRobert WatsonThis software was created by McAfee Research, the security research division
162ca0716f5SRobert Watsonof McAfee, Inc., under contract to Apple Computer Inc.
163bc168a6cSRobert WatsonAdditional authors include
164bc168a6cSRobert Watson.An Wayne Salamon ,
165bc168a6cSRobert Watson.An Robert Watson ,
166bc168a6cSRobert Watsonand SPARTA Inc.
167ca0716f5SRobert Watson.Pp
168ca0716f5SRobert WatsonThe Basic Security Module (BSM) interface to audit records and audit event
169ca0716f5SRobert Watsonstream format were defined by Sun Microsystems.
170ca0716f5SRobert Watson.Pp
171ca0716f5SRobert WatsonThis manual page was written by
172ca0716f5SRobert Watson.An Robert Watson Aq rwatson@FreeBSD.org .
173