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 1349691 - [Bug][RHEL7] audit logs are appearing in "/var/log/dmesg"
Summary: [Bug][RHEL7] audit logs are appearing in "/var/log/dmesg"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: audit
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Steve Grubb
QA Contact: Ondrej Moriš
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-24 02:11 UTC by Muhammad Azhar Shaikh
Modified: 2021-06-10 11:22 UTC (History)
4 users (show)

Fixed In Version: audit-2.6.1-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 06:13:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2418 0 normal SHIPPED_LIVE audit bug fix and enhancement update 2016-11-03 13:58:32 UTC

Description Muhammad Azhar Shaikh 2016-06-24 02:11:53 UTC
Description of problem:
Receiving additional audit log in "/var/log/dmesg".
Also, audit logs are appearing when "dmesg" command is run.
Plus, same thing occurs after running "service auditd stop".



Version-Release number of selected component (if applicable):
# rpm -q kernel audit systemd rsyslog
kernel-3.10.0-123.el7.x86_64
kernel-3.10.0-327.18.2.el7.x86_64
audit-2.4.1-5.el7.x86_64
systemd-219-19.el7_2.9.x86_64
rsyslog-7.4.7-12.el7.x86_64



How reproducible:
[root@rhel72 ~]# mkdir /etc/test

[root@rhel72 ~]# vi /etc/audit/rules.d/audit.rules 

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

[root@rhel72 ~]# auditctl -l
-w /etc/test/ -p rwxa -k test

[root@rhel72 ~]# touch /etc/test/t1

[root@rhel72 ~]# tail /var/log/messages 
Jun 24 07:23:38 rhel72 auditd[4849]: Init complete, auditd 2.4.1 listening for events (startup state enable)
Jun 24 07:23:38 rhel72 augenrules: No rules
Jun 24 07:23:38 rhel72 augenrules: enabled 1
Jun 24 07:23:38 rhel72 augenrules: flag 1
Jun 24 07:23:38 rhel72 augenrules: pid 4849
Jun 24 07:23:38 rhel72 augenrules: rate_limit 0
Jun 24 07:23:38 rhel72 augenrules: backlog_limit 320
Jun 24 07:23:38 rhel72 augenrules: lost 0
Jun 24 07:23:38 rhel72 augenrules: backlog 1
Jun 24 07:23:38 rhel72 systemd: Started Security Auditing Service.


[root@rhel72 ~]# tail /var/log/audit/audit.log 
type=SYSCALL msg=audit(1466733227.832:449): arch=c000003e syscall=2 success=yes exit=3 a0=7ffe71b13788 a1=941 a2=1b6 a3=7ffe71b11750 items=2 ppid=3738 pid=5000 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="touch" exe="/usr/bin/touch" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
type=CWD msg=audit(1466733227.832:449):  cwd="/root"
type=PATH msg=audit(1466733227.832:449): item=0 name="/etc/test/" inode=17266110 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=PARENT
type=PATH msg=audit(1466733227.832:449): item=1 name="/etc/test/t1" inode=17277924 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=CREATE
type=SYSCALL msg=audit(1466733236.244:450): arch=c000003e syscall=257 success=yes exit=3 a0=ffffffffffffff9c a1=15e76c0 a2=90800 a3=0 items=1 ppid=3738 pid=5007 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="ls" exe="/usr/bin/ls" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
type=CWD msg=audit(1466733236.244:450):  cwd="/root"
type=PATH msg=audit(1466733236.244:450): item=0 name="/etc/test/" inode=17266110 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=NORMAL
type=SYSCALL msg=audit(1466733236.244:451): arch=c000003e syscall=191 success=no exit=-61 a0=7ffd2095cb50 a1=7f98f08f9114 a2=7ffd2095cb10 a3=14 items=1 ppid=3738 pid=5007 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="ls" exe="/usr/bin/ls" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
type=CWD msg=audit(1466733236.244:451):  cwd="/root"
type=PATH msg=audit(1466733236.244:451): item=0 name="/etc/test/t1" inode=17277924 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=NORMAL



