Bug 1231134

Summary: Docker contaier can't access gluster (fuse) volumes
Product: [Fedora] Fedora Reporter: Jan Safranek <jsafrane>
Component: dockerAssignee: Lokesh Mandvekar <lsm5>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 21CC: admiller, dwalsh, ichavero, jcajka, jchaloup, jvance, lsm5, lsu, miminar, vbatts
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1231936 (view as bug list) Environment:
Last Closed: 2015-12-02 13:43:40 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:
Bug Depends On:    
Bug Blocks: 1231936    

Description Jan Safranek 2015-06-12 08:45:02 UTC
SELinux denies any access from inside a Docker container to a mounted GlusterFS volume, even though virt_use_fusefs boolean is set to 'on'.

AVC gathered with disabled dontaudit rules (why dontaudit this ????):
type=SYSCALL msg=audit(1434098028.965:515): arch=c000003e syscall=257 success=no exit=-13 a0=ffffffffffffff9c a1=194bc60 a2=90800 a3=0 items=0 ppid=4012 pid=4054 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts3 ses=4294967295 comm="ls" exe="/usr/bin/ls" subj=system_u:system_r:svirt_lxc_net_t:s0:c131,c679 key=(null)
type=AVC msg=audit(1434098028.965:515): avc:  denied  { read } for  pid=4054 comm="ls" name="/" dev="fuse" ino=1 scontext=system_u:system_r:svirt_lxc_net_t:s0:c131,c679 tcontext=system_u:object_r:fusefs_t:s0 tclass=dir permissive=0


Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.13.1-105.13.fc21.noarch

How reproducible:
always

Steps to Reproduce:
1. mount a GlusterFS volume to /mnt/test (or use any other fuse filesystem)
mount -t glusterfs my-gluster-server:test_vol /mnt/test

2. use it as a container volume 
docker run -ti -v /mnt/test:/mnt/test fedora:21 bash

3. (inside the container) look at /mnt/test
ls /mnt/test

Actual results:
ls: cannot open directory /mnt/test: Permission denied

Expected results:
see content of the directory

Additional info:
As stated above, 'setsebool -P virt_use_fusefs on' does not help. On the other way, 'setsebool -P virt_use_nfs on' helps to get the same working for NFS.

Also, these dontaudit rules only complicate things, it's hard to guess who rejects access in a complex environment where Docker, Kubernetes, SElinux, kernel namespaces and Gluster are involved.

Comment 1 Jeff Vance 2015-06-12 21:07:27 UTC
I've observed that, although you cannot ls the mounted dir (as if r access to the dir is denied), you can pass through it (x access) and cat files in the gluster volume.

Comment 2 Daniel Walsh 2015-06-15 13:12:42 UTC
I just added a 

virt_sandbox_use_fusefs boolean to docker-selinux.

If we got proper labeling on gluster files via XAttrs we would not have this problem.

This boolean will allow docker containers to attack any fusefs files on the system, including all gluster mounted drives, if it can get access to them.

Comment 3 Daniel Walsh 2015-07-15 20:07:41 UTC
Fixed in docker-io-1.7.0-1.git21cb6eb.fc21

Comment 4 Daniel Walsh 2015-07-15 20:07:53 UTC
Fixed in docker-io-1.7.0-1.git21cb6eb.fc21

Comment 5 Fedora End Of Life 2015-11-04 15:56:26 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. 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 EOL if it remains open with a Fedora  'version'
of '21'.

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.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 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 this bug is closed as described in the policy above.

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.

Comment 6 Fedora End Of Life 2015-12-02 13:43:55 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.