Bug 1325336

Summary: SELinux is preventing python from 'connectto' accesses on the unix_stream_socket /run/docker.sock.
Product: [Fedora] Fedora Reporter: Paulo Fidalgo <paulo.fidalgo.pt>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: dominick.grift, dwalsh, lvrabec, mgrepl, plautrba
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:5148b90ffd002e097286474aa474c93db1c64e4649d917d2b4de9b0cda666410;VARIANT_ID=workstation;
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-08 13:16:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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