xref: /freebsd/contrib/openbsm/libbsm/libbsm.3 (revision 39beb93c3f8bdbf72a61fda42300b5ebed7390c8)
1.\"-
2.\" Copyright (c) 2005-2007 Robert N. M. Watson
3.\" Copyright (c) 2008 Apple Inc.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" $P4: //depot/projects/trustedbsd/openbsm/libbsm/libbsm.3#16 $
28.\"
29.Dd November 12, 2008
30.Dt LIBBSM 3
31.Os
32.Sh NAME
33.Nm libbsm
34.Nd "Basic Security Module (BSM) Audit API"
35.Sh LIBRARY
36.Lb libbsm
37.Sh SYNOPSIS
38.In bsm/libbsm.h
39.Sh DESCRIPTION
40The
41.Nm
42library routines provide an interface to BSM audit record streams, allowing
43both the parsing of existing audit streams, as well as the creation of new
44audit records and streams.
45.Sh INTERFACES
46The
47.Nm
48library
49provides a large number of Audit programming interfaces in several classes:
50event stream interfaces, class interfaces, control interfaces, event
51interfaces, I/O interfaces, mask interfaces, notification interfaces, token
52interfaces, and user interfaces.
53These are described respectively in the
54.Xr au_class 3 ,
55.Xr au_control 3 ,
56.Xr au_event 3 ,
57.Xr au_mask 3 ,
58.Xr au_notify 3 ,
59.Xr au_stream 3 ,
60.Xr au_token 3 ,
61and
62.Xr au_user 3
63manual pages.
64.Ss Audit Event Stream Interfaces
65Audit event stream interfaces support interaction with file-backed audit
66event streams:
67.Xr au_close 3 ,
68.Xr au_close_buffer 3 ,
69.Xr au_free_token 3 ,
70.Xr au_open 3 ,
71.Xr au_write 3 ,
72.Xr audit_submit 3 .
73.Ss Audit Class Interfaces
74Audit class interfaces support the look up of information from the
75.Xr audit_class 5
76database:
77.Xr endauclass 3 ,
78.Xr getauclassent 3 ,
79.Xr getauclassent_r 3 ,
80.Xr getauclassnam 3 ,
81.Xr getauclassnam_r 3 ,
82.Xr setauclass 3 .
83.Ss Audit Control Interfaces
84Audit control interfaces support the look up of information from the
85.Xr audit_control 5
86database:
87.Xr endac 3 ,
88.Xr setac 3 ,
89.Xr getacdir 3 ,
90.Xr getacfilesz 3 ,
91.Xr getacflg 3 ,
92.Xr getacmin 3 ,
93.Xr getacna 3 ,
94.Xr getacpol 3 ,
95.Xr au_poltostr 3 ,
96.Xr au_strtopol 3 .
97.Ss Audit Event Interfaces
98Audit event interfaces support the look up of information from the
99.Xr audit_event 5
100database:
101.Xr endauevent 3 ,
102.Xr setauevent 3 ,
103.Xr getauevent 3 ,
104.Xr getauevent_r 3 ,
105.Xr getauevnam 3 ,
106.Xr getauevnam_r 3 ,
107.Xr getauevnonam 3 ,
108.Xr getauevnonam_r 3 ,
109.Xr getauevnum 3 ,
110.Xr getauevnum_r 3 .
111.Ss Audit I/O Interfaces
112Audit I/O interfaces support the processing and printing of tokens, as well
113as the reading of audit records:
114.Xr au_fetch_tok 3 ,
115.Xr au_print_tok 3 ,
116.Xr au_read_rec 3 .
117.Ss Audit Mask Interfaces
118Audit mask interfaces convert support the conversion between strings and
119.Vt au_mask_t
120values.
121They may also be used to determine if a particular audit event is matched
122by a mask:
123.Xr au_preselect 3 ,
124.Xr getauditflagsbin 3 ,
125.Xr getauditflagschar 3 .
126.Ss Audit Notification Interfaces
127Audit notification routines track audit state in a form permitting efficient
128update, avoiding frequent system calls to check the kernel audit state:
129.Xr au_get_state 3 ,
130.Xr au_notify_initialize 3 ,
131.Xr au_notify_terminate 3 .
132These interfaces are implemented only for Darwin/Mac OS X.
133.Ss Audit Token Interface
134Audit token interfaces permit the creation of tokens for use in creating
135audit records for submission to event streams.
136Each interface converts a C type to its
137.Vt token_t
138representation:
139.Xr au_to_arg 3 ,
140.Xr au_to_arg32 3 ,
141.Xr au_to_arg64 3 ,
142.Xr au_to_attr64 3 ,
143.Xr au_to_data 3 ,
144.Xr au_to_exec_args 3 ,
145.Xr au_to_exec_env 3 ,
146.Xr au_to_exit 3 ,
147.Xr au_to_file 3 ,
148.Xr au_to_groups 3 ,
149.Xr au_to_header32 3 ,
150.Xr au_to_header64 3 ,
151.Xr au_to_in_addr 3 ,
152.Xr au_to_in_addr_ex 3 ,
153.Xr au_to_ip 3 ,
154.Xr au_to_ipc 3 ,
155.Xr au_to_ipc_perm 3 ,
156.Xr au_to_iport 3 ,
157.Xr au_to_me 3 ,
158.Xr au_to_newgroups 3 ,
159.Xr au_to_opaque 3 ,
160.Xr au_to_path 3 ,
161.Xr au_to_process 3 ,
162.Xr au_to_process32 3 ,
163.Xr au_to_process64 3 ,
164.Xr au_to_process_ex 3 ,
165.Xr au_to_process32_ex 3 ,
166.Xr au_to_process64_ex 3 ,
167.Xr au_to_return 3 ,
168.Xr au_to_return32 3 ,
169.Xr au_to_return64 3 ,
170.Xr au_to_seq 3 ,
171.Xr au_to_sock_inet 3 ,
172.Xr au_to_sock_inet32 3 ,
173.Xr au_to_sock_inet128 3 ,
174.Xr au_to_socket_ex 3 ,
175.Xr au_to_subject 3 ,
176.Xr au_to_subject32 3 ,
177.Xr au_to_subject64 3 ,
178.Xr au_to_subject_ex 3 ,
179.Xr au_to_subject32_ex 3 ,
180.Xr au_to_subject64_ex 3 ,
181.Xr au_to_text 3 ,
182.Xr au_to_trailer 3 ,
183.Xr au_to_zonename 3 .
184.Ss Audit User Interfaces
185Audit user interfaces support the look up of information from the
186.Xr audit_user 5
187database:
188.Xr au_user_mask 3 ,
189.Xr endauuser 3 ,
190.Xr setauuser 3 ,
191.Xr getauuserent 3 ,
192.Xr getauuserent_r 3 ,
193.Xr getauusernam 3 ,
194.Xr getauusernam_r 3 ,
195.Xr getfauditflags 3 .
196.Ss Audit Constant Conversion Interfaces
197These functions convert between BSM and local constants, including the
198.Xr errno 2
199number, socket type, and protocol famil spaces, and must be used to generate
200and interpret BSM return and extended socket tokens:
201.Xr au_bsm_to_domain 3 ,
202.Xr au_bsm_to_errno 3 ,
203.Xr au_bsm_to_socket_type 3 ,
204.Xr au_domain_to_bsm 3 ,
205.Xr au_errno_to_bsm 3 ,
206.Xr au_socket_type_to_bsm 3 .
207.Sh SEE ALSO
208.Xr au_class 3 ,
209.Xr au_domain 3 ,
210.Xr au_errno 3 ,
211.Xr au_mask 3 ,
212.Xr au_notify 3 ,
213.Xr au_socket_type 3 ,
214.Xr au_stream 3 ,
215.Xr au_token 3 ,
216.Xr au_user 3 ,
217.Xr audit_submit 3 ,
218.Xr audit_class 5 ,
219.Xr audit_control 5
220.Sh HISTORY
221The OpenBSM implementation was created by McAfee Research, the security
222division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
223It was subsequently adopted by the TrustedBSD Project as the foundation for
224the OpenBSM distribution.
225.Sh AUTHORS
226.An -nosplit
227This software was created by
228.An Robert Watson ,
229.An Wayne Salamon ,
230and
231.An Suresh Krishnaswamy
232for McAfee Research, the security research division of McAfee,
233Inc., under contract to Apple Computer, Inc.
234.Pp
235The Basic Security Module (BSM) interface to audit records and audit event
236stream format were defined by Sun Microsystems.
237.Sh BUGS
238Bugs would not be unlikely.
239.Pp
240The
241.Nm
242library implementations are generally thread-safe, but not reentrant.
243.Pp
244The assignment of routines to classes could use some work, as it is
245decidely ad hoc.
246For example,
247.Fn au_read_rec
248should probably be considered a stream routine.
249