Fedora Account System
Red Hat Associate
Red Hat Customer
/usr/sbin/ausearch -ts yesterday -i |grep denied returns "<no matches>" since audit-3.1.1-1.fc37.x86_64 installed & log rotated. Is this version keeping the wrong log file open? lsof says not. Reproducible: Always Steps to Reproduce: 1. Try /usr/sbin/ausearch -ts yesterday -i |grep denied within a cron script (FAILS!) 2. Try /usr/sbin/ausearch -ts yesterday -i |grep denied as root succeeds 3. There are selinux denied events. Actual Results: <no matches> Expected Results: Same as I get running as root.
ausearch prefers input from pipes if stdin is a pipe. In cron scripts stdin/out/err are pipes. So, it mistakenly waits for something on stdin. The fix is to use --input-logs so that it overrides the normal behavior. This behavior has been in place for at least the last 15 years.
How is stdin suddenly a pipe? (A change to cron?) "This behaviour has been in place for at least the last 15 years." ^^^^^^^^^ Sadly that is not true. This happened with audit-3.1.1-1.fc37.x86_64 So someone obviously fixed the bug that had it broken (from the way you thought it worked) for the last 15 years. Otherwise why has it worked for me for the last 15 years? (in cron scripts?) Maybe it's another of the things that has affected cron recently (selinux limits). In any case --input-logs does now allow it to work again as it did last week in a cron script without that option!
Glad it's working for you now. No idea why it worked for you. The --input-logs is specifically to be used for cron jobs. You can see here people were asking questions about this 15 years ago: https://listman.redhat.com/archives/linux-audit/2008-May/005276.html I think we can close this.
This is not in "redhat" it's in fedora. Maybe it coincided with moving it from cron.daily to a discrete cron job? Ok please close...
It might be the result of switching from cron.daily to something else. I also have no idea if running it from a systemd timer would change things either. In any event, it is working so I'll close this report. If you run into other problems with ausearch/cron, feel free to re-open.