[root@rhel72 ~]# tail /var/log/dmesg
[    2.669106] intel_rapl: no valid rapl domains found in package 0
[    2.682137] snd_hda_codec_generic hdaudioC0D0: autoconfig for ID 22: line_outs=1 (0x3/0x0/0x0/0x0/0x0) type:line
[    2.682140] snd_hda_codec_generic hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.682142] snd_hda_codec_generic hdaudioC0D0:    hp_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.682144] snd_hda_codec_generic hdaudioC0D0:    mono: mono_out=0x0
[    2.682145] snd_hda_codec_generic hdaudioC0D0:    inputs:
[    2.682146] snd_hda_codec_generic hdaudioC0D0:      Line=0x5
[    2.764124] XFS (vda1): Ending clean mount
[    2.764134] SELinux: initialized (dev vda1, type xfs), uses xattr
[    2.847801] type=1305 audit(1466732821.470:4): audit_pid=620 old=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:auditd_t:s0 res=1


[root@rhel72 ~]# touch /etc/test/t2

[root@rhel72 ~]# touch /etc/test/t3

[root@rhel72 ~]# tail /var/log/dmesg
[    2.669106] intel_rapl: no valid rapl domains found in package 0
[    2.682137] snd_hda_codec_generic hdaudioC0D0: autoconfig for ID 22: line_outs=1 (0x3/0x0/0x0/0x0/0x0) type:line
[    2.682140] snd_hda_codec_generic hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.682142] snd_hda_codec_generic hdaudioC0D0:    hp_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.682144] snd_hda_codec_generic hdaudioC0D0:    mono: mono_out=0x0
[    2.682145] snd_hda_codec_generic hdaudioC0D0:    inputs:
[    2.682146] snd_hda_codec_generic hdaudioC0D0:      Line=0x5
[    2.764124] XFS (vda1): Ending clean mount
[    2.764134] SELinux: initialized (dev vda1, type xfs), uses xattr
[    2.847801] type=1305 audit(1466732821.470:4): audit_pid=620 old=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:auditd_t:s0 res=1


[root@rhel72 ~]# service auditd stop
Stopping logging:                                          [  OK  ]

[root@rhel72 ~]# touch /etc/test/t4


[root@rhel72 ~]# touch /etc/test/t5


[root@rhel72 ~]# touch /etc/test/t6


[root@rhel72 ~]# tail /var/log/audit/audit.log 
type=PATH msg=audit(1466733236.244:451): item=0 name="/etc/test/t1" inode=17277924 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=NORMAL
type=SYSCALL msg=audit(1466733288.707:452): arch=c000003e syscall=2 success=yes exit=3 a0=7fff6117e788 a1=941 a2=1b6 a3=7fff6117d2c0 items=2 ppid=3738 pid=5033 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="touch" exe="/usr/bin/touch" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
type=CWD msg=audit(1466733288.707:452):  cwd="/root"
type=PATH msg=audit(1466733288.707:452): item=0 name="/etc/test/" inode=17266110 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=PARENT
type=PATH msg=audit(1466733288.707:452): item=1 name="/etc/test/t2" inode=17277925 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=CREATE
type=SYSCALL msg=audit(1466733290.801:453): arch=c000003e syscall=2 success=yes exit=3 a0=7ffd55d3f788 a1=941 a2=1b6 a3=7ffd55d3d3f0 items=2 ppid=3738 pid=5034 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="touch" exe="/usr/bin/touch" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
type=CWD msg=audit(1466733290.801:453):  cwd="/root"
type=PATH msg=audit(1466733290.801:453): item=0 name="/etc/test/" inode=17266110 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=PARENT
type=PATH msg=audit(1466733290.801:453): item=1 name="/etc/test/t3" inode=17277936 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=CREATE
type=DAEMON_END msg=audit(1466733536.354:3730): auditd normal halt, sending auid=1000 pid=5079 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 res=success


