AUDITON(2)
π NAME π
auditon β configure system audit parameters
okay so bestie, meet auditon, repping section 2 (the system calls girlies). she's the one who configures your system's audit parameters. no cap.
β¨ SYNOPSIS β¨
#include <bsm/audit.h>
int
auditon(int cmd, void *data, u_int length);
π«Ά DESCRIPTION π«Ά
So the auditon() system call is literally how you manipulate a whole lil menu of audit control operations. The data argument should point to a structure whose type depends on the command you picked β like, it's giving "choose your own adventure". The length argument specifies the size of *data in bytes. And cmd can be any of the following cuties:
πΈ A_SETPOLICY
Set audit policy flags. The data argument must point to an int value set to one or more of the following audit policy control values, bitwise OR'ed together: AUDIT_CNT, AUDIT_AHLT, AUDIT_ARGV, and AUDIT_ARGE.
- If
AUDIT_CNTis set, the system will continue even if it becomes low on space and discontinue logging events until the low space condition is remedied. If it is not set, audited events will block until the low space condition is remedied. Unaudited events, however, are unaffected. - If
AUDIT_AHLTis set, apanic(9)if it cannot write an event to the global audit log file. (a panic, bestie, she said what she said π) - If
AUDIT_ARGVis set, then the argument list passed to theexecve(2)system call will be audited. - If
AUDIT_ARGEis set, then the environment variables passed to theexecve(2)system call will be audited.
The default policy is none of the audit policy control flags set.
π A_SETKAUDIT
Set the host information. The data argument must point to a auditinfo_addr_t structure containing the host IP address information. After setting, audit records that are created as a result of kernel events will contain this information.
π¦ A_SETKMASK
Set the kernel preselection masks (success and failure). The data argument must point to a au_mask_t structure containing the mask values as defined in <bsm/audit.h>. These masks are used for non-attributable audit event preselection.
- The field
am_successspecifies which classes of successful audit events are to be logged to the audit trail. - The field
am_failurespecifies which classes of failed audit events are to be logged.
The value of both fields is the bitwise OR'ing of the audit event classes specified in bsm/audit.h. The various audit classes are described more fully in audit_class(5).
π A_SETQCTRL
Set kernel audit queue parameters. The data argument must point to a au_qctrl_t structure (defined in <bsm/audit.h>) containing the kernel audit queue control settings: aq_hiwater, aq_lowater, aq_bufsz, aq_delay, and aq_minfree.
- The field
aq_hiwaterdefines the maximum number of audit record entries in the queue used to store the audit records ready for delivery to disk. New records are inserted at the tail of the queue and removed from the head. For new records which would exceed the high water mark, the calling thread is inserted into the wait queue, waiting for the audit queue to have enough space available as defined with the fieldaq_lowater. - The field
aq_bufszdefines the maximum length of the audit record that can be supplied withaudit(2). - The field
aq_delayis unused. (iconic of her to just sit there doing nothing) - The field
aq_minfreespecifies the minimum amount of free blocks on the disk device used to store audit records. If the value of free blocks falls below the configured minimum amount, the kernel informs the audit daemon about low disk space. The value is to be specified in percent of free file system blocks. A value of0results in a disabling of the check.
The default and maximum values (default/maximum) for the audit queue control parameters are:
aq_hiwater 100/10000 (audit records)
aq_lowater 10/aq_hiwater (audit records)
aq_bufsz 32767/1048576 (bytes)
aq_delay (Not currently used.)
π A_SETSTAT
Return ENOSYS. (Not implemented.) so real, she said no π
π A_SETUMASK
Return ENOSYS. (Not implemented.)
π A_SETSMASK
Return ENOSYS. (Not implemented.)
β A_SETCOND
Set the current auditing condition. The data argument must point to a int value containing the new audit condition, one of AUC_AUDITING, AUC_NOAUDIT, or AUC_DISABLED.
- If
AUC_NOAUDITis set, then auditing is temporarily suspended. - If
AUC_AUDITINGis set, auditing is resumed. - If
AUC_DISABLEDis set, the auditing system will shutdown, draining all audit records and closing out the audit trail file.
π A_SETCLASS
Set the event class preselection mask for an audit event. The data argument must point to a au_evclass_map_t structure containing the audit event and mask.
- The field
ec_numberis the audit event. - The field
ec_classis the audit class mask.
See audit_event(5) for more information on audit event to class mapping.
π§ A_SETPMASK
Set the preselection masks for a process. The data argument must point to a auditpinfo_t structure that contains the given process's audit preselection masks for both success and failure.
- The field
ap_pidis the process id of the target process. - The field
ap_maskmust point to aau_mask_tstructure which holds the preselection masks as described in theA_SETKMASKsection above.
πΈ A_SETFSIZE
Set the maximum size of the audit log file. The data argument must point to a au_fstat_t structure with the af_filesz field set to the maximum audit log file size. A value of 0 indicates no limit to the size. (unlimited, we love a no-rules moment)
π₯ A_GETCLASS
Return the event to class mapping for the designated audit event. The data argument must point to a au_evclass_map_t structure. See the A_SETCLASS section above for more information.
π A_GETKAUDIT
Get the current host information. The data argument must point to a auditinfo_addr_t structure.
π A_GETPINFO
Return the audit settings for a process. The data argument must point to a auditpinfo_t structure which will be set to contain ap_auid (the audit ID), ap_mask (the preselection mask), ap_termid (the terminal ID), and ap_asid (the audit session ID) of the given target process. The process ID of the target process is passed into the kernel using the ap_pid field. See the section A_SETPMASK above and getaudit(2) for more information.
π¦ A_GETPINFO_ADDR
Return the extended audit settings for a process. The data argument must point to a auditpinfo_addr_t structure which is similar to the auditpinfo_t structure described above. The exception is the ap_termid (the terminal ID) field which points to a au_tid_addr_t structure can hold much a larger terminal address and an address type. The process ID of the target process is passed into the kernel using the ap_pid field. See the section A_SETPMASK above and getaudit(2) for more information.
π A_GETSINFO_ADDR
Return the extended audit settings for a session. The data argument must point to a auditinfo_addr_t structure. The audit session ID of the target session is passed into the kernel using the ai_asid field. See getaudit_addr(2) for more information about the auditinfo_addr_t structure.
π«Ά A_GETKMASK
Return the current kernel preselection masks. The data argument must point to a au_mask_t structure which will be set to the current kernel preselection masks for non-attributable events.
β A_GETPOLICY
Return the current audit policy setting. The data argument must point to a int value which will be set to one of the current audit policy flags. The audit policy flags are described in the A_SETPOLICY section above.
π A_GETQCTRL
Return the current kernel audit queue control parameters. The data argument must point to a au_qctrl_t structure which will be set to the current kernel audit queue control parameters. See the A_SETQCTL section above for more information.
πΈ A_GETFSIZE
Returns the maximum size of the audit log file. The data argument must point to a au_fstat_t structure.
- The
af_fileszfield will be set to the maximum audit log file size. A value of0indicates no limit to the size. - The
af_currszfield will be set to the current audit log file size.
π A_GETCWD
Return ENOSYS. (Not implemented.)
π A_GETCAR
Return ENOSYS. (Not implemented.)
π A_GETSTAT
Return ENOSYS. (Not implemented.)
π§ A_GETCOND
Return the current auditing condition. The data argument must point to a int value which will be set to the current audit condition, one of AUC_AUDITING, AUC_NOAUDIT or AUC_DISABLED. See the A_SETCOND section above for more information.
A_SENDTRIGGERβ okay so this one sends a trigger to the audit daemon. Thedataargument must point to anintvalue set to one of the acceptable trigger values, bestie. No cap, here's the whole menu:AUDIT_TRIGGER_LOW_SPACEβ low disk space where the audit log residesAUDIT_TRIGGER_OPEN_NEWβ open a new audit log fileAUDIT_TRIGGER_READ_FILEβ read theaudit_controlfileAUDIT_TRIGGER_CLOSE_AND_DIEβ close the current log file and exitAUDIT_TRIGGER_NO_SPACEβ no disk space left for audit log fileAUDIT_TRIGGER_ROTATE_USERβ request audit log file rotationAUDIT_TRIGGER_INITIALIZEβ initialize audit subsystem for Mac OS X only- or
AUDIT_TRIGGER_EXPIRE_TRAILSβ request audit log file expiration
β¨ RETURN VALUES β¨
Upon successful completion, the value 0 is returned. Otherwise, the value -1 is returned and the global variable errno is set to indicate the error. That's the vibe check, periodt. π
π ERRORS π
The auditon() function will fail if:
[ENOSYS]β returned by options not yet implemented.[EFAULT]β a failure occurred while data transferred to or from the kernel failed.[EINVAL]β illegal argument was passed by a system call.[EPERM]β the process does not have sufficient permission to complete the operation.
The A_SENDTRIGGER command is specific to the FreeBSD and Mac OS X implementations, and is not present in Solaris. So if you're on Solaris, it's literally not there, bestie. π
π¦ SEE ALSO π¦
Go give these a read, iykyk:
audit(2)auditctl(2)getaudit(2)getaudit_addr(2)getauid(2)setaudit(2)setaudit_addr(2)setauid(2)libbsm(3)
πΈ HISTORY πΈ
The OpenBSM implementation was created by McAfee Research, the security division of McAfee Inc., under contract to Apple Computer Inc. in 2004. It was subsequently adopted by the TrustedBSD Project as the foundation for the OpenBSM distribution. That's some main character energy, fr fr. π
π AUTHORS π
This software was created by McAfee Research, the security research division of McAfee, Inc., under contract to Apple Computer Inc. Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
The Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems.
This manual page was written by Tom Rhodes <trhodes@FreeBSD.org>, Robert Watson <rwatson@FreeBSD.org>, and Wayne Salamon <wsalamon@FreeBSD.org>.
This page's source/version is Debian, dated April 7, 2016, for AUDITON(2). Stay iconic, bestie! πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2008-2009 Apple Inc
- Copyright (c) 2005 Robert N. M. Watson
- Copyright (c) 2005 Tom Rhodes
- Copyright (c) 2005 Wayne J. Salamon
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms