2 .\" Copyright (c) 2017 Peter Tribble
3 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH AUDITON 2 "Mar 6, 2017"
9 auditon \- manipulate auditing
13 cc [ \fIflag\fR... ] \fIfile\fR... \fB-lbsm\fR \fB -lsocket \fR \fB -lnsl \fR [ \fIlibrary\fR... ]
14 #include <sys/param.h>
15 #include <bsm/libbsm.h>
17 \fBint\fR \fBauditon\fR(\fBint\fR \fIcmd\fR, \fBcaddr_t\fR \fIdata\fR, \fBint\fR \fIlength\fR);
22 The \fBauditon()\fR function performs various audit subsystem control
23 operations. The \fIcmd\fR argument designates the particular audit control
24 command. The \fIdata\fR argument is a pointer to command-specific data. The
25 \fIlength\fR argument is the length in bytes of the command-specific data.
28 The following commands are supported:
36 Return the system audit condition in the integer pointed to by
37 \fIdata\fR. The following values can be returned:
41 \fB\fBAUC_AUDITING\fR\fR
44 Audit daemon is active.
50 \fB\fBAUC_INIT_AUDIT\fR\fR
53 Audit is ready but auditd has not run.
59 \fB\fBAUC_NOAUDIT\fR\fR
62 Audit daemon is not active.
68 \fB\fBAUC_NOSPACE\fR\fR
71 Auditing has blocked due to lack of space in audit partition.
83 Set the system's audit on/off condition to the value in the integer pointed to
84 by \fIdata\fR. The following audit states can be set:
88 \fB\fBAUC_AUDITING\fR\fR
91 Turns on audit record generation.
97 \fB\fBAUC_NOAUDIT\fR\fR
100 Turns off audit record generation.
108 \fB\fBA_GETCLASS\fR\fR
112 Return the event to class mapping for the designated audit event. The
113 \fIdata\fR argument points to the \fBau_evclass_map\fR structure containing the
114 event number. The preselection class mask is returned in the same structure.
120 \fB\fBA_SETCLASS\fR\fR
124 Set the event class preselection mask for the designated audit event. The
125 \fIdata\fR argument points to the \fBau_evclass_map\fR structure containing the
126 event number and class mask.
132 \fB\fBA_GETKMASK\fR\fR
136 Return the kernel preselection mask in the \fBau_mask\fR structure pointed to
137 by \fIdata\fR. This is the mask used to preselect non-attributable audit
144 \fB\fBA_SETKMASK\fR\fR
148 Set the kernel preselection mask. The \fIdata\fR argument points to the
149 \fBau_mask\fR structure containing the class mask. This is the mask used to
150 preselect non-attributable audit events.
156 \fB\fBA_GETPINFO\fR\fR
160 Return the audit ID, preselection mask, terminal ID and audit session ID of the
161 specified process in the \fBauditpinfo\fR structure pointed to by \fIdata\fR.
163 Note that \fBA_GETPINFO\fR can fail if the terminal ID contains a network
164 address longer than 32 bits. In this case, the \fBA_GETPINFO_ADDR\fR command
171 \fB\fBA_GETPINFO_ADDR\fR\fR
175 Returns the audit ID, preselection mask, terminal ID and audit session ID of
176 the specified process in the \fBauditpinfo_addr\fR structure pointed to by
183 \fB\fBA_SETPMASK\fR\fR
187 Set the preselection mask of the specified process. The \fIdata\fR argument
188 points to the \fBauditpinfo\fR structure containing the process ID and the
189 preselection mask. The other fields of the structure are ignored and should be
196 \fB\fBA_SETUMASK\fR\fR
200 Set the preselection mask for all processes with the specified audit ID. The
201 \fIdata\fR argument points to the \fBauditinfo\fR structure containing the
202 audit ID and the preselection mask. The other fields of the structure are
203 ignored and should be set to \fINULL\fR.
209 \fB\fBA_SETSMASK\fR\fR
213 Set the preselection mask for all processes with the specified audit session
214 ID. The \fIdata\fR argument points to the \fBauditinfo\fR structure containing
215 the audit session \fBID\fR and the preselection mask. The other fields of the
216 structure are ignored and should be set to \fINULL.\fR
222 \fB\fBA_GETQCTRL\fR\fR
226 Return the kernel audit queue control parameters. These control the high and
227 low water marks of the number of audit records allowed in the audit queue. The
228 high water mark is the maximum allowed number of undelivered audit records. The
229 low water mark determines when threads blocked on the queue are wakened.
230 Another parameter controls the size of the data buffer used to write data to
231 the audit trail. There is also a parameter that specifies a maximum delay
232 before data is attempted to be written to the audit trail. The audit queue
233 parameters are returned in the \fBau_qctrl\fR structure pointed to by
240 \fB\fBA_SETQCTRL\fR\fR
244 Set the kernel audit queue control parameters as described above in the
245 \fBA_GETQCTRL\fR command. The \fIdata\fR argument points to the \fBau_qctrl\fR
246 structure containing the audit queue control parameters. The default and
247 maximum values 'A/B' for the audit queue control parameters are:
254 \fB100/10000\fR (audit records)
263 \fB10/1024\fR (audit records)
269 \fBoutput buffer size\fR
272 \fB1024/1048576\fR (bytes)
281 \fB20/20000\fR (hundredths second)
293 Return the current working directory as kept by the audit subsystem. This is a
294 path anchored on the real root, rather than on the active root. The \fIdata\fR
295 argument points to a buffer into which the path is copied. The \fIlength\fR
296 argument is the length of the buffer.
306 Return the current active root as kept by the audit subsystem. This path can be
307 used to anchor an absolute path for a path token generated by an application.
308 The \fIdata\fR argument points to a buffer into which the path is copied. The
309 \fIlength\fR argument is the length of the buffer.
315 \fB\fBA_GETSTAT\fR\fR
319 Return the system audit statistics in the \fBaudit_stat\fR structure pointed to
326 \fB\fBA_SETSTAT\fR\fR
330 Reset system audit statistics values. The kernel statistics value is reset if
331 the corresponding field in the statistics structure pointed to by the
332 \fIdata\fR argument is \fBCLEAR_VAL\fR. Otherwise, the value is not changed.
338 \fB\fBA_GETPOLICY\fR\fR
342 Return the audit policy flags in the integer pointed to by \fIdata\fR.
348 \fB\fBA_SETPOLICY\fR\fR
352 Set the audit policy flags to the values in the integer pointed to by
353 \fIdata\fR. The following policy flags are recognized:
357 \fB\fBAUDIT_CNT\fR\fR
361 Do not suspend processes when audit storage is full or inaccessible. The
362 default action is to suspend processes until storage becomes available.
368 \fB\fBAUDIT_AHLT\fR\fR
372 Halt the machine when a non-attributable audit record can not be delivered. The
373 default action is to count the number of events that could not be recorded.
379 \fB\fBAUDIT_ARGV\fR\fR
383 Include in the audit record the argument list for a member of the \fBexec\fR(2)
384 family of functions. The default action is not to include this information.
390 \fB\fBAUDIT_ARGE\fR\fR
394 Include the environment variables for the \fBexecv\fR(2) function in the audit
395 record. The default action is not to include this information.
401 \fB\fBAUDIT_SEQ\fR\fR
405 Add a \fIsequence\fR token to each audit record. The default action is not to
412 \fB\fBAUDIT_TRAIL\fR\fR
416 Append a \fItrailer\fR token to each audit record. The default action is not to
423 \fB\fBAUDIT_GROUP\fR\fR
427 Include the supplementary groups list in audit records. The default action is
434 \fB\fBAUDIT_PATH\fR\fR
438 Include secondary paths in audit records. Examples of secondary paths are
439 dynamically loaded shared library modules and the command shell path for
440 executable scripts. The default action is to include only the primary path from
447 \fB\fBAUDIT_WINDATA_DOWN\fR\fR
451 Include in an audit record any downgraded data moved between windows. This
452 policy is available only if the system is configured with Trusted Extensions.
453 By default, this information is not included.
459 \fB\fBAUDIT_WINDATA_UP\fR\fR
463 Include in an audit record any upgraded data moved between windows. This policy
464 is available only if the system is configured with Trusted Extensions. By
465 default, this information is not included.
471 \fB\fBAUDIT_PERZONE\fR\fR
475 Enable auditing for each local zone. If not set, audit records from all zones
476 are collected in a single log accessible in the global zone and certain
477 \fBauditconfig\fR(1M) operations are disallowed. This policy can be set only
478 from the global zone.
484 \fB\fBAUDIT_ZONENAME\fR\fR
488 Generate a zone ID token with each audit record.
495 Upon successful completion, \fBauditon()\fR returns \fB0\fR. Otherwise, \(mi1
496 is returned and \fBerrno\fR is set to indicate the error.
499 The \fBauditon()\fR function will fail if:
506 The \fIlength\fR field for the command was too small to hold the returned
516 The copy of data to/from the kernel failed.
525 One of the arguments was illegal, Audit has not been installed, or the
526 operation is not valid from a local zone.
535 The {\fBPRIV_SYS_AUDIT\fR} privilege is not asserted in the effective set of
538 Neither the {\fBPRIV_PROC_AUDIT\fR} nor the {\fBPRIV_SYS_AUDIT\fR} privilege is
539 asserted in the effective set of the calling process and the command is one of
540 \fBA_GETCAR\fR, \fBA_GETCLASS\fR, \fBA_GETCOND\fR, \fBA_GETCWD\fR,
541 \fBA_GETPINFO\fR, \fBA_GETPOLICY\fR.
546 The \fBauditon()\fR function can be invoked only by processes with appropriate
550 The use of \fBauditon()\fR to change system audit state is permitted only in
551 the global zone. From any other zone \fBauditon()\fR returns \(mi1 with
552 \fBerrno\fR set to \fBEPERM\fR. The following \fBauditon()\fR commands are
553 permitted only in the global zone: \fBA_SETCOND\fR, \fBA_SETCLASS\fR,
554 \fBA_SETKMASK\fR, \fBA_SETQCTRL\fR, \fBA_SETSTAT\fR, \fBA_SETFSIZE\fR, and
555 \fBA_SETPOLICY\fR. All other \fBauditon()\fR commands are valid from any zone.
558 See \fBattributes\fR(5) for descriptions of the following attributes:
566 ATTRIBUTE TYPE ATTRIBUTE VALUE
568 Interface Stability Committed
575 \fBauditconfig\fR(1M), \fBauditd\fR(1M), \fBaudit\fR(2),
576 \fBexec\fR(2), \fBaudit.log\fR(4), \fBattributes\fR(5), \fBprivileges\fR(5)
579 The auditon options that modify or display process-based information are not
580 affected by the "perzone" audit policy. Those that modify system audit data
581 such as the terminal ID and audit queue parameters are valid only in the global
582 zone unless the "perzone" policy is set. The "get" options for system audit
583 data reflect the local zone if "perzone" is set; otherwise they reflects the
584 settings of the global zone.