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 921094 - Missing auditing for serial, parallel, channel, console and smartcard devices
Summary: Missing auditing for serial, parallel, channel, console and smartcard devices
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-13 13:20 UTC by Daniel Berrangé
Modified: 2016-04-26 15:38 UTC (History)
8 users (show)

Fixed In Version: libvirt-1.2.7-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:20:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description Daniel Berrangé 2013-03-13 13:20:17 UTC
Description of problem:
The current code for auditing devices on guest startup does not deal with serial, parallel, console, channel, or smartcard devices, because these were all out of scope for the initial security certification. We should aim to have 100% coverage for auditing of all devices which utilize host resources. Thus we should add auditing for these last devices.

Version-Release number of selected component (if applicable):
libvirt-1.0.3-1.el7

How reproducible:
Always

Steps to Reproduce:
1.Configure a guest with parallel, serial, console, channel and smartcard devices pointing to some host resource

2. Look fir VIRT_RESOURCE in /var/log/audit/audit.log
3.
  
Actual results:
No audit records for paralle, serial, console, channel & smartcard devices.

Expected results:


Additional info:

Comment 2 zhenfeng wang 2013-06-03 08:55:26 UTC
Hi Eric
will this issue be solved in rhel6.4 ,do we have necessary to clone one to rhel6.4, thanks

Comment 3 Eric Blake 2013-06-03 16:24:49 UTC
(In reply to zhenfeng wang from comment #2)
> Hi Eric
> will this issue be solved in rhel6.4 ,do we have necessary to clone one to
> rhel6.4, thanks

It is probably too invasive to backport fixes for this to RHEL 6.4.z; I'm not even sure it is worth doing for RHEL 6.5 if there is not a customer demand yet.  RHEL 7 seems sufficient for now.

Comment 5 Peter Krempa 2014-07-07 11:04:39 UTC
Fixed upstream:

commit 5bd3c73bdff0f26e7045f537ad8102138e25329d
Author: Peter Krempa <pkrempa>
Date:   Thu Jul 3 12:03:41 2014 +0200

    audit: Audit smartcard devices

commit 994cc314442fb299a6f1cb95af603908858a6b5b
Author: Peter Krempa <pkrempa>
Date:   Thu Jul 3 10:59:58 2014 +0200

    audit: Add auditing for serial/parallel/channel/console character devs
    
    Add startup auditing and also hotplug auditing for said devices.

$ git describe
v1.2.6-55-g5bd3c73

Comment 7 zhengqin 2014-08-29 07:21:13 UTC
Verify this issue with build  libvirt-1.2.7-2.el7:

Could get audit info from /var/log/audit/audit.log when add the specify device such as: smartcard into guest and start the guest.


Here is smartcard audit log info:
# grep VIRT_RESOURCE /var/log/audit/audit.log | grep -i smartcard
type=VIRT_RESOURCE msg=audit(1409289719.244:629): pid=1336 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=smartcard reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-smartcard="?" new-smartcard="nss-smartcard-device" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'

Comment 8 zhengqin 2014-08-29 07:24:20 UTC
Here is chardev (serial/parallel/channel/console) audit log info:
type=VIRT_RESOURCE msg=audit(1409040645.932:65415): pid=22013 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/3" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409193248.871:530): pid=1665 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/2" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409204305.503:794): pid=1665 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/2" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409278657.815:1768): pid=32115 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/3" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409284235.822:587): pid=1463 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/2" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409284573.383:615): pid=1463 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/2" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409287726.947:667): pid=1463 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=attach vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/3" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=failed'
type=VIRT_RESOURCE msg=audit(1409289539.321:601): pid=1336 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/2" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409289796.037:645): pid=1336 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/2" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409289796.037:646): pid=1336 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/tty58" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409291240.084:567): pid=1492 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409291240.084:568): pid=1492 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/tty58" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409291583.598:629): pid=1492 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409291682.065:651): pid=1492 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409291707.522:671): pid=1492 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409291745.781:692): pid=1492 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409292939.818:564): pid=1324 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409293143.627:589): pid=1324 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409295602.404:766): pid=7250 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409295869.429:874): pid=8027 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409296035.291:878): pid=8027 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=attach vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/4" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=failed'
type=VIRT_RESOURCE msg=audit(1409296144.831:935): pid=8553 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1409296172.012:939): pid=8553 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=attach vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/4" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=failed'
type=VIRT_RESOURCE msg=audit(1409296261.960:984): pid=8553 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="rhel7_B" uuid=7110154c-4f3e-4ea1-876f-07dc36ff4eaa old-chardev="?" new-chardev="/dev/pts/1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'

