]> git.saurik.com Git - apple/xnu.git/blame - bsd/man/man2/auditon.2
xnu-1504.15.3.tar.gz
[apple/xnu.git] / bsd / man / man2 / auditon.2
CommitLineData
2d21ac55 1.\"
b0d623f7 2.\" Copyright (c) 2008-2009 Apple Inc. All rights reserved.
2d21ac55
A
3.\"
4.\" @APPLE_LICENSE_HEADER_START@
5.\"
6.\" This file contains Original Code and/or Modifications of Original Code
7.\" as defined in and that are subject to the Apple Public Source License
8.\" Version 2.0 (the 'License'). You may not use this file except in
9.\" compliance with the License. Please obtain a copy of the License at
10.\" http://www.opensource.apple.com/apsl/ and read it before using this
11.\" file.
12.\"
13.\" The Original Code and all software distributed under the License are
14.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18.\" Please see the License for the specific language governing rights and
19.\" limitations under the License.
20.\"
21.\" @APPLE_LICENSE_HEADER_END@
22.\"
b0d623f7 23.Dd January 29, 2009
2d21ac55 24.Dt AUDITON 2
b0d623f7 25.Os
2d21ac55
A
26.Sh NAME
27.Nm auditon
b0d623f7 28.Nd "configure system audit parameters"
2d21ac55 29.Sh SYNOPSIS
b0d623f7 30.In bsm/audit.h
2d21ac55 31.Ft int
b0d623f7 32.Fn auditon "int cmd" "void *data" "u_int length"
2d21ac55
A
33.Sh DESCRIPTION
34The
35.Fn auditon
b0d623f7
A
36system call is used to manipulate various audit control operations.
37The
38.Fa data
39argument
40should point to a structure whose type depends on the command.
41The
42.Fa length
43argument
44specifies the size of
45.Fa *data
46in bytes.
47The
48.Fa cmd
49argument
50may be any of the following:
51.Bl -tag -width ".It Dv A_GETPINFO_ADDR"
52.It Dv A_SETPOLICY
53Set audit policy flags.
54The
55.Fa data
56argument
57must point to a
58.Vt int
59value set to one or more the following audit
60policy control values bitwise OR'ed together:
61.Dv AUDIT_CNT ,
62.Dv AUDIT_AHLT ,
63.Dv AUDIT_ARGV ,
64and
65.Dv AUDIT_ARGE .
66If
67.Dv AUDIT_CNT is set, the system will continue even if it becomes low
68on space and discontinue logging events until the low space condition is
69remedied.
70If it is not set, audited events will block until the low space
71condition is remedied.
72Unaudited events, however, are unaffected.
73If
74.Dv AUDIT_AHLT is set, a
75.Xr panic 9
76if it cannot write an event to the global audit log file.
77If
78.Dv AUDIT_ARGV
79is set, then the argument list passed to the
80.Xr execve 2
81system call will be audited. If
82.Dv AUDIT_ARGE
83is set, then the environment variables passed to the
84.Xr execve 2
85system call will be audited. The default policy is none of the audit policy
86control flags set.
87.It Dv A_SETKAUDIT
88Set the host information.
89The
90.Fa data
91argument
92must point to a
93.Vt auditinfo_addr_t
94structure containing the host IP address information.
95After setting, audit records
96that are created as a result of kernel events will contain
97this information.
98.It Dv A_SETKMASK
99Set the kernel preselection masks (success and failure).
100The
101.Fa data
102argument
103must point to a
104.Vt au_mask_t
105structure containing the mask values as defined in
106.In bsm/audit.h .
107These masks are used for non-attributable audit event preselection.
2d21ac55
A
108The field
109.Fa am_success
110specifies which classes of successful audit events are to be logged to the
111audit trail. The field
112.Fa am_failure
113specifies which classes of failed audit events are to be logged. The value of
b0d623f7 114both fields is the bitwise OR'ing of the audit event classes specified in
2d21ac55
A
115.Fa bsm/audit.h .
116The various audit classes are described more fully in
117.Xr audit_class 5 .
b0d623f7
A
118.It Dv A_SETQCTRL
119Set kernel audit queue parameters.
120The
121.Fa data
122argument
123must point to a
124.Vt au_qctrl_t
125structure (defined in
126.In bsm/audit.h )
127containing the kernel audit queue control settings:
128.Fa aq_hiwater ,
129.Fa aq_lowater ,
130.Fa aq_bufsz ,
131.Fa aq_delay ,
132and
133.Fa aq_minfree .
134The field
135.Fa aq_hiwater
136defines the maximum number of audit record entries in the queue used to store
137the audit records ready for delivery to disk.
138New records are inserted at the tail of the queue and removed from the head.
139For new records which would exceed the
140high water mark, the calling thread is inserted into the wait queue, waiting
141for the audit queue to have enough space available as defined with the field
142.Fa aq_lowater .
143The field
144.Fa aq_bufsz
145defines the maximum length of the audit record that can be supplied with
146.Xr audit 2 .
147The field
148.Fa aq_delay
149is unused.
150The field
151.Fa aq_minfree
152specifies the minimum amount of free blocks on the disk device used to store
153audit records.
154If the value of free blocks falls below the configured
155minimum amount, the kernel informs the audit daemon about low disk space.
156The value is to be specified in percent of free file system blocks.
157A value of 0 results in a disabling of the check.
158The default and maximum values (default/maximum) for the
159audit queue control parameters are:
160.Pp
161.Bl -column aq_hiwater -offset indent -compact
162.It aq_hiwater Ta 100/10000 (audit records)
163.It aq_lowater Ta 10/aq_hiwater (audit records)
164.It aq_bufsz Ta 32767/1048576 (bytes)
165.It aq_delay Ta (Not currently used.)
166.El
167.It Dv A_SETSTAT
168Return
169.Er ENOSYS .
170(Not implemented.)
171.It Dv A_SETUMASK
172Return
173.Er ENOSYS .
174(Not implemented.)
175.It Dv A_SETSMASK
176Return
177.Er ENOSYS .
178(Not implemented.)
179.It Dv A_SETCOND
180Set the current auditing condition.
181The
182.Fa data
183argument
184must point to a
185.Vt int
186value containing the new
187audit condition, one of
188.Dv AUC_AUDITING ,
189.Dv AUC_NOAUDIT ,
190or
191.Dv AUC_DISABLED .
192If
193.Dv AUC_NOAUDIT
194is set, then auditing is temporarily suspended. If
195.Dv AUC_AUDITING
196is set, auditing is resumed. If
197.Dv AUC_DISABLED
198is set, the auditing system will
199shutdown, draining all audit records and closing out the audit trail file.
200.It Dv A_SETCLASS
201Set the event class preselection mask for an audit event.
202The
203.Fa data
204argument
205must point to a
206.Vt au_evclass_map_t
207structure containing the audit event and mask.
208The field
209.Fa ec_number
210is the audit event and
211.Fa ec_class
212is the audit class mask. See
213.Xr audit_event 5
214for more information on audit event to class mapping.
215.It Dv A_SETPMASK
216Set the preselection masks for a process.
217The
218.Fa data
219argument
220must point to a
221.Vt auditpinfo_t
222structure that contains the given process's audit
223preselection masks for both success and failure.
224The field
225.Fa ap_pid
226is the process id of the target process.
227The field
228.Fa ap_mask
229must point to a
230.Fa au_mask_t
231structure which holds the preselection masks as described in the
232.Da A_SETKMASK
233section above.
234.It Dv A_SETFSIZE
235Set the maximum size of the audit log file.
236The
237.Fa data
238argument
239must point to a
240.Vt au_fstat_t
241structure with the
242.Va af_filesz
243field set to the maximum audit log file size.
244A value of 0
245indicates no limit to the size.
246.It Dv A_GETCLASS
247Return the event to class mapping for the designated audit event.
248The
249.Fa data
250argument
251must point to a
252.Vt au_evclass_map_t
253structure. See the
254.Dv A_SETCLASS
255section above for more information.
256.It Dv A_GETKAUDIT
257Get the current host information.
258The
259.Fa data
260argument
261must point to a
262.Vt auditinfo_addr_t
263structure.
264.It Dv A_GETPINFO
265Return the audit settings for a process.
266The
267.Fa data
268argument
269must point to a
270.Vt auditpinfo_t
271structure which will be set to contain
272.Fa ap_auid
273(the audit ID),
274.Fa ap_mask
275(the preselection mask),
276.Fa ap_termid
277(the terminal ID), and
278.Fa ap_asid
279(the audit session ID)
280of the given target process.
281The process ID of the target process is passed
282into the kernel using the
283.Fa ap_pid
284field.
285See the section
286.Dv A_SETPMASK
287above and
288.Xr getaudit 2
289for more information.
290.It Dv A_GETPINFO_ADDR
291Return the extended audit settings for a process.
292The
293.Fa data
294argument
295must point to a
296.Vt auditpinfo_addr_t
297structure which is similar to the
298.Vt auditpinfo_addr_t
299structure described above.
300The exception is the
301.Fa ap_termid
302(the terminal ID) field which points to a
303.Vt au_tid_addr_t
304structure can hold much a larger terminal address and an address type.
305The process ID of the target process is passed into the kernel using the
306.Fa ap_pid
307field.
308See the section
309.Dv A_SETPMASK
310above and
311.Xr getaudit 2
312for more information.
313.It Dv A_GETSINFO_ADDR
314Return the extended audit settings for a session.
315The
316.Fa data
317argument
318must point to a
319.Vt auditinfo_addr_t
320structure.
321The audit session ID of the target session is passed
322into the kernel using the
323.Fa ai_asid
324field. See
325.Xr getaudit_addr 2
326for more information about the
327.Vt auditinfo_addr_t
328structure.
329.It Dv A_GETKMASK
330Return the current kernel preselection masks.
331The
332.Fa data
333argument
334must point to a
335.Vt au_mask_t
336structure which will be set to
337the current kernel preselection masks for non-attributable events.
338.It Dv A_GETPOLICY
339Return the current audit policy setting.
340The
341.Fa data
342argument
343must point to a
344.Vt int
345value which will be set to
346one of the current audit policy flags.
347The audit policy flags are
348described in the
349.Dv A_SETPOLICY
350section above.
351.It Dv A_GETQCTRL
352Return the current kernel audit queue control parameters.
353The
354.Fa data
355argument
356must point to a
357.Vt au_qctrl_t
358structure which will be set to the current
359kernel audit queue control parameters.
360See the
361.Dv A_SETQCTL
362section above for more information.
363.It Dv A_GETFSIZE
364Returns the maximum size of the audit log file.
365The
366.Fa data
367argument
368must point to a
369.Vt au_fstat_t
370structure.
371The
372.Va af_filesz
373field will be set to the maximum audit log file size.
374A value of 0 indicates no limit to the size.
375The
376.Va af_currsz
377field
378will be set to the current audit log file size.
379.It Dv A_GETCWD
380.\" [COMMENTED OUT]: Valid description, not yet implemented.
381.\" Return the current working directory as stored in the audit subsystem.
382Return
383.Er ENOSYS .
384(Not implemented.)
385.It Dv A_GETCAR
386.\" [COMMENTED OUT]: Valid description, not yet implemented.
387.\"Stores and returns the current active root as stored in the audit
388.\"subsystem.
389Return
390.Er ENOSYS .
391(Not implemented.)
392.It Dv A_GETSTAT
393.\" [COMMENTED OUT]: Valid description, not yet implemented.
394.\"Return the statistics stored in the audit system.
395Return
396.Er ENOSYS .
397(Not implemented.)
398.It Dv A_GETCOND
399Return the current auditing condition.
400The
401.Fa data
402argument
403must point to a
404.Vt int
405value which will be set to
406the current audit condition, one of
407.Dv AUC_AUDITING ,
408.Dv AUC_NOAUDIT
409or
410.Dv AUC_DISABLED .
411See the
412.Dv A_SETCOND
413section above for more information.
414.It Dv A_SENDTRIGGER
415Send a trigger to the audit daemon.
416The
417.Fa data
418argument
419must point to a
420.Vt int
421value set to one of the acceptable
422trigger values:
423.Dv AUDIT_TRIGGER_LOW_SPACE
424(low disk space where the audit log resides),
425.Dv AUDIT_TRIGGER_OPEN_NEW
426(open a new audit log file),
427.Dv AUDIT_TRIGGER_READ_FILE
428(read the
429.Pa audit_control
430file),
431.Dv AUDIT_TRIGGER_CLOSE_AND_DIE
432(close the current log file and exit),
433.Dv AUDIT_TRIGGER_NO_SPACE
434(no disk space left for audit log file).
435.Dv AUDIT_TRIGGER_ROTATE_USER
436(request audit log file rotation).
437.Dv AUDIT_TRIGGER_INITIALIZE
438(initialize audit subsystem for Mac OS X only).
439or
440.Dv AUDIT_TRIGGER_EXPIRE_TRAILS
441(request audit log file expiration).
2d21ac55
A
442.El
443.Sh RETURN VALUES
b0d623f7 444.Rv -std
2d21ac55 445.Sh ERRORS
b0d623f7 446The
2d21ac55 447.Fn auditon
b0d623f7
A
448function will fail if:
449.Bl -tag -width Er
450.It Bq Er ENOSYS
451Returned by options not yet implemented.
452.It Bq Er EFAULT
453A failure occurred while data transferred to or from
454the kernel failed.
2d21ac55 455.It Bq Er EINVAL
b0d623f7
A
456Illegal argument was passed by a system call.
457.It Bq Er EPERM
458The process does not have sufficient permission to complete
459the operation.
2d21ac55 460.El
b0d623f7
A
461.Pp
462The
463.Dv A_SENDTRIGGER
464command is specific to the
465.Fx
466and Mac OS X implementations, and is not present in Solaris.
2d21ac55
A
467.Sh SEE ALSO
468.Xr audit 2 ,
469.Xr auditctl 2 ,
2d21ac55 470.Xr getaudit 2 ,
2d21ac55 471.Xr getaudit_addr 2 ,
b0d623f7
A
472.Xr getauid 2 ,
473.Xr setaudit 2 ,
2d21ac55 474.Xr setaudit_addr 2 ,
b0d623f7
A
475.Xr setauid 2 ,
476.Xr libbsm 3
2d21ac55 477.Sh HISTORY
b0d623f7
A
478The OpenBSM implementation was created by McAfee Research, the security
479division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
480It was subsequently adopted by the TrustedBSD Project as the foundation for
481the OpenBSM distribution.
482.Sh AUTHORS
483.An -nosplit
484This software was created by McAfee Research, the security research division
485of McAfee, Inc., under contract to Apple Computer Inc.
486Additional authors include
487.An Wayne Salamon ,
488.An Robert Watson ,
489and SPARTA Inc.
490.Pp
491The Basic Security Module (BSM) interface to audit records and audit event
492stream format were defined by Sun Microsystems.
493.Pp
494This manual page was written by
495.An Tom Rhodes Aq trhodes@FreeBSD.org ,
496.An Robert Watson Aq rwatson@FreeBSD.org ,
497and
498.An Wayne Salamon Aq wsalamon@FreeBSD.org .