xref: /freebsd/contrib/openbsm/libbsm/au_token.3 (revision 0e6acb26)
1.\"-
2.\" Copyright (c) 2005-2007, 2016 Robert N. M. Watson
3.\" All rights reserved.
4.\"
5.\" Portions of this software were developed by BAE Systems, the University of
6.\" Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL
7.\" contract FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent
8.\" Computing (TC) research program.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.Dd April 19, 2005
32.Dt AU_TOKEN 3
33.Os
34.Sh NAME
35.Nm au_to_arg32 ,
36.Nm au_to_arg64 ,
37.Nm au_to_arg ,
38.Nm au_to_attr64 ,
39.Nm au_to_data ,
40.Nm au_to_exit ,
41.Nm au_to_groups ,
42.Nm au_to_newgroups ,
43.Nm au_to_in_addr ,
44.Nm au_to_in_addr_ex ,
45.Nm au_to_ip ,
46.Nm au_to_ipc ,
47.Nm au_to_ipc_perm ,
48.Nm au_to_iport ,
49.Nm au_to_opaque ,
50.Nm au_to_file ,
51.Nm au_to_text ,
52.Nm au_to_path ,
53.Nm au_to_process32 ,
54.Nm au_to_process64 ,
55.Nm au_to_process ,
56.Nm au_to_process32_ex ,
57.Nm au_to_process64_ex ,
58.Nm au_to_process_ex ,
59.Nm au_to_return32 ,
60.Nm au_to_return64 ,
61.Nm au_to_return ,
62.Nm au_to_seq ,
63.Nm au_to_sock_inet32 ,
64.Nm au_to_sock_inet128 ,
65.Nm au_to_sock_inet ,
66.Nm au_to_socket_ex ,
67.Nm au_to_subject32 ,
68.Nm au_to_subject64 ,
69.Nm au_to_subject ,
70.Nm au_to_subject32_ex ,
71.Nm au_to_subject64_ex ,
72.Nm au_to_subject_ex ,
73.Nm au_to_me ,
74.Nm au_to_exec_args ,
75.Nm au_to_exec_env ,
76.Nm au_to_header ,
77.Nm au_to_header32 ,
78.Nm au_to_header64 ,
79.Nm au_to_header_ex ,
80.Nm au_to_header32_ex ,
81.Nm au_to_trailer ,
82.Nm au_to_zonename
83.Nd "routines for generating BSM audit tokens"
84.Sh LIBRARY
85.Lb libbsm
86.Sh SYNOPSIS
87.In bsm/libbsm.h
88.Ft "token_t *"
89.Fn au_to_arg32 "char n" "const char *text" "u_int32_t v"
90.Ft "token_t *"
91.Fn au_to_arg64 "char n" "const char *text" "u_int64_t v"
92.Ft "token_t *"
93.Fn au_to_arg "char n" "const char *text" "u_int32_t v"
94.Ft "token_t *"
95.Fn au_to_attr32 "struct vattr *attr"
96.Ft "token_t *"
97.Fn au_to_attr64 "struct vattr *attr"
98.Ft "token_t *"
99.Fn au_to_attr "struct vattr *attr"
100.Ft "token_t *"
101.Fn au_to_data "char unit_print" "char unit_type" "char unit_count" "const char *p"
102.Ft "token_t *"
103.Fn au_to_exit "int retval" "int err"
104.Ft "token_t *"
105.Fn au_to_groups "int *groups"
106.Ft "token_t *"
107.Fn au_to_newgroups "u_int16_t n" "gid_t *groups"
108.Ft "token_t *"
109.Fn au_to_in_addr "struct in_addr *internet_addr"
110.Ft "token_t *"
111.Fn au_to_in_addr_ex "struct in6_addr *internet_addr"
112.Ft "token_t *"
113.Fn au_to_ip "struct ip *ip"
114.Ft "token_t *"
115.Fn au_to_ipc "char type" "int id"
116.Ft "token_t *"
117.Fn au_to_ipc_perm "struct ipc_perm *perm"
118.Ft "token_t *"
119.Fn au_to_iport "u_int16_t iport"
120.Ft "token_t *"
121.Fn au_to_opaque "const char *data" "u_int16_t bytes"
122.Ft "token_t *"
123.Fn au_to_file "const char *file" "struct timeval tm"
124.Ft "token_t *"
125.Fn au_to_text "const char *text"
126.Ft "token_t *"
127.Fn au_to_path "const char *text"
128.Ft "token_t *"
129.Fo au_to_process32
130.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
131.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
132.Fc
133.Ft "token_t *"
134.Fo au_to_process64
135.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
136.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
137.Fc
138.Ft "token_t *"
139.Fo au_to_process32_ex
140.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
141.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
142.Fc
143.Ft "token_t *"
144.Fo au_to_process64_ex
145.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
146.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
147.Fc
148.Ft "token_t *"
149.Fn au_to_return32 "char status" "u_int32_t ret"
150.Ft "token_t *"
151.Fn au_to_return64 "char status" "u_int64_t ret"
152.Ft "token_t *"
153.Fn au_to_return "char status" "u_int32_t ret"
154.Ft "token_t *"
155.Fn au_to_seq "long audit_count"
156.Ft "token_t *"
157.Fn au_to_sock_inet32 "struct sockaddr_in *so"
158.Ft "token_t *"
159.Fn au_to_sock_inet128 "struct sockaddr_in6 *so"
160.Ft "token_t *"
161.Fn au_to_sock_int "struct sockaddr_in *so"
162.Ft "token_t *"
163.Fn au_to_socket_ex "u_short so_domain" "u_short so_type" "struct sockaddr *sa_local" "struct sockaddr *sa_remote"
164.Ft "token_t *"
165.Fo au_to_subject32
166.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
167.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
168.Fc
169.Ft "token_t *"
170.Fo au_to_subject64
171.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
172.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
173.Fc
174.Ft "token_t *"
175.Fo au_to_subject
176.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
177.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
178.Fc
179.Ft "token_t *"
180.Fo au_to_subject32_ex
181.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
182.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
183.Fc
184.Ft "token_t *"
185.Fo au_to_subject64_ex
186.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
187.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
188.Fc
189.Ft "token_t *"
190.Fo au_to_subject_ex
191.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
192.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
193.Fc
194.Ft "token_t *"
195.Fn au_to_me void
196.Ft "token_t *"
197.Fn au_to_exec_args "char **argv"
198.Ft "token_t *"
199.Fn au_to_exec_env "char **envp"
200.Ft "token_t *"
201.Fn au_to_header "int rec_size" "au_event_t e_type" "au_emod_t emod"
202.Ft "token_t *"
203.Fn au_to_header32 "int rec_size" "au_event_t e_type" "au_emod_t emod"
204.Ft "token_t *"
205.Fn au_to_header64 "int rec_size" "au_event_t e_type" "au_emod_t e_mod"
206.Ft "token_t *"
207.Fn au_to_header_ex "int rec_size" "au_event_t e_type" "au_emod_t e_mod"
208.Ft "token_t *"
209.Fn au_to_header32_ex "int rec_size" "au_event_t e_type" "au_emod_t e_mod"
210.Ft "token_t *"
211.Fn au_to_trailer "int rec_size"
212.Ft "token_t *"
213.Fn au_to_zonename "const char *zonename"
214.Sh DESCRIPTION
215These interfaces support the allocation of BSM audit tokens, represented by
216.Vt token_t ,
217for various data types.
218.Pp
219.Xr au_errno_to_bsm 3
220must be used to convert local
221.Xr errno 2
222errors to BSM error numbers before they are passed to
223.Fn au_to_return ,
224.Fn au_to_return32 ,
225and
226.Fn au_to_return64 .
227.Sh RETURN VALUES
228On success, a pointer to a
229.Vt token_t
230will be returned; the allocated
231.Vt token_t
232can be freed via a call to
233.Xr au_free_token 3 .
234On failure,
235.Dv NULL
236will be returned, and an error condition returned via
237.Va errno .
238.Sh SEE ALSO
239.Xr au_errno_to_bsm 3 ,
240.Xr libbsm 3
241.Sh HISTORY
242The OpenBSM implementation was created by McAfee Research, the security
243division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
244It was subsequently adopted by the TrustedBSD Project as the foundation for
245the OpenBSM distribution.
246.Sh AUTHORS
247.An -nosplit
248This software was created by
249.An Robert Watson ,
250.An Wayne Salamon ,
251and
252.An Suresh Krishnaswamy
253for McAfee Research, the security research division of McAfee,
254Inc., under contract to Apple Computer, Inc.
255.Pp
256The Basic Security Module (BSM) interface to audit records and audit event
257stream format were defined by Sun Microsystems.
258