AUDITPIPE(4)
π NAME π
okay so bestie, welcome to the kernel interfaces manual page for auditpipe(4) β the pseudo-device for live audit event tracking. no cap, that's the whole name, and it's lowkey iconic. β¨
β¨ SYNOPSIS β¨
options AUDIT
πΈ DESCRIPTION πΈ
okay so let's talk about why this exists. audit trail files are generated with audit(4) and maintained by auditd(8), and they're a reliable long-term store for audit log info. slay for archival. but the current log files are owned by the audit daemon until it terminates, which makes them somewhat unwieldy for live monitoring apps like host-based intrusion detection. for example: the log may be cycled and new records written to a new file without notice to apps that may be accessing the file. rude, honestly. π
The audit facility provides an audit pipe facility for apps that require direct access to live BSM audit data for real-time monitoring. Audit pipes are available via a clonable special device, /dev/auditpipe, subject to the permissions on the device node, and they provide a "tee" of the audit event stream. Because the device is clonable, more than one instance may be opened at a time; each device instance will provide independent access to all records. it's giving multiple tabs but for kernel audit. π¦
The audit pipe device provides discrete BSM audit records; if the read buffer passed by the application is too small to hold the next record in the sequence, it will be dropped. Unlike audit data written to the audit trail, the reliability of record delivery is not guaranteed. In particular, when an audit pipe queue fills, records will be dropped. Audit pipe devices are blocking by default, but they support non-blocking I/O, asynchronous I/O using SIGIO, and polled operation via select(2) and poll(2). yes bestie, all the I/O vibes. π
β οΈ warning, bestie: record delivery is not guaranteed. when the queue fills, records get dropped. that's the drama. π
Applications may choose to track the global audit trail, or configure local preselection parameters independent of the global audit trail parameters. choose your own adventure, basically. π
π Audit Pipe Queue Ioctls π
The following ioctls retrieve and set various audit pipe record queue properties:
AUDITPIPE_GET_QLENβ query the current number of records available for reading on the pipe. peek at the queue, basically. πAUDITPIPE_GET_QLIMITβ retrieve the current maximum number of records that may be queued for reading on the pipe.AUDITPIPE_SET_QLIMITβ set the current maximum number of records that may be queued for reading on the pipe. the new limit must fall between the queue limit minimum and queue limit maximum queryable using the following two ioctls. yes, min and max have their own ioctls, we love a boundary check. π«ΆAUDITPIPE_GET_QLIMIT_MINβ query the lowest possible maximum number of records that may be queued for reading on the pipe.AUDITPIPE_GET_QLIMIT_MAXβ query the highest possible maximum number of records that may be queued for reading on the pipe.AUDITPIPE_FLUSHβ flush all outstanding records on the audit pipe; useful after setting initial preselection properties to delete records queued during the configuration process which may not match the interests of the user process. basically a reset button for your queue. π§ΉAUDITPIPE_GET_MAXAUDITDATAβ query the maximum size of an audit record, which is a useful minimum size for a user space buffer intended to hold audit records read from the audit pipe. size matters, etc. π
π Audit Pipe Preselection Mode Ioctls π
By default, the audit pipe facility configures pipes to present records matched by the system-wide audit trail, configured by auditd(8). However, the preselection mechanism for audit pipes can be configured using alternative criteria, including pipe-local flags and naflags settings, as well as auid-specific selection masks. This allows applications to track events not captured in the global audit trail, as well as limit records presented to those of specific interest to the application. it's giving custom feed energy. π
The following ioctls configure the preselection mode on an audit pipe:
AUDITPIPE_GET_PRESELECT_MODEβ return the current preselect mode on the audit pipe. the ioctl argument should be of typeint.AUDITPIPE_SET_PRESELECT_MODEβ set the current preselection mode on the audit pipe. the ioctl argument should be of typeint.
Possible preselection mode values are:
AUDITPIPE_PRESELECT_MODE_TRAILβ use the global audit trail preselection parameters to select records for the audit pipe.AUDITPIPE_PRESELECT_MODE_LOCALβ use local audit pipe preselection; this model is similar to the global audit trail configuration model, consisting of globalflagsandnaflagsparameters, as well as a set of per-auid masks. these parameters are configured using further ioctls. lowkey a whole ecosystem. π±
After changing the audit pipe preselection mode, records selected under earlier preselection configuration may still be in the audit pipe queue. The application may flush the current record queue after changing the configuration to remove possibly undesired records. so yeah, flush after you switch, bestie. πΏ
π Audit Pipe Local Preselection Mode Ioctls π
The following ioctls configure the preselection parameters used when an audit pipe is configured for the AUDITPIPE_PRESELECT_MODE_LOCAL preselection mode.
AUDITPIPE_GET_PRESELECT_FLAGSβ retrieve the current default preselection flags for attributable events on the pipe. these flags correspond to theflagsfield inaudit_control(5). the ioctl argument should be of typeau_mask_t.AUDITPIPE_SET_PRESELECT_FLAGSβ set the current default preselection flags for attributable events on the pipe. these flags correspond to theflagsfield inaudit_control(5). the ioctl argument should be of typeau_mask_t.AUDITPIPE_GET_PRESELECT_NAFLAGSβ retrieve the current default preselection flags for non-attributable events on the pipe. these flags correspond to thenaflagsfield inaudit_control(5). the ioctl argument should be of typeau_mask_t.AUDITPIPE_SET_PRESELECT_NAFLAGSβ set the current default preselection flags for non-attributable events on the pipe. these flags correspond to thenaflagsfield inaudit_control(5). the ioctl argument should be of typeau_mask_t.AUDITPIPE_GET_PRESELECT_AUIDβ query the current preselection masks for a specific auid on the pipe. the ioctl argument should be of typestruct auditpipe_ioctl_preselect. the auid to query is specified via theap_auidfield of typeau_id_t; the mask will be returned viaap_maskof typeau_mask_t.AUDITPIPE_SET_PRESELECT_AUIDβ set the current preselection masks for a specific auid on the pipe. arguments are identical toAUDITPIPE_GET_PRESELECT_AUID, except that the caller should properly initialize theap_maskfield to hold the desired preselection mask.AUDITPIPE_DELETE_PRESELECT_AUIDβ delete the current preselection mask for a specific auid on the pipe. once called, events associated with the specified auid will use the default flags mask. the ioctl argument should be of typeau_id_t.AUDITPIPE_FLUSH_PRESELECT_AUIDβ delete all auid specific preselection specifications. bye-bye, custom masks. π
π¦ EXAMPLES π¦
The praudit(1) utility may be directly executed on /dev/auditpipe to review the default audit trail. yup, just point it at the device. π
π SEE ALSO π
π§ 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. history lesson, but make it fashion. π
Support for kernel audit first appeared in FreeBSD 6.2. periodt. π
π AUTHORS π
The audit pipe facility was designed and implemented by Robert Watson <rwatson@FreeBSD.org>. absolute legend behavior. π
The Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems. respect. π
π BUGS π
See the audit(4) manual page for information on audit-related bugs and limitations. not gonna duplicate the lore here. π
The configurable preselection mechanism mirrors the selection model present for the global audit trail. It might be desirable to provide a more flexible selection model. honestly, a glow-up could be cute. π
The per-pipe audit event queue is fifo, with drops occurring if either the user thread provides in sufficient [buffer] for the record on the queue head, or on enqueue if there is insufficient room. It might be desirable to support partial reads of records, which would be more compatible with buffered I/O as implemented in system libraries, and to allow applications to select which records are dropped, possibly in the style of preselection. so yeah: fifo, drops, and dreams of partial reads. π
π source/version vibes: Debian, dated April 28, 2019, and the manual page is AUDITPIPE(4). that's the whole thing, bestie β go track some live audit events and slay. π«Άβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2006 Robert N. M. Watson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms