Bug 902438

Summary: SELinux is preventing /usr/bin/ovs-appctl from 'write' accesses on the file ovsdb-server.pid.
Product: [Fedora] Fedora Reporter: Ian Pilcher <ipilcher>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:cca00114e8fd169bf891974842e11756ed62a25a956d901f261fb3dd446f75b7
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-25 21:46:14 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:

Description Ian Pilcher 2013-01-21 16:54:26 UTC
Description of problem:
logrotate cron job
SELinux is preventing /usr/bin/ovs-appctl from 'write' accesses on the file ovsdb-server.pid.

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

If you believe that ovs-appctl should be allowed write access on the ovsdb-server.pid 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 ovs-appctl /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:logrotate_t:s0-s0:c0.c1023
Target Context                system_u:object_r:openvswitch_var_run_t:s0
Target Objects                ovsdb-server.pid [ file ]
Source                        ovs-appctl
Source Path                   /usr/bin/ovs-appctl
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           openvswitch-1.7.1-6.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-71.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.7.2-201.fc18.x86_64 #1 SMP Fri
                              Jan 11 22:16:23 UTC 2013 x86_64 x86_64
Alert Count                   2
First Seen                    2013-01-20 03:36:06 CST
Last Seen                     2013-01-20 03:36:06 CST
Local ID                      c9ad048f-08e7-46e0-9670-eeee6a8f4156

Raw Audit Messages
type=AVC msg=audit(1358674566.712:2584): avc:  denied  { write } for  pid=25804 comm="ovs-appctl" name="ovsdb-server.pid" dev="tmpfs" ino=21213 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:openvswitch_var_run_t:s0 tclass=file


type=SYSCALL msg=audit(1358674566.712:2584): arch=x86_64 syscall=open success=no exit=EACCES a0=1d3b080 a1=2 a2=1b6 a3=238 items=0 ppid=25802 pid=25804 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=215 tty=(none) comm=ovs-appctl exe=/usr/bin/ovs-appctl subj=system_u:system_r:logrotate_t:s0-s0:c0.c1023 key=(null)

Hash: ovs-appctl,logrotate_t,openvswitch_var_run_t,file,write

audit2allow

#============= logrotate_t ==============
allow logrotate_t openvswitch_var_run_t:file write;

audit2allow -R

#============= logrotate_t ==============
allow logrotate_t openvswitch_var_run_t:file write;


Additional info:
hashmarkername: setroubleshoot
kernel:         3.7.2-201.fc18.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-01-21 22:46:20 UTC
If you execute

# chcon -t openvswitch_exec_t PATHTO/ovs-appctl

does it work then?

Comment 2 Ian Pilcher 2013-01-21 23:03:23 UTC
I have changed the context of /usr/bin/ovs-appctl to openvswitch_exec_t and the following command does not generate any AVCs:

  /usr/sbin/logrotate /etc/logrotate.conf

However, I don't believe that this is a good test, because logrotate is presumably running unconfined when I start it from a shell.  I tried to use runcon to run it as logrotate_t, but I was unable to figure out how to do so.

Comment 3 Fedora Update System 2013-01-21 23:36:46 UTC
selinux-policy-3.11.1-73.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-73.fc18

Comment 4 Miroslav Grepl 2013-01-22 14:08:11 UTC
Try 

# runcon -u system_u -r system_r -t initrc_t -- runcon -t crond_t -- runcon -t logrotate_t -- /usr/sbin/logrotate /etc/logrotate.conf

Comment 5 Fedora Update System 2013-01-23 01:58:43 UTC
Package selinux-policy-3.11.1-73.fc18:
* should fix your issue,
* was pushed to the Fedora 18 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.11.1-73.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-1272/selinux-policy-3.11.1-73.fc18
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2013-01-25 21:46:16 UTC
selinux-policy-3.11.1-73.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.