AUDIT_ADD_RULE_DATA(3)
π AUDIT_ADD_RULE_DATA π
okay bestie, so this one lives in the Linux Audit API section of the manual (section 3, the library-calls girlies π«Ά), and it's literally the moment your handcrafted audit rule finally gets yeeted into the kernel. let's get into it.
β¨ NAME β¨
audit_add_rule_data β add a brand new audit rule. that's it. that's the vibe. π
πΈ SYNOPSIS πΈ
#include <libaudit.h>
int audit_add_rule_data(int fd, struct audit_rule_data *rule, int flags, int action);
π¦ DESCRIPTION π¦
so here's the tea: audit_add_rule_data takes an audit rule that you already built with audit_rule_fieldpair_data(3) and drops it into one of the kernel's several event filters. which filter tho?? that's decided by the fd file descriptor and the flags argument. periodt.
the possible values for flags are giving very much menu-of-destiny:
AUDIT_FILTER_USERβ apply the rule to userspace generated messages. this is the user filter. normally all user space originating events are accepted, and rules on this filter are typically written to block specific events. π«AUDIT_FILTER_TASKβ apply the rule at task creation (not syscall). this is the task filter. it's normally used to exclude an application from being audited. πAUDIT_FILTER_EXITβ apply the rule at syscall exit. this is the main filter, the one used for syscalls and filesystem watches. normally all syscalls do not trigger events, so this is normally used to specify the events that are actually of interest. main character filter fr fr πAUDIT_FILTER_EXCLUDEβ apply the rule ataudit_log_start. this is the exclude filter, which discards any records that match. the action type is ignored for this filter and defaults to"never". πAUDIT_FILTER_FSβ apply the rule when addingPATHauxiliary records toSYSCALLevents. this is the filesystem filter, used to ignorePATHrecords that are not of interest. π§
and the rule's action? only two possible values, no more no less:
AUDIT_NEVERβ do not build context if the rule matches. πAUDIT_ALWAYSβ generate an audit record if the rule matches. π₯
β RETURN VALUE β
the return value is <= 0 on error. otherwise? it's the netlink sequence id number. and ngl this function can have any error that sendto would encounter β so whatever sendto is going through, she's going through too. π
π SEE ALSO π
audit_rule_fieldpair_data(3)audit_delete_rule_data(3)auditctl(8)
π AUTHOR π
Steve Grubb. ty for your service king π«Ά
and that's a wrap bestie!! this page came to you courtesy of Red Hat, dated Aug 2009 β yes she's an elder but she's still iconic, no cap. β¨ππ¦
π¦ where this page comes from
- alpine 3.23: audit-doc 4.1.2-r2 Β· LGPL-2.1-or-later
- alpine 3.24: audit-doc 4.1.2-r6 Β· LGPL-2.1-or-later
- arch rolling: audit 4.2.1-1 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- centos-stream 10: audit-libs-devel 4.2.1-3.el10 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.1.1-2.fc43 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.1.1-2.fc43 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.2.1-1.fc43 Β· LGPL-2.0-or-later
- fedora 43: audit-libs-devel 4.2.1-1.fc43 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.1.4-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.1.4-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.2.1-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: audit-libs-devel 4.2.1-1.fc44 Β· LGPL-2.0-or-later
- nixpkgs unstable: audit 4.2.1
- ubuntu resolute: libaudit-dev 1:4.1.2-1build1 Β· GPL-2.0-only
- ubuntu resolute: libaudit-dev 1:4.1.2-1ubuntu0.1 Β· GPL-2.0-only
- ubuntu stonking: libaudit-dev 1:4.1.2-1ubuntu1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms