Bug 921094
| Summary: | Missing auditing for serial, parallel, channel, console and smartcard devices | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Daniel Berrangé <berrange> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.0 | CC: | cwei, dyuan, eblake, lhuang, mzhan, rbalakri, ydu, zhwang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.7-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-03-05 07:20:05 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Daniel Berrangé
2013-03-13 13:20:17 UTC
Hi Eric will this issue be solved in rhel6.4 ,do we have necessary to clone one to rhel6.4, thanks (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. 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
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' 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' 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.
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 |