Comment 9 Luyao Huang 2014-11-28 07:24:36 UTC
Verify this bug with libvirt-1.2.8-9.el7.x86_64

1.start guest with console device

    <console type='unix'>
      <source mode='bind' path='/tmp/foo'/>
      <target type='serial' port='1'/>
    </console>

and can find log in audit.log

# tailf /var/log/audit/audit.log
type=VIRT_RESOURCE msg=audit(1417157551.023:31773): pid=18461 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="test3" uuid=7347d748-f7ce-448f-8d49-3d29c9bcac30 old-chardev="?" new-chardev="/tmp/foo" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'

2.start guest with serial device

    <serial type='pty'>
      <source path='/dev/pts/7'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>


# tailf /var/log/audit/audit.log
type=VIRT_RESOURCE msg=audit(1417157971.668:31841): pid=18461 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="test3" uuid=7347d748-f7ce-448f-8d49-3d29c9bcac30 old-chardev="?" new-chardev="/dev/pts/7" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'

3.start guest with channel device

    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/r6.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='8'/>
    </channel>


# tailf /var/log/audit/audit.log
type=VIRT_RESOURCE msg=audit(1417157971.668:31842): pid=18461 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=chardev reason=start vm="test3" uuid=7347d748-f7ce-448f-8d49-3d29c9bcac30 old-chardev="?" new-chardev="/var/lib/libvirt/qemu/r6.agent" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'

4.try to start guest with smartcard

    <smartcard mode='passthrough' type='spicevmc'>
      <address type='ccid' controller='0' slot='0'/>
    </smartcard>
    <smartcard mode='host-certificates'>
      <certificate>cert1</certificate>
      <certificate>cert2</certificate>
      <certificate>cert3</certificate>
      <database>/etc/pki/nssdb/</database>
      <address type='ccid' controller='0' slot='1'/>
    </smartcard>


type=VIRT_RESOURCE msg=audit(1417158840.095:32051): pid=18461 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=smartcard reason=start vm="test3" uuid=7347d748-f7ce-448f-8d49-3d29c9bcac30 old-smartcard="?" new-smartcard="cert1" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'
type=VIRT_RESOURCE msg=audit(1417158840.095:32052): pid=18461 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm resrc=smartcard reason=start vm="test3" uuid=7347d748-f7ce-448f-8d49-3d29c9bcac30 old-smartcard="?" new-smartcard="cert2" exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=success'

5.because rhel7 qemu doesn't use parallel now. so check the code:

852     for (i = 0; i < vm->def->nparallels; i++)
853         virDomainAuditChardev(vm, NULL, vm->def->parallels[i], "start", true);


6.check the doc:



362         <dl><dt>reason</dt><dd>The reason which caused the resource to be assigned to happen</dd><dt>resrc</dt><dd>The type of resource assigned. Set to <code>rng</code></dd><dt>old-rng</dt><dd>Original path     of the host entropy source for the RNG</dd><dt>new-rng</dt><dd>Updated path of the host entropy source for the RNG</dd></dl>
363         <h4>
364           <a name="typeresourcechardev" shape="rect" id="typeresourcechardev">console/serial/parallel/channel</a>
365           <a class="headerlink" href="#typeresourcechardev" title="Permalink to this headline">¶</a>
366         </h4>
367         <p>
368       The <code>msg</code> field will include the following sub-fields
369     </p>
370         <dl><dt>reason</dt><dd>The reason which caused the resource to be assigned to happen</dd><dt>resrc</dt><dd>The type of resource assigned. Set to <code>chardev</code></dd><dt>old-chardev</dt><dd>Origi    nal path of the backing character device for given emulated device</dd><dt>new-chardev</dt><dd>Updated path of the backing character device for given emulated device</dd></dl>
371         <h4>
372           <a name="typeresourcesmartcard" shape="rect" id="typeresourcesmartcard">smartcard</a>
373           <a class="headerlink" href="#typeresourcesmartcard" title="Permalink to this headline">¶</a>
374         </h4>
375         <p>
376       The <code>msg</code> field will include the following sub-fields
377     </p>
378         <dl><dt>reason</dt><dd>The reason which caused the resource to be assigned to happen</dd><dt>resrc</dt><dd>The type of resource assigned. Set to <code>smartcard</code></dd><dt>old-smartcard</dt><dd>O    riginal path of the backing character device, certificate store or
379           "nss-smartcard-device" for host smartcard passthrough.
380       </dd><dt>new-smartcard</dt><dd>Updated path of the backing character device, certificate store or
381           "nss-smartcard-device" for host smartcard passthrough.

Comment 11 errata-xmlrpc 2015-03-05 07:20:05 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/RHSA-2015-0323.html


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