DTRACE_AUDIT(4)

๐Ÿ“ฆ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

๐Ÿ’– dtrace_audit: tracing audit(4) events like a main character ๐Ÿ’–

okay so this is the DTRACE_AUDIT(4) page from the Kernel Interfaces Manual, and it's all about the dtaudit DTrace provider. bestie, it's giving kernel-audit realness and I'm obsessed. ๐Ÿฆ‹


๐ŸŒธ NAME ๐ŸŒธ

  • dtrace_audit โ€” a DTrace provider for tracing audit(4) events, and yes that's the whole vibe. ๐Ÿ’…

โœจ SYNOPSIS โœจ

audit:event:aue_*:commit(char *eventname, struct audit_record *ar);

audit:event:aue_*:bsm(char *eventname, struct audit_record *ar,
           const void *, size_t);

To compile this module into the kernel, place the following in your kernel configuration file:

options DTAUDIT

Alternatively, to load the module at boot time, place the following line in loader.conf(5):

dtaudit_load="YES"

๐Ÿ’… DESCRIPTION ๐Ÿ’…

okay so the dtaudit provider is literally a DTrace provider that lets you trace events in the kernel security auditing subsystem, audit(4). ๐ŸŽ€ audit(4) is the whole detailed-logging situation: it logs a configurable set of security-relevant system calls, including key arguments (such as file paths) and return values that are copied race-free as the system call proceeds. iconic behavior, honestly.

The dtaudit provider allows DTrace scripts to selectively enable in-kernel audit-record capture for system calls, and then access those records in either the in-kernel format or BSM format (audit.log(5)) when the system call completes. While the in-kernel audit record data structure is subject to change as the kernel changes over time, it is a much more friendly interface for use in D scripts than either those available via the DTrace system-call provider or the BSM trail itself. the way that's lowkey the whole point ๐Ÿ˜Œ

๐Ÿ› ๏ธ Configuration

The dtaudit provider relies on audit(4) being compiled into the kernel. Full stop, bestie. โœจ Its probes become available only once there is an event-to-name mapping installed in the kernel, normally done by auditd(8) during the boot process, if audit is enabled in rc.conf(5):

auditd_enable="YES"

If dtaudit probes are required earlier in boot -- for example, in single-user mode -- or without enabling audit(4), they can be preloaded in the boot loader by adding this line to loader.conf(5):

audit_event_load="YES"

๐Ÿ”ฎ Probes

  • The audit:event:aue_*:commit() probes fire synchronously during system-call return, giving access to two arguments: a char * audit event name, and the struct audit_record * in-kernel audit record. Because the probe fires in system-call return, the user thread has not yet regained control, and additional information from the thread and process remains available for capture by the script. literally still in the room, iykyk ๐Ÿ‘‘
  • The audit:event:aue_*:bsm() probes fire asynchronously from system-call return, following BSM conversion and just prior to being written to disk, giving access to four arguments: a char * audit event name, the struct audit_record * in-kernel audit record, a const void * pointer to the converted BSM record, and a size_t for the length of the BSM record. four-argument main character energy ๐Ÿซถ

๐Ÿง  IMPLEMENTATION NOTES ๐Ÿง 

When a set of dtaudit probes are registered, corresponding in-kernel audit records will be captured and their probes will fire regardless of whether the audit(4) subsystem itself would have captured the record for the purposes of writing it to the audit trail, or for delivery to a auditpipe(4). In-kernel audit records allocated only because of enabled dtaudit(4) probes will not be unnecessarily written to the audit trail or enabled pipes. no extra mess, no cap ๐Ÿ’€


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€


๐Ÿ“œ HISTORY ๐Ÿ“œ

The dtaudit provider first appeared in FreeBSD 12.0. periodt ๐ŸŒˆ


๐Ÿซถ AUTHORS ๐Ÿซถ

So the lore: this software and this manual page were developed by BAE Systems, the University of Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL contract (FA8650-15-C-7558) (โ€œCADETSโ€), as part of the DARPA Transparent Computing (TC) research program. And the dtaudit provider plus this manual page were written by Robert Watson <rwatson@FreeBSD.org>. ate, honestly ๐Ÿ’–


๐Ÿ’€ BUGS ๐Ÿ’€

  • Because audit(4) maintains its primary event-to-name mapping database in userspace, that database must be loaded into the kernel before dtaudit probes become available. so load it first, bestie ๐Ÿ™ˆ
  • Also, dtaudit is only able to provide access to system-call audit events, not the full scope of userspace events, such as those relating to login, password change, and so on. not me wanting userspace events too ๐Ÿ˜ญ

xoxo, your resident Unix girl signing off from the Debian build of DTRACE_AUDIT(4), dated April 28, 2019 ๐Ÿ’–๐Ÿซถ๐ŸŽ€

๐Ÿ“ฆ where this page comes from