xref: /freebsd/contrib/openbsm/libbsm/au_control.3 (revision c7aa572cacdeca83c35c12a378909d0b659300a9)
1ca0716f5SRobert Watson.\"-
24bd0c025SRobert Watson.\" Copyright (c) 2005-2006 Robert N. M. Watson
3ca0716f5SRobert Watson.\" All rights reserved.
4ca0716f5SRobert Watson.\"
5ca0716f5SRobert Watson.\" Redistribution and use in source and binary forms, with or without
6ca0716f5SRobert Watson.\" modification, are permitted provided that the following conditions
7ca0716f5SRobert Watson.\" are met:
8ca0716f5SRobert Watson.\" 1. Redistributions of source code must retain the above copyright
9ca0716f5SRobert Watson.\"    notice, this list of conditions and the following disclaimer.
10ca0716f5SRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright
11ca0716f5SRobert Watson.\"    notice, this list of conditions and the following disclaimer in the
12ca0716f5SRobert Watson.\"    documentation and/or other materials provided with the distribution.
13ca0716f5SRobert Watson.\"
14ca0716f5SRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15ca0716f5SRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16ca0716f5SRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17ca0716f5SRobert Watson.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18ca0716f5SRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19ca0716f5SRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20ca0716f5SRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21ca0716f5SRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22ca0716f5SRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23ca0716f5SRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24ca0716f5SRobert Watson.\" SUCH DAMAGE.
25ca0716f5SRobert Watson.\"
265e386598SRobert Watson.Dd December 2, 2016
27ca0716f5SRobert Watson.Dt AU_CONTROL 3
28ca0716f5SRobert Watson.Os
29ca0716f5SRobert Watson.Sh NAME
30ca0716f5SRobert Watson.Nm setac ,
31ca0716f5SRobert Watson.Nm endac ,
32ca0716f5SRobert Watson.Nm getacdir ,
33aa772005SRobert Watson.Nm getacdist ,
3406edd2f1SRobert Watson.Nm getacexpire ,
354bd0c025SRobert Watson.Nm getacfilesz ,
36ca0716f5SRobert Watson.Nm getacflg ,
37aa772005SRobert Watson.Nm getachost ,
38aa772005SRobert Watson.Nm getacmin ,
39bb97b418SRobert Watson.Nm getacna ,
40bb97b418SRobert Watson.Nm getacpol ,
41bc168a6cSRobert Watson.Nm au_poltostr ,
42bb97b418SRobert Watson.Nm au_strtopol
43bc168a6cSRobert Watson.Nd "look up information from the audit_control database"
44ca0716f5SRobert Watson.Sh LIBRARY
45ca0716f5SRobert Watson.Lb libbsm
46ca0716f5SRobert Watson.Sh SYNOPSIS
47bc168a6cSRobert Watson.In bsm/libbsm.h
48ca0716f5SRobert Watson.Ft void
49bc168a6cSRobert Watson.Fn setac void
50ca0716f5SRobert Watson.Ft void
51bc168a6cSRobert Watson.Fn endac void
52ca0716f5SRobert Watson.Ft int
53ca0716f5SRobert Watson.Fn getacdir "char *name" "int len"
54ca0716f5SRobert Watson.Ft int
55aa772005SRobert Watson.Fn getacdist "void"
56ca0716f5SRobert Watson.Ft int
57b6a05070SChristian Brueffer.Fn getacexpire "int *andflg" "time_t *age" "size_t *size"
5806edd2f1SRobert Watson.Ft int
594bd0c025SRobert Watson.Fn getacfilesz "size_t *size_val"
604bd0c025SRobert Watson.Ft int
61ca0716f5SRobert Watson.Fn getacflg "char *auditstr" "int len"
62ca0716f5SRobert Watson.Ft int
63aa772005SRobert Watson.Fn getachost "char *auditstr" "int len"
64aa772005SRobert Watson.Ft int
65aa772005SRobert Watson.Fn getacmin "int *min_val"
66aa772005SRobert Watson.Ft int
67ca0716f5SRobert Watson.Fn getacna "char *auditstr" "int len"
68bb97b418SRobert Watson.Ft int
69bb97b418SRobert Watson.Fn getacpol "char *auditstr" "size_t len"
705e386598SRobert Watson.Ft int
715e386598SRobert Watson.Fn getacqsize "int *size_val"
72bb97b418SRobert Watson.Ft ssize_t
73c0020399SRobert Watson.Fn au_poltostr "int policy" "size_t maxsize" "char *buf"
74bb97b418SRobert Watson.Ft int
75c0020399SRobert Watson.Fn au_strtopol "const char *polstr" "int *policy"
76ca0716f5SRobert Watson.Sh DESCRIPTION
77ca0716f5SRobert WatsonThese interfaces may be used to look up information from the
78ca0716f5SRobert Watson.Xr audit_control 5
79ca0716f5SRobert Watsondatabase, which contains various audit-related administrative parameters.
80ca0716f5SRobert Watson.Pp
81bc168a6cSRobert WatsonThe
82ca0716f5SRobert Watson.Fn setac
83bc168a6cSRobert Watsonfunction
84ca0716f5SRobert Watsonresets the database iterator to the beginning of the database; see the
85bc168a6cSRobert Watson.Sx BUGS
86bc168a6cSRobert Watsonsection for more information.
87ca0716f5SRobert Watson.Pp
88bc168a6cSRobert WatsonThe
890814440eSRobert Watson.Fn endac
90bc168a6cSRobert Watsonfunction
91ca0716f5SRobert Watsoncloses the
92ca0716f5SRobert Watson.Xr audit_control 5
93ca0716f5SRobert Watsondatabase.
94ca0716f5SRobert Watson.Pp
95bc168a6cSRobert WatsonThe
96ca0716f5SRobert Watson.Fn getacdir
97bc168a6cSRobert Watsonfunction
9823bf6e20SRobert Watsonreturns the name of the directory where log data is stored via the passed
99ca0716f5SRobert Watsoncharacter buffer
100bc168a6cSRobert Watson.Fa name
101ca0716f5SRobert Watsonof length
102bc168a6cSRobert Watson.Fa len .
103ca0716f5SRobert Watson.Pp
104bc168a6cSRobert WatsonThe
105aa772005SRobert Watson.Fn getacdist
106aa772005SRobert Watsonfunction returns a value that allows to decide if trail files distribution is
107aa772005SRobert Watsonturned on or off.
108ca0716f5SRobert Watson.Pp
109bc168a6cSRobert WatsonThe
11006edd2f1SRobert Watson.Fn getacexpire
11106edd2f1SRobert Watsonfunction
11206edd2f1SRobert Watsonreturns the audit trail file expiration parameters in the passed
11306edd2f1SRobert Watson.Vt int
11406edd2f1SRobert Watsonbuffer
11506edd2f1SRobert Watson.Fa andflg ,
11606edd2f1SRobert Watson.Vt time_t
11706edd2f1SRobert Watsonbuffer
11806edd2f1SRobert Watson.Fa age
11906edd2f1SRobert Watsonand
12006edd2f1SRobert Watson.Vt size_t
12106edd2f1SRobert Watsonbuffer
12206edd2f1SRobert Watson.Fa size .
12306edd2f1SRobert WatsonIf the parameter is not specified in the
12406edd2f1SRobert Watson.Xr audit_control 5
12506edd2f1SRobert Watsonfile it is set to zero.
12606edd2f1SRobert Watson.Pp
12706edd2f1SRobert WatsonThe
1284bd0c025SRobert Watson.Fn getacfilesz
129bc168a6cSRobert Watsonfunction
130bc168a6cSRobert Watsonreturns the audit trail rotation size in the passed
131bc168a6cSRobert Watson.Vt size_t
132bc168a6cSRobert Watsonbuffer
1334bd0c025SRobert Watson.Fa size_val .
1344bd0c025SRobert Watson.Pp
135bc168a6cSRobert WatsonThe
136ca0716f5SRobert Watson.Fn getacflg
137bc168a6cSRobert Watsonfunction
138ca0716f5SRobert Watsonreturns the audit system flags via the the passed character buffer
139bc168a6cSRobert Watson.Fa auditstr
140ca0716f5SRobert Watsonof length
141bc168a6cSRobert Watson.Fa len .
142ca0716f5SRobert Watson.Pp
143bc168a6cSRobert WatsonThe
144aa772005SRobert Watson.Fn getachost
145aa772005SRobert Watsonfunction
146aa772005SRobert Watsonreturns the local systems's audit host information via the the passed character
147aa772005SRobert Watsonbuffer
148aa772005SRobert Watson.Fa auditstr
149aa772005SRobert Watsonof length
150aa772005SRobert Watson.Fa len .
151aa772005SRobert Watson.Pp
152aa772005SRobert WatsonThe
153aa772005SRobert Watson.Fn getacmin
154aa772005SRobert Watsonfunction
155aa772005SRobert Watsonreturns the minimum free disk space for the audit log target file system via
156aa772005SRobert Watsonthe passed
157aa772005SRobert Watson.Fa min_val
158aa772005SRobert Watsonvariable.
159aa772005SRobert Watson.Pp
160aa772005SRobert WatsonThe
161ca0716f5SRobert Watson.Fn getacna
162bc168a6cSRobert Watsonfunction
163ca0716f5SRobert Watsonreturns the non-attributable flags via the passed character buffer
164bc168a6cSRobert Watson.Fa auditstr
165ca0716f5SRobert Watsonof length
166bc168a6cSRobert Watson.Fa len .
167bb97b418SRobert Watson.Pp
168bc168a6cSRobert WatsonThe
169bb97b418SRobert Watson.Fn getacpol
170bc168a6cSRobert Watsonfunction
171bb97b418SRobert Watsonreturns the audit policy flags via the passed character buffer
172bc168a6cSRobert Watson.Fa auditstr
173bb97b418SRobert Watsonof length
174bc168a6cSRobert Watson.Fa len .
175bb97b418SRobert Watson.Pp
176bc168a6cSRobert WatsonThe
1775e386598SRobert Watson.Fn getacqsize
1785e386598SRobert Watsonfunction returns the size of the audit post-commit queue in the passed
1795e386598SRobert Watson.Fa size_val
1805e386598SRobert Watsonbuffer.
1815e386598SRobert WatsonIf the parameter is not specified in the
1825e386598SRobert Watson.Xr audit_control 5
1835e386598SRobert Watsonfile it is set to
1845e386598SRobert Watson.Dv -1 ,
1855e386598SRobert Watsonindicating that the kernel's default queue size is being used.
1865e386598SRobert Watson.Pp
1875e386598SRobert WatsonThe
188bb97b418SRobert Watson.Fn au_poltostr
189bc168a6cSRobert Watsonfunction
190bb97b418SRobert Watsonconverts a numeric audit policy mask,
191bc168a6cSRobert Watson.Fa policy ,
192bc168a6cSRobert Watsonto a string in the passed character buffer
193bc168a6cSRobert Watson.Fa buf
194bb97b418SRobert Watsonof lenth
195bc168a6cSRobert Watson.Fa maxsize .
196bb97b418SRobert Watson.Pp
197bc168a6cSRobert WatsonThe
198bb97b418SRobert Watson.Fn au_strtopol
199bc168a6cSRobert Watsonfunction
200bb97b418SRobert Watsonconverts an audit policy flags string,
201bc168a6cSRobert Watson.Fa polstr ,
202bb97b418SRobert Watsonto a numeric audit policy mask returned via
203bc168a6cSRobert Watson.Fa policy .
204*3008333dSChristian S.J. Peron.Sh RETURN VALUES
205bc168a6cSRobert WatsonThe
206aa772005SRobert Watson.Fn getacfilesz ,
207ca0716f5SRobert Watson.Fn getacdir ,
20806edd2f1SRobert Watson.Fn getacexpire ,
209ca0716f5SRobert Watson.Fn getacflg ,
210aa772005SRobert Watson.Fn getachost ,
211aa772005SRobert Watson.Fn getacmin ,
212bb97b418SRobert Watson.Fn getacna ,
213bb97b418SRobert Watson.Fn getacpol ,
2145e386598SRobert Watson.Fn getacqsize ,
215ca0716f5SRobert Watsonand
216bb97b418SRobert Watson.Fn au_strtopol
217bc168a6cSRobert Watsonfunctions
218ca0716f5SRobert Watsonreturn 0 on success, or a negative value on failure, along with error
219ca0716f5SRobert Watsoninformation in
220ca0716f5SRobert Watson.Va errno .
221bb97b418SRobert Watson.Pp
222bc168a6cSRobert WatsonThe
223bb97b418SRobert Watson.Fn au_poltostr
224bc168a6cSRobert Watsonfunction
225bb97b418SRobert Watsonreturns a string length of 0 or more on success, or a negative value on
226bb97b418SRobert Watsonif there is a failure.
227bb97b418SRobert Watson.Pp
228aa772005SRobert WatsonThe
229aa772005SRobert Watson.Fn getacdist
230aa772005SRobert Watsonfunction returns 1 if trail files distribution is turned on, 0 if it is turned
231aa772005SRobert Watsonoff or negative value on failure.
232aa772005SRobert Watson.Pp
233ca0716f5SRobert WatsonFunctions that return a string value will return a failure if there is
234ca0716f5SRobert Watsoninsufficient room in the passed character buffer for the full string.
235ca0716f5SRobert Watson.Sh SEE ALSO
236ca0716f5SRobert Watson.Xr libbsm 3 ,
237ca0716f5SRobert Watson.Xr audit_control 5
238ca0716f5SRobert Watson.Sh HISTORY
239ca0716f5SRobert WatsonThe OpenBSM implementation was created by McAfee Research, the security
240ca0716f5SRobert Watsondivision of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
241ca0716f5SRobert WatsonIt was subsequently adopted by the TrustedBSD Project as the foundation for
242ca0716f5SRobert Watsonthe OpenBSM distribution.
243bc168a6cSRobert Watson.Sh AUTHORS
244bc168a6cSRobert Watson.An -nosplit
245bc168a6cSRobert WatsonThis software was created by
246bc168a6cSRobert Watson.An Robert Watson ,
247bc168a6cSRobert Watson.An Wayne Salamon ,
248bc168a6cSRobert Watsonand
249bc168a6cSRobert Watson.An Suresh Krishnaswamy
250bc168a6cSRobert Watsonfor McAfee Research, the security research division of McAfee,
251bc168a6cSRobert WatsonInc., under contract to Apple Computer, Inc.
252bc168a6cSRobert Watson.Pp
253bc168a6cSRobert WatsonThe Basic Security Module (BSM) interface to audit records and audit event
254bc168a6cSRobert Watsonstream format were defined by Sun Microsystems.
255ca0716f5SRobert Watson.Sh BUGS
256ca0716f5SRobert WatsonThese routines cannot currently distinguish between an entry not being found
257ca0716f5SRobert Watsonand an error accessing the database.
258ca0716f5SRobert WatsonThe implementation should be changed to return an error via
259ca0716f5SRobert Watson.Va errno
260ca0716f5SRobert Watsonwhen
261ca0716f5SRobert Watson.Dv NULL
262ca0716f5SRobert Watsonis returned.
263aa772005SRobert Watson.Pp
264ca0716f5SRobert WatsonThere is no reason for the
265ca0716f5SRobert Watson.Fn setac
266ca0716f5SRobert Watsoninterface to be exposed as part of the public API, as it is called implicitly
267ca0716f5SRobert Watsonby other access functions and iteration is not supported.
268ca0716f5SRobert Watson.Pp
269ca0716f5SRobert WatsonThese interfaces inconsistently return various negative values depending on
270ca0716f5SRobert Watsonthe failure mode, and do not always set
271ca0716f5SRobert Watson.Va errno
272ca0716f5SRobert Watsonon failure.
273