linux-audit / audit-kernel

GitHub mirror of the Linux Kernel's audit repository
https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git
Other
137 stars 36 forks source link

BUG: inconsistent audit rule processing when adding/removing rules #128

Closed weiyuchen closed 3 years ago

weiyuchen commented 3 years ago

I'd like to discribe the problem I encounter. If I start a bash(ex: pid 1396) before auditd (ex: pid 1427) , then I clear the audit rules with auditctl -D and add one single rule like -w /tmp/test -p wa -k mmm, after that I use the bash (pid 1396) to operate the file /tmp/test, (ex: echo xxx > /tmp/test), I can't get any audit log about this event. but if I start a new bash (ex: pid 1444) and execute the same command (ex: echo dddd > /tmp/test), I can get the normal audit log. I've analysis the logic of auditd, it seems that this kind of situation can't be logged, but in some emmbeded and other situations, some bash processes started earlier than auditd, which results in some commands (ex: echo xxx > xxx) audit logs are missing.

pcmoore commented 3 years ago

... it seems that this kind of situation can't be logged, but in some emmbeded and other situations, some bash processes started earlier than auditd, which results in some commands (ex: echo xxx > xxx) audit logs are missing.

As you've realized, there is a performance optimization where tasks started with auditing disabled do not regain auditing functionality once auditing is re-enabled. If your goal is to always have auditing enabled you should consider adding "audit=1" to the kernel command line.

Please let us know how this works for you.

weiyuchen commented 3 years ago

I've test on my environment, it works well~ thx

pcmoore commented 3 years ago

Glad you got it working, closing this issue.