Bug 862564
Summary: | SELinux is preventing /usr/bin/qemu-kvm from create access on the rawip_socket . | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Carlos Soriano <carlos.soriano89> |
Component: | selinux-policy-targeted | Assignee: | Miroslav Grepl <mgrepl> |
Status: | CLOSED NEXTRELEASE | QA Contact: | Ben Levenson <benl> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 17 | CC: | amit.shah, berrange, cfergeau, crobinso, dominick.grift, dwalsh, dwmw2, eiler.mike, eparis, itamar, knoel, mgrepl, pbonzini, pmoore, rjones, scottt.tw, virt-maint |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-07-04 06:53:46 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
Carlos Soriano
2012-10-03 08:52:50 UTC
Could you attach AVC msgs which you are getting in permissive mode? Thank you. Carlos why does qemu needs to send rawip? I have the same problem :(... @Daniel: Even the ping-command uses rawip-sockets and this is an essential tool for a network administrator and also developers. nice regards ______________ SELinux is preventing /usr/bin/qemu-kvm from create access on the rawip_socket . ***** Plugin catchall (100. confidence) suggests *************************** If you believe that qemu-kvm should be allowed create access on the rawip_socket 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 qemu-kvm /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp Additional Information: Source Context system_u:system_r:svirt_t:s0:c30,c485 Target Context system_u:system_r:svirt_t:s0:c30,c485 Target Objects [ rawip_socket ] Source qemu-kvm Source Path /usr/bin/qemu-kvm Port <Unknown> Host michabook Source RPM Packages qemu-system-x86-1.0.1-2.fc17.x86_64 Target RPM Packages Policy RPM selinux-policy-3.10.0-156.fc17.noarch Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Host Name michabook Platform Linux michabook 3.6.2-4.fc17.x86_64 #1 SMP Wed Oct 17 02:43:21 UTC 2012 x86_64 x86_64 Alert Count 4 First Seen 2012-10-24 23:17:56 CEST Last Seen 2012-10-24 23:18:11 CEST Local ID c0eee08b-d628-46f1-9315-194a600f1ff1 Raw Audit Messages type=AVC msg=audit(1351113491.730:176): avc: denied { create } for pid=11072 comm="qemu-kvm" scontext=system_u:system_r:svirt_t:s0:c30,c485 tcontext=system_u:system_r:svirt_t:s0:c30,c485 tclass=rawip_socket type=SYSCALL msg=audit(1351113491.730:176): arch=x86_64 syscall=socket success=no exit=EACCES a0=2 a1=80002 a2=1 a3=a8 items=0 ppid=1 pid=11072 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 tty=(none) ses=2 comm=qemu-kvm exe=/usr/bin/qemu-kvm subj=system_u:system_r:svirt_t:s0:c30,c485 key=(null) Hash: qemu-kvm,svirt_t,svirt_t,rawip_socket,create audit2allow #============= svirt_t ============== allow svirt_t self:rawip_socket create; audit2allow -R #============= svirt_t ============== allow svirt_t self:rawip_socket create; I see that there's a virt_use_rawip boolean nowadays. Is rawip sufficiently dangerous that we can't just allow it by default? usermode networking aka slirp uses rawip for ping AIUI. boxes uses usermode networking by default. rawip means that a confined domain could watch all of the traffic coming out of the box, I believe we should not allow it by default. I think this is a dangerous access for a confined virtual machine. We can change QEMU to use IPPROTO_ICMP. Would IPPROTO_ICMP be also powerful enough that we cannot enable it by default? And/or would it need a separate boolean? Paolo Not sure what IPPROTO_ICMP is? Basically anything that allows a confined domain to look at rawouput from the ethernet device or able to generate rawip trafic is going to be blocked, if we could get a separate app that qemu could execute which we allowed rawip, like ping or something, that might solve the problem. I don't know what access you are trying to implement. I have added Eric Paris and Paul Moore to the CC to see if they have opinions. > We can change QEMU to use IPPROTO_ICMP.
>
> Would IPPROTO_ICMP be also powerful enough that we cannot enable it by
> default? And/or would it need a separate boolean?
What is QEMU using these sockets for ?
Looking quickly at the upstream QEMU sources, there appears to be a socket() call in slirp/ip_icmp.c which could be the source of this AVC: 81: so->s = qemu_socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP); In this case qemu_socket(...) is defined in util/osdep.c and is a simple wrapper to socket(). With the current SELinux code, any socket created as AF_INET[6] SOCK_DGRAM socket that is created with a non-default protocol (IPPROTO_ICMP is not the default protocol for SOCK_DGRAM) will appear as a rawip_socket in SELinux. I suspect the AVC is the result of the people running QEMU with the usermode networking stack. Although libguestfs allows people to enable SLIRP in qemu, it's not the default and is fairly unusual. Also we wouldn't expect ICMP to work in any case, because libguestfs normally runs as non-root. (ie. only TCP connections and the like are expected to work). > With the current SELinux code, any socket created as AF_INET[6] SOCK_DGRAM
> socket that is created with a non-default protocol (IPPROTO_ICMP is not the
> default protocol for SOCK_DGRAM) will appear as a rawip_socket in SELinux.
Ok, that explains it.
So the question then is what to do with this bug? Is it a bug in the kernel? qemu? Or do we just go with the boolean. F18 has #============= svirt_t ============== #!!!! This avc can be allowed using the boolean 'virt_use_rawip' allow svirt_t self:rawip_socket create; (In reply to comment #13) > Is it a bug in the kernel? No. At least I don't consider it a bug. > qemu? No. QEMU is a bit "odd" as far as applications go in that it does unusual things; this is just one case of its unusual behavior. > Or do we just go with the boolean. That seems reasonable to me. Perhaps we can make setroubleshoot more intelligent about this particular AVC? F18 setroubleshoot would say. ***** Plugin catchall_boolean (89.3 confidence) suggests ******************* If you want to allow confined virtual guests to interact with rawip sockets Then you must tell SELinux about this by enabling the 'virt_use_rawip' boolean. You can read 'virt_selinux' man page for more details. Do setsebool -P virt_use_rawip 1 As long as the virt_selinux manpage makes some reference to usermode networking in conjunction with the virt_use_rawip boolean I think we are okay. Unfortunately I just checked the virt_selinux manpage on my Rawhide system and didn't see any reference of the virt_use_rawip boolean. man svirt_selinux will be there in the next build. This message is a reminder that Fedora 17 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 17. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '17'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 17's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 17 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 17's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. |