AUDITPIPE(4)
β¨ AUDITPIPE(4) β¨ β from the Kernel Interfaces Manual, and yes it's giving very much kernel-girlie π
πΈ NAME πΈ
auditpipe β a pseudo-device for live audit event tracking. no cap, that's literally it π«Ά
π¦ SYNOPSIS π¦
options AUDIT
π DESCRIPTION π
Okay so, context first bestie. Audit trail files get generated by audit(4) and maintained by auditd(8), and they're genuinely a great long-term store for audit log info. Slay. But here's the thing β the current log files are owned by the audit daemon until it terminates, which makes them kinda unwieldy for live monitoring apps. Like, host-based intrusion detection? Those girlies need real-time access and the log file situation is just not it. For example, the log may be cycled and new records written to a new file without notice to applications that may be accessing the file. Rude honestly. π
So the audit facility says: don't worry bestie, I got you. It provides an audit pipe facility for applications that need direct access to live BSM audit data for real-time monitoring purposes. 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. And because the device is clonable, more than one instance of the device may be opened at a time β each device instance gives you independent access to all records. Independent! As in, your business is your business. π
The audit pipe device provides discrete BSM audit records. And here's the tea: 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. Specifically, when an audit pipe queue fills, records will be dropped. Periodt. π
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). Versatile queen.
Applications may choose to track the global audit trail, or configure local preselection parameters independent of the global audit trail parameters. Your pipe, your rules. π
π 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.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. Heads up: the new limit must fall between the queue limit minimum and queue limit maximum, which you can query using the following two ioctls.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. Lowkey the moment for this is right after you set your initial preselection properties, because you want to delete records queued during the configuration process that may not match the interests of the user process. Cleansing ritual β¨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, bestie π
π 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). But β plot twist β 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 lets applications track events not captured in the global audit trail, and limit records presented to just the ones that are of specific interest to the application. Curated 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-auidmasks. These parameters are configured using further ioctls.
Heads up bestie: 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. Old vibes linger, you gotta clear them out π
π 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 specificauidon the pipe. The ioctl argument should be of typestruct auditpipe_ioctl_preselect. Theauidto 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 specificauidon 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 specificauidon the pipe. Once called, events associated with the specifiedauidwill use the default flags mask. The ioctl argument should be of typeau_id_t.AUDITPIPE_FLUSH_PRESELECT_AUIDβ Delete allauidspecific preselection specifications. Full reset, we love to see it β¨
π EXAMPLES π
The praudit(1) utility may be directly executed on /dev/auditpipe to review the default audit trail. Cute, right? π
π SEE ALSO π
poll(2), select(2), audit(4), dtaudit(4), audit_control(5), audit(8), auditd(8)
π§ 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. Glow-up arc fr fr π
Support for kernel audit first appeared in FreeBSD 6.2.
π AUTHORS π
The audit pipe facility was designed and implemented by Robert Watson <rwatson@FreeBSD.org>. Iconic behavior. π«Ά
The Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems.
π BUGS π
See the audit(4) manual page for information on audit-related bugs and limitations. Not me redirecting you, but like, genuinely, go read it. π
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. (Lowkey a wishlist item, not a promise.)
The per-pipe audit event queue is fifo, with drops occurring if either the user thread provides in sufficient 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.
πΈ okay that's the whole page bestie, you ate π
This one's from the Debian crew, dated April 28, 2019 β AUDITPIPE(4), out. Stay audited, stay iconic. πβ¨
π¦ 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) 2006 Robert N. M. Watson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms