AUDITON(2)
πΈ NAME πΈ
okay bestie, this is auditon(2) from the System Calls Manual β the system call for configure system audit parameters. No cap, it's giving full kernel audit-control energy, and we're going through every single command together. π
β¨ SYNOPSIS β¨
#include <bsm/audit.h>
int
auditon(int cmd, void *data, u_int length);
π DESCRIPTION π
The auditon() system call is used to manipulate various audit control operations. The data argument should point to a structure whose type depends on the command. The length argument specifies the size of *data in bytes. The cmd argument may be any of the following:
A_SETPOLICYβ Set audit policy flags. Thedataargument must point to anintvalue set to one or more of the following audit policy control values bitwise OR'ed together:AUDIT_CNT,AUDIT_AHLT,AUDIT_ARGV, andAUDIT_ARGE. IfAUDIT_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. IfAUDIT_AHLTis set, apanic(9)happens if it cannot write an event to the global audit log file. IfAUDIT_ARGVis set, then the argument list passed to theexecve(2)system call will be audited. IfAUDIT_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. Thedataargument must point to aauditinfo_addr_tstructure 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). Thedataargument must point to aau_mask_tstructure containing the mask values as defined in<bsm/audit.h>. These masks are used for non-attributable audit event preselection. The fieldam_successspecifies which classes of successful audit events are to be logged to the audit trail. The fieldam_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 inbsm/audit.h. The various audit classes are described more fully inaudit_class(5). β¨A_SETQCTRLβ Set kernel audit queue parameters. Thedataargument must point to aau_qctrl_tstructure (defined in<bsm/audit.h>) containing the kernel audit queue control settings:aq_hiwater,aq_lowater,aq_bufsz,aq_delay, andaq_minfree. The fieldaq_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 fieldaq_bufszdefines the maximum length of the audit record that can be supplied withaudit(2). The fieldaq_delayis unused. The fieldaq_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β ReturnENOSYS. (Not implemented.) πA_SETUMASKβ ReturnENOSYS. (Not implemented.) πA_SETSMASKβ ReturnENOSYS. (Not implemented.) πA_SETCONDβ Set the current auditing condition. Thedataargument must point to anintvalue containing the new audit condition, one ofAUC_AUDITING,AUC_NOAUDIT, orAUC_DISABLED. IfAUC_NOAUDITis set, then auditing is temporarily suspended. IfAUC_AUDITINGis set, auditing is resumed. IfAUC_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. Thedataargument must point to aau_evclass_map_tstructure containing the audit event and mask. The fieldec_numberis the audit event andec_classis the audit class mask. Seeaudit_event(5)for more information on audit event to class mapping. πA_SETPMASKβ Set the preselection masks for a process. Thedataargument must point to aauditpinfo_tstructure that contains the given process's audit preselection masks for both success and failure. The fieldap_pidis the process id of the target process. The fieldap_maskmust point to aau_mask_tstructure which holds the preselection masks as described in the section above. π«ΆA_SETFSIZEβ Set the maximum size of the audit log file. Thedataargument must point to aau_fstat_tstructure with theaf_fileszfield set to the maximum audit log file size. A value of0indicates no limit to the size. πΈA_GETCLASSβ Return the event to class mapping for the designated audit event. Thedataargument must point to aau_evclass_map_tstructure. See theA_SETCLASSsection above for more information. βA_GETKAUDITβ Get the current host information. Thedataargument must point to aauditinfo_addr_tstructure. π¦A_GETPINFOβ Return the audit settings for a process. Thedataargument must point to aauditpinfo_tstructure which will be set to containap_auid(the audit ID),ap_mask(the preselection mask),ap_termid(the terminal ID), andap_asid(the audit session ID) of the given target process. The process ID of the target process is passed into the kernel using theap_pidfield. See the sectionA_SETPMASKabove andgetaudit(2)for more information. πA_GETPINFO_ADDRβ Return the extended audit settings for a process. Thedataargument must point to aauditpinfo_addr_tstructure which is similar to theauditpinfo_addr_tstructure described above. The exception is theap_termid(the terminal ID) field which points to aau_tid_addr_tstructure can hold much a larger terminal address and an address type. The process ID of the target process is passed into the kernel using theap_pidfield. See the sectionA_SETPMASKabove andgetaudit(2)for more information. πA_GETSINFO_ADDRβ Return the extended audit settings for a session. Thedataargument must point to aauditinfo_addr_tstructure. The audit session ID of the target session is passed into the kernel using theai_asidfield. Seegetaudit_addr(2)for more information about theauditinfo_addr_tstructure. πA_GETKMASKβ Return the current kernel preselection masks. Thedataargument must point to aau_mask_tstructure which will be set to the current kernel preselection masks for non-attributable events. β¨A_GETPOLICYβ Return the current audit policy setting. Thedataargument must point to anintvalue which will be set to one of the current audit policy flags. The audit policy flags are described in theA_SETPOLICYsection above. πA_GETQCTRLβ Return the current kernel audit queue control parameters. Thedataargument must point to aau_qctrl_tstructure which will be set to the current kernel audit queue control parameters. See theA_SETQCTLsection above for more information. πA_GETFSIZEβ Returns the maximum size of the audit log file. Thedataargument must point to aau_fstat_tstructure. Theaf_fileszfield will be set to the maximum audit log file size. A value of0indicates no limit to the size. Theaf_currszfield will be set to the current audit log file size. πA_GETCWDβ ReturnENOSYS. (Not implemented.) πA_GETCARβ ReturnENOSYS. (Not implemented.) πA_GETSTATβ ReturnENOSYS. (Not implemented.) πA_GETCONDβ Return the current auditing condition. Thedataargument must point to anintvalue which will be set to the current audit condition, one ofAUC_AUDITING,AUC_NOAUDITorAUC_DISABLED. See theA_SETCONDsection above for more information. π§A_SENDTRIGGERβ okay bestie, this one sends a trigger straight to the audit daemon π . Thedataargument has to point to anintvalue set to one of these acceptable trigger values:AUDIT_TRIGGER_LOW_SPACEβ low disk space where the audit log resides.AUDIT_TRIGGER_OPEN_NEWβ open a new audit log file.AUDIT_TRIGGER_READ_FILEβ read theaudit_controlfile.AUDIT_TRIGGER_CLOSE_AND_DIEβ close the current log file and exit.AUDIT_TRIGGER_NO_SPACEβ no disk space left for audit log file.AUDIT_TRIGGER_ROTATE_USERβ request audit log file rotation.AUDIT_TRIGGER_INITIALIZEβ initialize audit subsystem for Mac OS X only.AUDIT_TRIGGER_EXPIRE_TRAILSβ request audit log file expiration.
π RETURN VALUES π
When everything goes off without a hitch, you get 0. Iconic β¨. Otherwise you get -1, and the global variable errno is set to indicate the error. Not the slay we wanted, but at least it tells you what happened π.
π ERRORS π
The auditon() function will fail if:
[ENOSYS]β returned by options not yet implemented. Basically: not today, bestie π« .[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. Permission check said absolutely not π .
Heads up: the A_SENDTRIGGER command is specific to the FreeBSD and Mac OS X implementations, and is not present in Solaris. So don't go looking for it there, bestie πΈ.
π SEE ALSO π
Go read these next, 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. Little glow-up moment, honestly β¨.
π 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>.
Debian π January 29, 2009 β that's the source/version and date, bestie. Mwah, go audit something cute ππ
π¦ where this page comes from
- nixos 26.05: openbsm 1.1
- nixpkgs unstable: openbsm 1.1
- 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-1017 on : a language model's rewrite of the original, under its terms