[root@rhel72 ~]# tail /var/log/messages 
Jun 24 07:29:04 rhel72 kernel: type=1300 audit(1466733544.425:456): arch=c000003e syscall=2 success=yes exit=3 a0=7fff661ac788 a1=941 a2=1b6 a3=7fff661abb50 items=2 ppid=3738 pid=5100 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="touch" exe="/usr/bin/touch" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
Jun 24 07:29:04 rhel72 kernel: type=1307 audit(1466733544.425:456):  cwd="/root"
Jun 24 07:29:04 rhel72 kernel: type=1302 audit(1466733544.425:456): item=0 name="/etc/test/" inode=17266110 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=PARENT
Jun 24 07:29:04 rhel72 kernel: type=1302 audit(1466733544.425:456): item=1 name="/etc/test/t4" inode=17277938 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=CREATE
Jun 24 07:29:05 rhel72 kernel: type=1300 audit(1466733545.813:457): arch=c000003e syscall=2 success=yes exit=3 a0=7ffc61f27788 a1=941 a2=1b6 a3=7ffc61f257a0 items=2 ppid=3738 pid=5101 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="touch" exe="/usr/bin/touch" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
Jun 24 07:29:05 rhel72 kernel: type=1307 audit(1466733545.813:457):  cwd="/root"
Jun 24 07:29:05 rhel72 kernel: type=1302 audit(1466733545.813:457): item=0 name="/etc/test/" inode=17266110 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=PARENT
Jun 24 07:29:05 rhel72 kernel: type=1302 audit(1466733545.813:457): item=1 name="/etc/test/t5" inode=17277939 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=CREATE
Jun 24 07:29:08 rhel72 kernel: type=1300 audit(1466733548.045:458): arch=c000003e syscall=2 success=yes exit=3 a0=7ffeb62bd788 a1=941 a2=1b6 a3=7ffeb62bb180 items=2 ppid=3738 pid=5102 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="touch" exe="/usr/bin/touch" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
Jun 24 07:29:08 rhel72 kernel: type=1307 audit(1466733548.045:458):  cwd="/root"


[root@rhel72 ~]# tail /var/log/dmesg
[    2.669106] intel_rapl: no valid rapl domains found in package 0
[    2.682137] snd_hda_codec_generic hdaudioC0D0: autoconfig for ID 22: line_outs=1 (0x3/0x0/0x0/0x0/0x0) type:line
[    2.682140] snd_hda_codec_generic hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.682142] snd_hda_codec_generic hdaudioC0D0:    hp_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.682144] snd_hda_codec_generic hdaudioC0D0:    mono: mono_out=0x0
[    2.682145] snd_hda_codec_generic hdaudioC0D0:    inputs:
[    2.682146] snd_hda_codec_generic hdaudioC0D0:      Line=0x5
[    2.764124] XFS (vda1): Ending clean mount
[    2.764134] SELinux: initialized (dev vda1, type xfs), uses xattr
[    2.847801] type=1305 audit(1466732821.470:4): audit_pid=620 old=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:auditd_t:s0 res=1



[root@rhel72 ~]# dmesg
[  725.027018] type=1300 audit(1466733544.425:456): arch=c000003e syscall=2 success=yes exit=3 a0=7fff661ac788 a1=941 a2=1b6 a3=7fff661abb50 items=2 ppid=3738 pid=5100 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="touch" exe="/usr/bin/touch" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
[  725.027036] type=1307 audit(1466733544.425:456):  cwd="/root"
[  725.027057] type=1302 audit(1466733544.425:456): item=0 name="/etc/test/" inode=17266110 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=PARENT
[  725.027075] type=1302 audit(1466733544.425:456): item=1 name="/etc/test/t4" inode=17277938 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=CREATE
[  726.414728] type=1300 audit(1466733545.813:457): arch=c000003e syscall=2 success=yes exit=3 a0=7ffc61f27788 a1=941 a2=1b6 a3=7ffc61f257a0 items=2 ppid=3738 pid=5101 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="touch" exe="/usr/bin/touch" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
[  726.414746] type=1307 audit(1466733545.813:457):  cwd="/root"
[  726.414768] type=1302 audit(1466733545.813:457): item=0 name="/etc/test/" inode=17266110 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=PARENT
[  726.414784] type=1302 audit(1466733545.813:457): item=1 name="/etc/test/t5" inode=17277939 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:etc_t:s0 objtype=CREATE
[  728.646975] type=1300 audit(1466733548.045:458): arch=c000003e syscall=2 success=yes exit=3 a0=7ffeb62bd788 a1=941 a2=1b6 a3=7ffeb62bb180 items=2 ppid=3738 pid=5102 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="touch" exe="/usr/bin/touch" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="test"
[  728.646993] type=1307 audit(1466733548.045:458):  cwd="/root"
[  782.048031] audit_printk_skb: 6 callbacks suppressed




