Bug 1098719 - SE permission problems with volume mounting
Summary: SE permission problems with volume mounting
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: docker-io
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lokesh Mandvekar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-17 16:44 UTC by Mads Kiilerich
Modified: 2014-07-01 23:00 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-05-19 20:53:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mads Kiilerich 2014-05-17 16:44:28 UTC
[mk@xps x]$ getenforce 
Enforcing

with docker-io-0.11.1-1.fc20.x86_64 :

[mk@xps x]$ docker run --rm -v $PWD:/test hg-dockerrpm-fedora ls -l /test
(as expected)

with docker-io-0.11.1-3.fc20.x86_64 :

[mk@xps x]$ docker run --rm -v $PWD:/test hg-dockerrpm-fedora ls -l /test
ls: cannot open directory /test: Permission denied

- but after setenforce 0 it works anyway.

I also see https://bugzilla.redhat.com/show_bug.cgi?id=1096375 - they might be related or have the same root cause.

Workaround: stick to 0.11.1-1

Comment 1 Daniel Walsh 2014-05-19 20:53:35 UTC
Currently if you add a directory via mount youhave to 

chcon -Rt svirt_sandbox_file_t /test

I have sent a patch upstream to allow

docker run --rm -v $PWD:/test:/test:Z hg-dockerrpm-fedora ls -l /test

Which will label the content in /test with the correct label for the container.

Comment 2 Mads Kiilerich 2014-05-19 21:02:06 UTC
Thanks. Nice to know a fix is coming.

(I do not understand how it can be NOTABUG when it stopped working with a package update and a patch can fix it ... but a rose by any name ...)

Do you have a link to the upstream patch? Is it SE upstream or docker?

Comment 3 Daniel Walsh 2014-05-19 21:45:19 UTC
Mads
Not a bug because it is documented in the Man page.

man docker-run
...
       When  using  SELinux,  be  aware that the host has no knowledge of con‐
       tainer SELinux policy.  Therefore, in the  above  example,  if  SELinux
       policy  is  enforced, the /var/db directory is not writable to the con‐
       tainer.  A "Permission Denied" message will occur and an  avc:  message
       in the host's syslog.

       To  work  around  this, at time of writing this man page, the following
       command needs to be run in order for the  proper  SELinux  policy  type
       label to be attached to the host directory:

              # chcon -Rt svirt_sandbox_file_t /var/db

Usability issue, perhaps.  :^(


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