Bug 1072695

Summary: SELinux is preventing /usr/sbin/smbd from 'setattr' accesses on the directory Shared.
Product: [Fedora] Fedora Reporter: Don Zickus <dzickus>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:1af8a8f319ad9d65fddee5071132f0425a420f7ed8aa810c974940639d201484
Fixed In Version: selinux-policy-3.12.1-135.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-21 09:26:14 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 Don Zickus 2014-03-05 03:24:59 UTC
Description of problem:
I have a win7 virtual machine.  In order to communicate with my fedora 20 host, I decided to setup a samba server and have win7 mount my fedora 20 box.  Setting up samba was easy.  I even followed the selinux suggestion in /etc/samba/smb.conf

setsebool -P samba_export_all_rw on

However, every time my win7 box creates a new directory (or renames or deletes) inside the samba shared folder, selinux throws out these errors.

I thought the whole point of telling selinux to 'export all rw' was to allow the top level directory and everyone below it to be 'selinux friendly'.  I am hoping I don't have to explicitly give permission for every single directory created below the top level share directory.  That would be very frustrating.

SELinux is preventing /usr/sbin/smbd from 'setattr' accesses on the directory Shared.

*****  Plugin samba_share (89.9 confidence) suggests   ***********************

If you want to allow smbd to have setattr access on the Shared directory
Then you need to change the label on 'Shared'
Do
# semanage fcontext -a -t samba_share_t 'Shared'
# restorecon  -v 'Shared'

*****  Plugin catchall_labels (9.27 confidence) suggests   *******************

If you want to allow smbd to have setattr access on the Shared directory
Then you need to change the label on Shared
Do
# semanage fcontext -a -t FILE_TYPE 'Shared'
where FILE_TYPE is one of the following: auth_cache_t, samba_log_t, samba_share_t, samba_var_t, smbd_tmp_t, smbd_tmpfs_t, smbd_var_run_t. 
Then execute: 
restorecon -v 'Shared'


*****  Plugin catchall (2.25 confidence) suggests   **************************

If you believe that smbd should be allowed setattr access on the Shared 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 smbd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:smbd_t:s0
Target Context                system_u:object_r:default_t:s0
Target Objects                Shared [ dir ]
Source                        smbd
Source Path                   /usr/sbin/smbd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           samba-4.1.4-1.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-122.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.13.3-201.fc20.x86_64 #1 SMP Fri
                              Feb 14 19:08:32 UTC 2014 x86_64 x86_64
Alert Count                   12
First Seen                    2014-03-04 21:38:23 EST
Last Seen                     2014-03-04 22:16:11 EST
Local ID                      5a479d3b-6614-44cc-81dc-63bca8ab10bd

Raw Audit Messages
type=AVC msg=audit(1393989371.412:1405): avc:  denied  { setattr } for  pid=26165 comm="smbd" name="Shared" dev="dm-4" ino=24905453 scontext=system_u:system_r:smbd_t:s0 tcontext=system_u:object_r:default_t:s0 tclass=dir


type=SYSCALL msg=audit(1393989371.412:1405): arch=x86_64 syscall=chmod success=no exit=EACCES a0=7f0c62b078d0 a1=41ed a2=0 a3=3 items=0 ppid=997 pid=26165 auid=4294967295 uid=1000 gid=0 euid=1000 suid=0 fsuid=1000 egid=1000 sgid=0 fsgid=1000 ses=4294967295 tty=(none) comm=smbd exe=/usr/sbin/smbd subj=system_u:system_r:smbd_t:s0 key=(null)

Hash: smbd,smbd_t,default_t,dir,setattr

Additional info:
reporter:       libreport-2.1.12
hashmarkername: setroubleshoot
kernel:         3.13.3-201.fc20.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2014-03-05 08:27:21 UTC
commit 7c99f26a6c15cd55573552da286e997fa8788caf
Author: Miroslav Grepl <mgrepl>
Date:   Wed Mar 5 09:26:33 2014 +0100

    Fix samba_export_all_rw booleanto cover also non security dirs


You can label it how the alert tells you for now.

Comment 2 Fedora Update System 2014-03-12 07:20:38 UTC
selinux-policy-3.12.1-135.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-135.fc20

Comment 3 Fedora Update System 2014-03-13 05:11:37 UTC
Package selinux-policy-3.12.1-135.fc20:
* should fix your issue,
* was pushed to the Fedora 20 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.12.1-135.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-3813/selinux-policy-3.12.1-135.fc20
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2014-03-21 09:26:14 UTC
selinux-policy-3.12.1-135.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.