Bug 1071505 - SELinux is preventing /usr/sbin/collectd from 'write' accesses on the sock_file libvirt-sock-ro.
Summary: SELinux is preventing /usr/sbin/collectd from 'write' accesses on the sock_fi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 20
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:ed2f1f1619351972cb2aca733eb...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-01 03:45 UTC by Andrew Cooks
Modified: 2014-04-09 13:21 UTC (History)
7 users (show)

Fixed In Version: selinux-policy-3.12.1-149.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-09 13:21:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Andrew Cooks 2014-03-01 03:45:15 UTC
Description of problem:
# yum install collectd.x86_64
# systemctl start collectd.service
# systemctl status collectd.service
SELinux is preventing /usr/sbin/collectd from 'write' accesses on the sock_file libvirt-sock-ro.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that collectd should be allowed write access on the libvirt-sock-ro sock_file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep collectd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:collectd_t:s0
Target Context                system_u:object_r:virt_var_run_t:s0
Target Objects                libvirt-sock-ro [ sock_file ]
Source                        collectd
Source Path                   /usr/sbin/collectd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           collectd-5.4.1-1.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-122.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.13.4-200.fc20.x86_64 #1 SMP Thu
                              Feb 20 23:00:47 UTC 2014 x86_64 x86_64
Alert Count                   4
First Seen                    2014-03-01 11:36:55 WST
Last Seen                     2014-03-01 11:39:14 WST
Local ID                      fecbd39b-e838-40bb-ae71-08acc8b38924

Raw Audit Messages
type=AVC msg=audit(1393645154.655:1460): avc:  denied  { write } for  pid=3416 comm="collectd" name="libvirt-sock-ro" dev="tmpfs" ino=22162 scontext=system_u:system_r:collectd_t:s0 tcontext=system_u:object_r:virt_var_run_t:s0 tclass=sock_file


type=AVC msg=audit(1393645154.655:1460): avc:  denied  { connectto } for  pid=3416 comm="collectd" path="/run/libvirt/libvirt-sock-ro" scontext=system_u:system_r:collectd_t:s0 tcontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tclass=unix_stream_socket


type=SYSCALL msg=audit(1393645154.655:1460): arch=x86_64 syscall=connect success=yes exit=0 a0=5 a1=7f338dc66790 a2=6e a3=21 items=0 ppid=1 pid=3416 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=collectd exe=/usr/sbin/collectd subj=system_u:system_r:collectd_t:s0 key=(null)

Hash: collectd,collectd_t,virt_var_run_t,sock_file,write

Additional info:
reporter:       libreport-2.1.12
hashmarkername: setroubleshoot
kernel:         3.13.4-200.fc20.x86_64
type:           libreport

Comment 1 Daniel Walsh 2014-03-03 16:25:01 UTC
Is collectd supposed to connect to libvirt?

Comment 2 Andrew Cooks 2014-03-03 23:12:41 UTC
I believe the libvirt plugin[1] for collectd, installed by the collectd-virt package[2] is causing the violation. (I specifically installed collectd-virt; it wasn't pulled in as a collectd dependency).

My first guess is that it doesn't need write access and if it does it should open /run/libvirt/libvirt-sock instead of /run/libvirt/libvirt-sock-ro [3].

Since this bug report should be for the collectd-virt package, not collectd or selinux-policy, so I'm changing the "component" from selinux-policy to the closest matching thing: collectd.

1. https://collectd.org/wiki/index.php/Plugin:libvirt
2. https://apps.fedoraproject.org/packages/collectd-virt
3. http://libvirt.org/guide/html/Application_Development_Guide-Architecture-Transports.html

Comment 3 Ruben Kerkhof 2014-03-04 11:14:34 UTC
In reply to comment #1

The libvirt plugin for collectd sends commands to the ro socket using the libvirt api. Those are just read-only commands from a libvirt point of view, but it still needs to be able to write to the socket. Can this be adjusted in the policy?

Comment 4 Daniel Walsh 2014-03-16 22:25:32 UTC
commit 3ff85522ee22c61c6d24700037b864dc69f4634f
 fixes this in git.

Comment 5 Fedora Update System 2014-03-31 14:05:01 UTC
selinux-policy-3.12.1-149.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-149.fc20

Comment 6 Fedora Update System 2014-04-02 09:03:10 UTC
Package selinux-policy-3.12.1-149.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-149.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-4604/selinux-policy-3.12.1-149.fc20
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-04-09 13:21:28 UTC
selinux-policy-3.12.1-149.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


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