Bug 648553
Summary: | SELinux is preventing /usr/bin/spice-vdagent "write" access on spice-vdagent-sock | |||
---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Hans de Goede <hdegoede> | |
Component: | selinux-policy-targeted | Assignee: | Miroslav Grepl <mgrepl> | |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Ben Levenson <benl> | |
Severity: | medium | Docs Contact: | ||
Priority: | low | |||
Version: | 14 | CC: | dwalsh | |
Target Milestone: | --- | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | Bug Fix | ||
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 682416 (view as bug list) | Environment: | ||
Last Closed: | 2011-05-27 08:00:01 UTC | Type: | --- | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | ||||
Bug Blocks: | 682416, 737790 |
Description
Hans de Goede
2010-11-01 16:04:28 UTC
Where can I get the package? (In reply to comment #1) > Where can I get the package? Hi, I assume you mean the spice-vdagent package, there is a .src.rpm here: http://people.fedoraproject.org/~jwrdegoede/spice-vdagent-0.6.3-1.fc14.src.rpm I can do a scratch build for you if you want. Note though that spice-vdagentd will quit as soon as you connect to it with a spice-vdagent per session process as it then tries to connect to /dev/virtio-ports/com.redhat.spice.0, which is only available when you're running a qemu virtual machine with spice as display (rather then vnc or sdl). If you want I can give you some short instructions on howto setup such a virtual machine under F-14. Thanks & Regards, Hans Miroslav can you look into writing policy for spice-vdagent? Yes, it is my plan. > > If you want I can give you some short instructions on howto setup such a > virtual machine under F-14. Hi Hans, it would be fine. Thanks. > Thanks & Regards, > > Hans To get a spice virtual machine take an F-14 virtual machine disk image and start it with qemu from the cmdline something like this: qemu-kvm -enable-kvm -cpu host -m 1024 -name F14 \ -drive file=/mnt/virt_images/f14.img,if=virtio,media=disk \ -net nic,macaddr=52:54:00:7a:b4:7d,vlan=0,model=virtio,name=virtio.0 -net user,vlan=0 \ -vga qxl -spice port=5931,disable-ticketing \ -device virtio-serial -device spicevmc,subtype=vdagent Then you can connect with spice client like this (after yum install spice-client): spicec -h localhost -p 5931 Then you can install spice-vdagent inside the guest, and see it in action (it has a daemon started by /etc/init.d/spice-vdagentd, and a per x session agent /usr/bin/spice-vdagent which gets auto started under gdm and a regular gnome session). Great, it works and I am seeing AVC messages :^) Thanks. Hans, could you do the following changes /var/run/spice-vdagentd.pid file move to /var/run/spice-vdagentd directory and /var/log/spice-vdagentd.log move to /var/log/spice-vdagentd directrory. The reason is simple. We will have the label for these dirs in the policy and dirs/files, which will be created in these dirs, will get the proper label always (the label is derived from the parent directory). Then you can add additional sock files, log files and the label will be correct and we won't need to change labeling in the policy. I have done a scratch build with the spice-vdagent policy for testing http://koji.fedoraproject.org/koji/taskinfo?taskID=2609677 Hi Miroslav, Thanks for working on this! I've done a scratch build of spice-vdagent moving the log and pid files to the requested directories: http://koji.fedoraproject.org/koji/taskinfo?taskID=2610995 I've also given your scratchbuild policy a try, but it won't work in enforcing mode. In permissive move I get the following AVC's : type=USER_AVC msg=audit(1290165541.460:140): user pid=877 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: denied { send_msg } for msgtype=method_call interface=org.freedesktop.ConsoleKit.Manager member=GetSeats dest=org.freedesktop.ConsoleKit spid=3294 tpid=938 scontext=unconfined_u:system_r:vdagent_t:s0 tcontext=system_u:system_r:consolekit_t:s0-s0:c0.c1023 tclass=dbus : exe="/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?' type=USER_AVC msg=audit(1290165541.461:141): user pid=877 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: denied { send_msg } for msgtype=method_return dest=:1.131 spid=938 tpid=3294 scontext=system_u:system_r:consolekit_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:vdagent_t:s0 tclass=dbus : exe="/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?' type=AVC msg=audit(1290165726.316:142): avc: denied { read write } for pid=3294 comm="spice-vdagentd" name="vport0p1" dev=devtmpfs ino=10208 scontext=unconfined_u:system_r:vdagent_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file type=AVC msg=audit(1290165726.316:142): avc: denied { open } for pid=3294 comm="spice-vdagentd" name="vport0p1" dev=devtmpfs ino=10208 scontext=unconfined_u:system_r:vdagent_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file type=SYSCALL msg=audit(1290165726.316:142): arch=c000003e syscall=2 success=yes exit=8 a0=405810 a1=2 a2=0 a3=0 items=0 ppid=1 pid=3294 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4 comm="spice-vdagentd" exe="/usr/sbin/spice-vdagentd" subj=unconfined_u:system_r:vdagent_t:s0 key=(null) type=AVC msg=audit(1290165748.509:146): avc: denied { read write } for pid=3294 comm="spice-vdagentd" name="vport0p1" dev=devtmpfs ino=10208 scontext=unconfined_u:system_r:vdagent_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file type=AVC msg=audit(1290165748.509:146): avc: denied { open } for pid=3294 comm="spice-vdagentd" name="vport0p1" dev=devtmpfs ino=10208 scontext=unconfined_u:system_r:vdagent_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file type=SYSCALL msg=audit(1290165748.509:146): arch=c000003e syscall=2 success=yes exit=8 a0=405810 a1=2 a2=0 a3=0 items=0 ppid=1 pid=3294 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4 comm="spice-vdagentd" exe="/usr/sbin/spice-vdagentd" subj=unconfined_u:system_r:vdagent_t:s0 key=(null) type=AVC msg=audit(1290165764.521:156): avc: denied { read write } for pid=3294 comm="spice-vdagentd" name="vport0p1" dev=devtmpfs ino=10208 scontext=unconfined_u:system_r:vdagent_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file type=AVC msg=audit(1290165764.521:156): avc: denied { open } for pid=3294 comm="spice-vdagentd" name="vport0p1" dev=devtmpfs ino=10208 scontext=unconfined_u:system_r:vdagent_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file type=SYSCALL msg=audit(1290165764.521:156): arch=c000003e syscall=2 success=yes exit=9 a0=405810 a1=2 a2=0 a3=0 items=0 ppid=1 pid=3294 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4 comm="spice-vdagentd" exe="/usr/sbin/spice-vdagentd" subj=unconfined_u:system_r:vdagent_t:s0 key=(null) Also I noticed that spice-vdagent (the agent not the daemon) is not running in its own context. If possible (not sure if it needs its own context for that) I would like to see connecting to /var/run/spice-vdagentd/spice-vdagent-sock or to unix domain sockets with a context of unconfined_u:object_r:vdagent_var_run_t:s0 only be allowed by /usr/bin/spice-vdagent . Note that /usr/bin/spice-vdagent does not need to be restricted in any way. Thanks & Regards, Hans (In reply to comment #10) > Hi Miroslav, > > Thanks for working on this! > > I've done a scratch build of spice-vdagent moving the log and pid files to the > requested directories: > http://koji.fedoraproject.org/koji/taskinfo?taskID=2610995 Great. > > I've also given your scratchbuild policy a try, but it won't work in enforcing > mode. In permissive move I get the following AVC's : Thanks for testing. Just try to execute # restorecon -R -v /dev/vport0p1 Should fix some AVC messages. > > Also I noticed that spice-vdagent (the agent not the daemon) is not running in > its own context. If possible (not sure if it needs its own context for that) I > would like to see connecting to /var/run/spice-vdagentd/spice-vdagent-sock or > to unix domain sockets with a context of > unconfined_u:object_r:vdagent_var_run_t:s0 only be allowed by > /usr/bin/spice-vdagent . Note that /usr/bin/spice-vdagent does not need to be > restricted in any way. Yes, you are right. It is running in xdm_t domain and this domain is allowed to connect to /var/run/spice-vdagentd/spice-vdagent-sock. I will look at it. > Thanks & Regards, > > Hans I have just tested it with your scratch build and it works fine for me. I am going to do a new selinux-policy scratch build for you. (In reply to comment #12) > I have just tested it with your scratch build and it works fine for me. I am > going to do a new selinux-policy scratch build for you. http://koji.fedoraproject.org/koji/taskinfo?taskID=2617091 (In reply to comment #13) > (In reply to comment #12) > > I have just tested it with your scratch build and it works fine for me. I am > > going to do a new selinux-policy scratch build for you. > > http://koji.fedoraproject.org/koji/taskinfo?taskID=2617091 Thanks, looks pretty good, but I still get these 2 avc's in permissive mode (and a non working spice-vdagentd in enforcing mode): type=USER_AVC msg=audit(1290459948.245:23): user pid=859 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: denied { send_msg } for msgtype=method_call interface=org.freedesktop.ConsoleKit.Manager member=GetSeats dest=org.freedesktop.ConsoleKit spid=1601 tpid=1005 scontext=unconfined_u:system_r:vdagent_t:s0 tcontext=system_u:system_r:consolekit_t:s0-s0:c0.c1023 tclass=dbus : exe="/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?' type=USER_AVC msg=audit(1290459948.246:24): user pid=859 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: denied { send_msg } for msgtype=method_return dest=:1.58 spid=1005 tpid=1601 scontext=system_u:system_r:consolekit_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:vdagent_t:s0 tclass=dbus : exe="/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?' Oops, sorry about that. I did the build with the wrong patch. To make sure it works with these rules execute # grep vdagent /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp Then should work. Miroslav is this in the current policy? |