Bug 1184389 - running a server with docker leads to selinux warnings
Summary: running a server with docker leads to selinux warnings
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-21 09:52 UTC by Nikos Mavrogiannopoulos
Modified: 2015-03-21 04:50 UTC (History)
6 users (show)

Fixed In Version: selinux-policy-3.13.1-105.6.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-21 04:50:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
warnings (10.00 KB, application/x-tar)
2015-01-21 09:52 UTC, Nikos Mavrogiannopoulos
no flags Details

Description Nikos Mavrogiannopoulos 2015-01-21 09:52:02 UTC
Created attachment 982234 [details]
warnings

Running a server under docker leads to warnings from selinux that I believe are not reasonable. I use docker to test a server's operation, and selinux warns that the server uses setrlimit(), and accesses a tun device it has created. 

I would have expected normal operation as everything done was within the container and the server had the appropriate permissions for them (was run as root).

The script I use to reproduce (it will require compiling the server in the same repository):
http://git.infradead.org/ocserv.git/blob/HEAD:/tests/full-test

Comment 1 Daniel Walsh 2015-01-21 12:56:20 UTC
8786aeed2169b2e5e33ec061ae259ca2d3fb0a49 allows docker_t to setrlimit.

Where is ocserv-socket.32 located?

Why is docker trying to write to it?

Comment 2 Nikos Mavrogiannopoulos 2015-01-21 13:09:25 UTC
(In reply to Daniel Walsh from comment #1)
> 8786aeed2169b2e5e33ec061ae259ca2d3fb0a49 allows docker_t to setrlimit.

Thanks.

> Where is ocserv-socket.32 located?

In /var/run

> Why is docker trying to write to it?

It's a socket created by the server and used for IPC afterwards.

Comment 3 Daniel Walsh 2015-01-21 13:35:57 UTC
Well it is labeled unlabeled_t which is very strange.  This file looks like it has a bad label on it.

When you say IPC, what kind of IPC?  Did you change docker to communicate with it for some reason?

Comment 4 Nikos Mavrogiannopoulos 2015-01-21 14:12:48 UTC
The communication is within docker only. I didn't change docker in any way.

The IPC used is messages over a unix socket file. The security module process creates the socket file, and the worker processes open it, and write messages to it.

Comment 5 Daniel Walsh 2015-01-21 17:52:27 UTC
What backend are you using?  Is this Overlayfs?

Comment 6 Nikos Mavrogiannopoulos 2015-01-21 20:03:54 UTC
(In reply to Daniel Walsh from comment #5)
> What backend are you using?  Is this Overlayfs?

I didn't use anything special than the default in f21.

Comment 7 Daniel Walsh 2015-01-21 20:32:22 UTC
Thats wierd, since I have never seen this one from anyone else.

Does the container work?

Comment 8 Nikos Mavrogiannopoulos 2015-01-22 08:26:35 UTC
Has anyone else run a server using unix socket files under fedora's docker? The container works, but I cannot understand the type of policy applied there. The log mentions "Enforcing Mode                Enforcing", while the raw audit message has "permissive=1"

The issue is reproducible by simply downloading the server, compiling and running the full-test script in Fedora.

Comment 9 Daniel Walsh 2015-01-22 20:10:01 UTC
The problem is we see an unlabeled_t socket show up inside of a container.  This means the socket either has a label the kernel does not understand or it has no label at all.  These types of files should not be on a normal system.

And I have never seen a socket with that name.

Comment 10 Nikos Mavrogiannopoulos 2015-01-24 08:37:11 UTC
This particular test, creates a container with certain libraries, and copies from the host OS the compiled server binary to the container. Then the copied server is executed within the container. Could that cause the mislabel?

Comment 11 Daniel Walsh 2015-01-31 11:15:24 UTC
No, mv from an unlabeled file could cause a mislabel, but cp should not.  Unless you are using some kind of preserve to preserve the bad label.

Comment 12 Nikos Mavrogiannopoulos 2015-01-31 14:17:00 UTC
I was referring to the docker ADD command. Not sure whether it translates to cp.

Comment 13 Daniel Walsh 2015-01-31 18:09:22 UTC
Ok so this was during a docker build.  There is some fixes for SELinux coming in docker-1.5, which might fix the problem.  This should be released early next week.

Comment 14 Fedora Update System 2015-03-06 22:28:06 UTC
selinux-policy-3.13.1-105.6.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/selinux-policy-3.13.1-105.6.fc21

Comment 15 Fedora Update System 2015-03-09 08:33:48 UTC
Package selinux-policy-3.13.1-105.6.fc21:
* should fix your issue,
* was pushed to the Fedora 21 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.13.1-105.6.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-3476/selinux-policy-3.13.1-105.6.fc21
then log in and leave karma (feedback).

Comment 16 Fedora Update System 2015-03-21 04:50:07 UTC
selinux-policy-3.13.1-105.6.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.


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