Bug 1125165 - EPEL7 package varnish is prohibited from starting
EPEL7 package varnish is prohibited from starting
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy (Show other bugs)
7.0
All Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Miroslav Grepl
Milos Malik
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-31 04:35 EDT by Ingvar Hagelund
Modified: 2015-03-05 05:42 EST (History)
2 users (show)

See Also:
Fixed In Version: selinux-policy-3.13.1-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-05 05:42:28 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ingvar Hagelund 2014-07-31 04:35:06 EDT
Description of problem:
Newly built EPEL7 package varnish-4.0.1-2.el7 is prohibited from starting by selinux. This was only tested on CentOS7, but I think the results would be the same on RHEL7.

Version-Release number of selected component (if applicable):
selinux-policy-3.12.1-153.el7_0.10.noarch

How reproducible:
Always

Steps to Reproduce:
1. Install varnish-4.0.1-2.el7

If not available on mirrors yet, the build is here: http://koji.fedoraproject.org/koji/buildinfo?buildID=549140

2. systemctl start varnish.service; systemctl status varnish.service
3. setenforce 0
4. systemctl start varnish.service; systemctl status varnish.service

Actual results:
Varnish does not start unless selinux enforcement is turned off

Expected results:
Varnish should be allowed to start


Additional info:

I think it's a bit strange I don't see this on f19. I haven't tested on f20 yet.

This is the culprit:

varnishd[20364]: Failed to set permissions on ./vcl.UdrgPE5O.so: Operation not permitted

sealert output:

[root@centos7 audit]# sealert -a audit.log
 38% done'list' object has no attribute 'split'
100% done
found 1 alerts in audit.log
--------------------------------------------------------------------------------

SELinux is preventing /usr/sbin/varnishd from using the fowner capability.

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

If you believe that varnishd should have the fowner capability 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 varnishd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp


Additional Information:
Source Context                system_u:system_r:varnishd_t:s0
Target Context                system_u:system_r:varnishd_t:s0
Target Objects                 [ capability ]
Source                        varnishd
Source Path                   /usr/sbin/varnishd
Port                          <Unknown>
Host                          <Unknown>
Source RPM Packages           varnish-4.0.1-2.el7.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-153.el7_0.10.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     centos7
Platform                      Linux centos7 3.10.0-123.4.4.el7.x86_64 #1 SMP Fri
                              Jul 25 05:07:12 UTC 2014 x86_64 x86_64
Alert Count                   13
First Seen                    2014-07-30 09:39:30 CEST
Last Seen                     2014-07-31 10:22:20 CEST
Local ID                      4921c987-8da1-4bed-b2f4-b44521fe319e

Raw Audit Messages
type=AVC msg=audit(1406794940.879:374): avc:  denied  { fowner } for  pid=10373 comm="varnishd" capability=3  scontext=system_u:system_r:varnishd_t:s0 tcontext=system_u:system_r:varnishd_t:s0 tclass=capability


type=AVC msg=audit(1406794940.879:374): avc:  denied  { fsetid } for  pid=10373 comm="varnishd" capability=4  scontext=system_u:system_r:varnishd_t:s0 tcontext=system_u:system_r:varnishd_t:s0 tclass=capability


type=SYSCALL msg=audit(1406794940.879:374): arch=x86_64 syscall=chmod success=yes exit=0 a0=7fff14bcad00 a1=1ed a2=0 a3=0 items=0 ppid=1 pid=10373 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=varnishd exe=/usr/sbin/varnishd subj=system_u:system_r:varnishd_t:s0 key=(null)

Hash: varnishd,varnishd_t,varnishd_t,capability,fowner
Comment 2 Milos Malik 2014-07-31 09:15:24 EDT
Seen on my virtual machine in enforcing mode:
----
time->Thu Jul 31 15:11:41 2014
type=PATH msg=audit(1406812301.471:842): item=0 name="./vcl.CNkoGA3g.so" inode=9687604 dev=fd:03 mode=0100711 ouid=989 ogid=988 rdev=00:00 obj=system_u:object_r:varnishd_var_lib_t:s0 objtype=NORMAL
type=CWD msg=audit(1406812301.471:842):  cwd="/var/lib/varnish/rhel70vm"
type=SYSCALL msg=audit(1406812301.471:842): arch=c000003e syscall=90 success=yes exit=0 a0=7fff5567c090 a1=1ed a2=0 a3=0 items=1 ppid=1 pid=23443 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="varnishd" exe="/usr/sbin/varnishd" subj=system_u:system_r:varnishd_t:s0 key=(null)
type=AVC msg=audit(1406812301.471:842): avc:  denied  { fsetid } for  pid=23443 comm="varnishd" capability=4  scontext=system_u:system_r:varnishd_t:s0 tcontext=system_u:system_r:varnishd_t:s0 tclass=capability
----
time->Thu Jul 31 15:11:48 2014
type=PATH msg=audit(1406812308.082:845): item=0 name="./vcl.Smc3ieVX.so" inode=9687604 dev=fd:03 mode=0100711 ouid=989 ogid=988 rdev=00:00 obj=system_u:object_r:varnishd_var_lib_t:s0 objtype=NORMAL
type=CWD msg=audit(1406812308.082:845):  cwd="/var/lib/varnish/rhel70vm"
type=SYSCALL msg=audit(1406812308.082:845): arch=c000003e syscall=90 success=yes exit=0 a0=7fff3616b6d0 a1=1ed a2=0 a3=0 items=1 ppid=1 pid=24199 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="varnishd" exe="/usr/sbin/varnishd" subj=system_u:system_r:varnishd_t:s0 key=(null)
type=AVC msg=audit(1406812308.082:845): avc:  denied  { fsetid } for  pid=24199 comm="varnishd" capability=4  scontext=system_u:system_r:varnishd_t:s0 tcontext=system_u:system_r:varnishd_t:s0 tclass=capability
----
Comment 5 Ingvar Hagelund 2014-12-09 07:18:49 EST
At least three extra system calls are needed for varnishd, that is chown, fowner and fsetid. These were all added through selinux-policy-3.13.1-64. A recompile of 3.13.1-64.fc21 from https://koji.fedoraproject.org/koji/buildinfo?buildID=543958 makes varnish work on el7.

While this changes are missing in downstream el7, varnish for epel7 will not work properly.

Ingvar
Comment 7 errata-xmlrpc 2015-03-05 05:42:28 EST
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/RHBA-2015-0458.html

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