Bug 1323223

Summary: SELinux is preventing /bin/busybox from 'write' accesses on the directory web-logs-example.
Product: [Fedora] Fedora Reporter: OoZooL <obliterator666>
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:eaace30951da4daa0f1e561470ec223f508748d73e74d03d6b21bd342b16287e;VARIANT_ID=workstation;
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-03 09:39:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description OoZooL 2016-04-01 15:14:58 UTC
Description of problem:
docker web server trying to write to an SELinux protected area under the root home directory, I believe....
SELinux is preventing /bin/busybox from 'write' accesses on the directory web-logs-example.

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

If you believe that busybox should be allowed write access on the web-logs-example directory 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 sh /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:c422,c579
Target Context                unconfined_u:object_r:admin_home_t:s0
Target Objects                web-logs-example [ dir ]
Source                        sh
Source Path                   /bin/busybox
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-158.11.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                   84
First Seen                    2016-04-01 18:12:01 IDT
Last Seen                     2016-04-01 18:13:24 IDT
Local ID                      d4ecd442-c993-4d43-bed6-fcd889782473

Raw Audit Messages
type=AVC msg=audit(1459523604.156:681): avc:  denied  { write } for  pid=20098 comm="sh" name="web-logs-example" dev="dm-1" ino=673406 scontext=system_u:system_r:svirt_lxc_net_t:s0:c422,c579 tcontext=unconfined_u:object_r:admin_home_t:s0 tclass=dir permissive=0


type=SYSCALL msg=audit(1459523604.156:681): arch=x86_64 syscall=open success=no exit=EACCES a0=1efa010 a1=441 a2=1b6 a3=0 items=0 ppid=1928 pid=20098 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=sh exe=/bin/busybox subj=system_u:system_r:svirt_lxc_net_t:s0:c422,c579 key=(null)

Hash: sh,svirt_lxc_net_t,admin_home_t,dir,write

Version-Release number of selected component:
selinux-policy-3.13.1-158.11.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-03 09:39:03 UTC
This looks like you have volume mounted something from the /root directory into a container.

You need to use the :Z or :z option on your volume mount to label the content correctly.

Note Miroslav, we should add an setroubleshoot for this.

http://www.projectatomic.io/blog/2016/03/dwalsh_selinux_containers/

Comment 2 Daniel Walsh 2016-04-03 09:39:37 UTC
*** Bug 1323225 has been marked as a duplicate of this bug. ***