Bug 1494287

Summary: SELinux is preventing portainer from 'connectto' accesses on the unix_stream_socket /run/docker.sock.
Product: [Fedora] Fedora Reporter: thiagoahauck
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: dwalsh, lsm5, lvrabec, mgrepl, plautrba, pmoore
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:1c5d4da524a6bfae27142ab02a76eec3594aa5b1de704d6f67a5bcecc3fe23be;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-22 10:52:52 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 thiagoahauck 2017-09-21 23:41:59 UTC
Description of problem:
SELinux is preventing portainer from 'connectto' accesses on the unix_stream_socket /run/docker.sock.

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

If você acredita que o portainer deva ser permitido acesso de connectto em docker.sock unix_stream_socket  por default.
Then você deve informar que este é um erro.
Você pode gerar um módulo de política local para permitir este acesso.
Do
allow this access for now by executing:
# ausearch -c 'portainer' --raw | audit2allow -M my-portainer
# semodule -X 300 -i my-portainer.pp

Additional Information:
Source Context                system_u:system_r:container_t:s0:c302,c318
Target Context                system_u:system_r:container_runtime_t:s0
Target Objects                /run/docker.sock [ unix_stream_socket ]
Source                        portainer
Source Path                   portainer
Port                          <Desconhecido>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-260.8.fc26.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.12.12-300.fc26.x86_64 #1 SMP Mon
                              Sep 11 17:18:56 UTC 2017 x86_64 x86_64
Alert Count                   2
First Seen                    2017-09-21 20:17:47 -03
Last Seen                     2017-09-21 20:17:47 -03
Local ID                      8c66c756-dc62-4137-9576-e9624dc62a72

Raw Audit Messages
type=AVC msg=audit(1506035867.714:403): avc:  denied  { connectto } for  pid=2888 comm="portainer" path="/run/docker.sock" scontext=system_u:system_r:container_t:s0:c302,c318 tcontext=system_u:system_r:container_runtime_t:s0 tclass=unix_stream_socket permissive=0


Hash: portainer,container_t,container_runtime_t,unix_stream_socket,connectto

Version-Release number of selected component:
selinux-policy-3.13.1-260.8.fc26.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.1
hashmarkername: setroubleshoot
kernel:         4.12.12-300.fc26.x86_64
type:           libreport

Comment 1 Daniel Walsh 2017-09-22 10:52:52 UTC
You are running a confined container and giving it access to the docker.sock. Which SELinux is correctly blocking. Any process that can talk to the docker.sock, owns your system.  So you might as well run with --privileged mode.  If this is your intention.  If not, then you have a container breakout...