RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1382397 - write_logs option is not correctly handled
Summary: write_logs option is not correctly handled
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: audit
Version: 7.3
Hardware: All
OS: Linux
urgent
high
Target Milestone: rc
: ---
Assignee: Steve Grubb
QA Contact: Ondrej Moriš
URL: https://fedorahosted.org/audit/change...
Whiteboard:
Depends On:
Blocks: 1415724
TreeView+ depends on / blocked
 
Reported: 2016-10-06 14:43 UTC by Ondrej Moriš
Modified: 2020-09-10 09:50 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1415724 (view as bug list)
Environment:
Last Closed: 2017-08-01 20:53:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:2008 0 normal SHIPPED_LIVE audit bug fix update 2017-08-01 18:34:07 UTC

Description Ondrej Moriš 2016-10-06 14:43:41 UTC
Description of problem:

According to man page AUDITD.CONF(5):

       write_logs
              This  yes/no  keyword  determines whether or not to write logs to
              the disk.  Normally you want this so the default is yes.

       log_format
              The log format describes how the information should be stored on
              disk... The NOLOG option is now deprecated. If you were setting
              this format, now you should set the write_logs option to no.

I would assume that NOLOG <=> "do not write anything to audit log" and since write_logs = no <=> log_format = NOLOG (deprecated), I expect that I cannot see audit event in the log. But this is not the case.

Version-Release number of selected component (if applicable):

audit-2.6.5-3.el7

How reproducible:

100%

Steps to Reproduce:

1. Configure auditd not to write logs to disk (write_logs = no).
2. Restart the service.
3. Log something (eg. auditctl -m "TEST").
4. See /var/log/audit/audit.log.

Actual results:

# grep write_logs /etc/audit/auditd.conf
write_logs = no

# service auditd restart
Stopping logging:                                          [  OK  ]
Redirecting start to /bin/systemctl start auditd.service

# date
Thu Oct  6 10:37:22 EDT 2016

# auditctl -m "TEST"

# ausearch -ts 10:37:22 -m USER
----
time->Thu Oct  6 10:37:33 2016
type=USER msg=audit(1475764653.692:288): pid=14663 uid=0 auid=0 ses=4 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='TEST exe="/usr/sbin/auditctl" hostname=? addr=? terminal=pts/0 res=success'

# grep TEST /var/log/audit/audit.log 
type=USER msg=audit(1475764653.692:288): pid=14663 uid=0 auid=0 ses=4 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='TEST exe="/usr/sbin/auditctl" hostname=? addr=? terminal=pts/0 res=success'

Expected results:

Actually I am not sure, does auditd have some internal cache/buffer for events searched by ausearch? Or should auditd just ignore or throw away the events?

Additional info:

From what I see in the code [1] only events of type AUDIT_DAEMON_RECONFIG and AUDIT_DAEMON_ROTATE are respecting the write_log option.

[1] https://github.com/linux-audit/audit-userspace/blob/3f2668e10b32547d9d2b40879bc06a88e41cf206/src/auditd-event.c#L484

Comment 1 Steve Grubb 2016-10-09 18:24:56 UTC
Fixed in upstream commit 1399.

Comment 5 Steve Grubb 2016-12-07 13:30:00 UTC
If this gets fixed on z-stream, we also want commit 1421.

Comment 7 Steve Grubb 2017-01-20 16:09:28 UTC
The file audit-2.7-write-log.patch has been applied to the srpm.

Comment 11 Ondrej Moriš 2017-04-26 10:54:09 UTC
Successfully reproduced and verified.

OLD (audit-2.6.5-3.el7)
=======================
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: log_format = NOLOG
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Command 'sed -i 's/^log_format.*/log_format = NOLOG/' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   FAIL   ] :: Command 'service auditd start && sleep 5' (Expected 0, got 1)
:: [   FAIL   ] :: Command 'service auditd status' (Expected 0, got 3)
:: [   PASS   ] :: Command 'auditctl -D' (Expected 0, got 0)
:: [   PASS   ] :: Command 'auditctl -a always,exit -W /tmp/tmp.WZcb8r1jmf -k NOLOG' (Expected 0, got 0)
:: [   PASS   ] :: Command 'cat /tmp/tmp.WZcb8r1jmf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'ausearch -ts 06:45:47 -m SYSCALL -k NOLOG --raw' (Expected 1, got 1)
:: [   PASS   ] :: Command 'auditctl -D' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd stop && sleep 5' (Expected 0, got 0)
:: [   LOG    ] :: Duration: 5s
:: [   LOG    ] :: Assertions: 7 good, 2 bad
:: [   FAIL   ] :: RESULT: log_format = NOLOG

NEW (audit-2.7.6-1.el7)
=======================
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: log_format = NOLOG
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Command 'sed -i 's/^log_format.*/log_format = NOLOG/' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd start && sleep 5' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd status' (Expected 0, got 0)
:: [   PASS   ] :: Command 'auditctl -D' (Expected 0, got 0)
:: [   PASS   ] :: Command 'auditctl -a always,exit -W /tmp/tmp.dsa2Na7XDn -k NOLOG' (Expected 0, got 0)
:: [   PASS   ] :: Command 'cat /tmp/tmp.dsa2Na7XDn' (Expected 0, got 0)
:: [   PASS   ] :: Command 'ausearch -ts 06:45:35 -m SYSCALL -k NOLOG --raw' (Expected 1, got 1)
:: [   PASS   ] :: Command 'auditctl -D' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd stop && sleep 5' (Expected 0, got 0)
:: [   LOG    ] :: Duration: 11s
:: [   LOG    ] :: Assertions: 9 good, 0 bad
:: [   PASS   ] :: RESULT: log_format = NOLOG

More details can be found in CR##15626918.

Comment 12 errata-xmlrpc 2017-08-01 20:53:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:2008


Note You need to log in before you can comment on or make changes to this bug.