AUDIT(2)

πŸ“¦
version 1.1 Β· 2 versions
, in nixos 26.05, nixpkgs unstable

✨ AUDIT(2) ✨

okay so bestie, this is the AUDIT(2) manual page, and it's literally about one tiny but iconic system call that handles getting your BSM audit records into the audit log. it's giving "main character energy" for security nerds πŸ’…


🌸 NAME 🌸

audit β€” commit BSM audit record to audit log

so like, this is the function that's all about submitting audit records, no cap.


πŸŽ€ SYNOPSIS πŸŽ€

#include <bsm/audit.h>

int
audit(const char *record, u_int length);

πŸ¦‹ DESCRIPTION πŸ¦‹

The audit() system call submits a completed BSM audit record to the system audit log. that's literally its whole job and it does it slayfully ✨

The record argument is a pointer to the specific event to be recorded, and length is the size in bytes of the data to be written. so you're like, "here's my event, here's how big it is," and the kernel takes it from there. periodt πŸ’–


πŸ’œ 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. so like, zero means success and negative one means "oop something went wrong, check errno bestie" 😭


πŸ”₯ ERRORS πŸ”₯

The audit() system call will fail and the data never written if:

  • [EFAULT] β€” The record argument is beyond the allocated address space of the process. like your pointer is literally out here in the void, not valid, and the kernel is not having it πŸ™ˆ
  • [EINVAL] β€” The token ID is invalid or length is larger than MAXAUDITDATA. so either your token is sus or your length is doing too much πŸ’€
  • [EPERM] β€” The process does not have sufficient permission to complete the operation. permission denied, you don't have the range, sorry not sorry 🫢

🌈 SEE ALSO 🌈

all the besties that hang out with audit() in the same friend group πŸ’–


🧚 HISTORY 🧚

The OpenBSM implementation was created by McAfee Research, the security division of McAfee Inc., under contract to Apple Computer Inc. in 2004. iconic behavior honestly. It was subsequently adopted by the TrustedBSD Project as the foundation for the OpenBSM distribution. so like, one project passed the torch to another and it's giving collaboration goals ✨


πŸ‘‘ 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. legendary contributors, no cap πŸ’œ

The Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems. they really said "let there be audit events" and it was so πŸŽ€

This manual page was written by Tom Rhodes <trhodes@FreeBSD.org>. thank you for your service bestie 🫢


πŸ’€ BUGS πŸ’€

The FreeBSD kernel does not fully validate that the argument passed is syntactically valid BSM. Submitting invalid audit records may corrupt the audit log. so like, the kernel is lowkey trusting you to not send garbage, and if you do, your audit log might get messed up and that's genuinely not the vibe 😭 be careful out here fr fr

this is a real warning bestie β€” invalid records can literally corrupt the audit log, so don't test your luck πŸ’…

so yeah, that's the whole AUDIT(2) situation. this page is from Debian, dated April 19, 2005, and it's giving classic Unix documentation energy with a side of security realness. stay safe, validate your BSM, and slay βœ¨πŸ’–πŸŽ€

πŸ“¦ where this page comes from