Expected results:
- When auditd service is running audit logs should only be redirected to"/var/log/audit/audit.log"

- When auditd service is stopped audit logs should only be redirected to "/var/log/messages"

- None of the audit logs should be redirected to "/var/log/dmesg" or via "dmesg" command.




Additional info:
Fedora 22 "Systemd" bug
https://bugzilla.redhat.com/show_bug.cgi?id=1227379

Comment 2 Lukáš Nykrýn 2016-06-27 11:30:25 UTC
That fedora bug was about journal reading the kernel message directly. We don't do that in rhel https://github.com/lnykryn/systemd-rhel/commit/5dee07f71ccaf8eacd115e01e665c645f7c3a75d

These are just normal log messages from audit daemon.

Comment 3 Muhammad Azhar Shaikh 2016-06-28 03:24:20 UTC
>> These are just normal log messages from audit daemon.

Why are these messages going to "var/log/dmesg"?


Do we have any workaround or mitigation steps to stop logging of normal log messages from audit daemon into "/var/log/dmesg"?

Comment 4 Lukáš Nykrýn 2016-06-28 07:37:23 UTC
No, we need to store logs somewhere during the boot and disk might not be available at that point of time (for example in initrd). So we store those messages in kmsg.

Comment 5 Steve Grubb 2016-06-28 16:59:51 UTC
I think we have an explained condition.

[    2.847801] type=1305 audit(1466732821.470:4): audit_pid=620 old=0

This is caused by audit being active and no audit daemon running. The event is t
he audit daemon registering itself with the kernel.

# service auditd stop
Stopping logging:                                          [  OK  ]

This leaves the audit rules enabled unless configured properly. To disable the audit rules on exit, copy the auditd.service file to the right plan in /etc and uncomment:
#ExecStopPost=/sbin/auditctl -D

That will delete audit rules when it shuts down.

Comment 6 Steve Grubb 2016-06-29 12:27:13 UTC
audit-2.6.1-1.el7 should address this problem. The new package contains audit-stop.rules file which contains rules to disable the audit subsystem and delete all rules. This should put an end to any events except AVC's and seccomp violations. It will not be enabled by default, but it can easily be configured by copying it to /etc/systemd/system and uncommenting the ExecStopPost line.

Comment 8 Ondrej Moriš 2016-09-04 11:14:10 UTC
Successfully verified with audit-2.6.5-3.el7.

# rpm -q audit
audit-2.6.5-3.el7.x86_64

# grep ExecStopPost /usr/lib/systemd/system/auditd.service 
#ExecStopPost=/sbin/auditctl -R /etc/audit/audit-stop.rules

# auditctl -w /etc/test/ -p rwxa -k test

# auditctl -l
-w /etc/test -p rwxa -k test

# service auditd stop
Stopping logging: [  OK  ]

# auditctl -l
-w /etc/test -p rwxa -k test

# emacs /usr/lib/systemd/system/auditd.service
...

# grep ExecStopPost /usr/lib/systemd/system/auditd.service 
ExecStopPost=/sbin/auditctl -R /etc/audit/audit-stop.rules

# systemctl daemon-reload

# service auditd start
Redirecting to /bin/systemctl start  auditd.service

# auditctl -l
-w /etc/test -p rwxa -k test

# service auditd stop
Stopping logging: [  OK  ]

# auditctl -l
No rules

Comment 10 errata-xmlrpc 2016-11-04 06:13: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://rhn.redhat.com/errata/RHBA-2016-2418.html


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