Bug 1325336 - SELinux is preventing python from 'connectto' accesses on the unix_stream_socket /run/docker.sock.
Summary: SELinux is preventing python from 'connectto' accesses on the unix_stream_soc...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 23
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:5148b90ffd002e097286474aa47...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-08 13:14 UTC by Paulo Fidalgo
Modified: 2016-04-08 13:36 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-08 13:16:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Paulo Fidalgo 2016-04-08 13:14:12 UTC
Description of problem:
I have started a docker containner, dependent of another containers with:

docker-compose run TARGET
SELinux is preventing python from 'connectto' accesses on the unix_stream_socket /run/docker.sock.

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

If you believe that python should be allowed connectto access on the docker.sock unix_stream_socket 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 python /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:svirt_lxc_net_t:s0:c356,c584
Target Context                system_u:system_r:docker_t:s0
Target Objects                /run/docker.sock [ unix_stream_socket ]
Source                        python
Source Path                   python
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-158.12.fc23.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.4.6-300.fc23.x86_64 #1 SMP Wed
                              Mar 16 22:10:37 UTC 2016 x86_64 x86_64
Alert Count                   8
First Seen                    2016-04-08 13:08:07 BST
Last Seen                     2016-04-08 13:08:14 BST
Local ID                      1481c7b9-5c2e-46f3-b069-89ab7b5cbda4

Raw Audit Messages
type=AVC msg=audit(1460120894.283:872): avc:  denied  { connectto } for  pid=14794 comm="python" path="/run/docker.sock" scontext=system_u:system_r:svirt_lxc_net_t:s0:c356,c584 tcontext=system_u:system_r:docker_t:s0 tclass=unix_stream_socket permissive=0


Hash: python,svirt_lxc_net_t,docker_t,unix_stream_socket,connectto

Version-Release number of selected component:
selinux-policy-3.13.1-158.12.fc23.noarch

Additional info:
reporter:       libreport-2.6.4
hashmarkername: setroubleshoot
kernel:         4.4.6-300.fc23.x86_64
type:           libreport

Comment 1 Daniel Walsh 2016-04-08 13:16:53 UTC
You have to do this in a privileged container or in a container with SELinux disabled.  Allowing a container access to the docker socket, is basically allowing the container process full root access to your system.

docker run --security-opt label:disable

Comment 2 Daniel Walsh 2016-04-08 13:36:22 UTC
I just blogged on this.
http://danwalsh.livejournal.com/74095.html


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