Improve audit events handling in avc check #3562
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When troubleshooting ausearch --checkpoint failing tests in certain environments, I've observed changes in avc check behaviour when many events are being created for processing. For example
sshd
from tmt ssh connections orsudo
usage.I haven't found a way a better check to find if all events are 'synced' before running ausearch commands, so I'm parsing
auditctl -s
output, which includes: "backlog field tells how many event records are currently queued waiting for auditd to read them" and make sure it is 0 before proceeding.Unfortunatelly that's not enough to make it work reliably.
Using
--just-one
was a bad idea as ausearch always starts from beginning of the log, with no way to start with the last one. Redirecting stdout to /dev/null seems to be just as fast.I've also tried to get the event id with
tail -1 audit.log
, and useauseach -a $id
, but that also didn't solve race conditions(I think) that arise from running all this through ssh. Neither does various --format and --escape options...or any other options for that matter.Using
-ts checkpoint
is ultimately the only way I've found in this sunk-cost-fallacy-rabbit-black-hole. Well, unless we want to have dedicated log file for just avc failures, just for the duration of the test.Needs tests and I'm not quite happy with the bash script and report. Would mark is as draft, but that would not trigger pipelines.
Pull Request Checklist