Bug 735894

Summary: SELinux is preventing /usr/sbin/smbd from 'write' accesses on the directory /var/cache.
Product: [Fedora] Fedora Reporter: Shuresh Williams <stressfreechozeme>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:1f9293e5b291defaf2ac1903dc981a3d7b766e2c58cc7652e09c53fde3cbcb57
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-06 06:28:29 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 Shuresh Williams 2011-09-06 05:06:26 UTC
SELinux is preventing /usr/sbin/smbd from 'write' accesses on the directory /var/cache.

*****  Plugin catchall_boolean (57.6 confidence) suggests  *******************

If you want to allow samba to share any file/directory read/write.
Then you must tell SELinux about this by enabling the 'samba_export_all_rw' boolean.
Do
setsebool -P samba_export_all_rw 1

*****  Plugin catchall_labels (36.2 confidence) suggests  ********************

If you want to allow smbd to have write access on the cache directory
Then you need to change the label on /var/cache
Do
# semanage fcontext -a -t FILE_TYPE '/var/cache'
where FILE_TYPE is one of the following: tmp_t, samba_share_t, auth_cache_t, var_run_t, smbd_tmp_t, samba_etc_t, samba_log_t, qemu_tmp_t, samba_var_t, samba_secrets_t, home_root_t, pcscd_var_run_t, smbd_var_run_t, root_t. 
Then execute: 
restorecon -v '/var/cache'


*****  Plugin catchall (7.64 confidence) suggests  ***************************

If you believe that smbd should be allowed write access on the cache 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:var_t:s0
Target Objects                /var/cache [ dir ]
Source                        smbd
Source Path                   /usr/sbin/smbd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           samba-3.5.11-71.fc15.1
Target RPM Packages           filesystem-2.4.41-1.fc15
Policy RPM                    selinux-policy-3.9.16-35.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.40.3-0.fc15.x86_64 #1
                              SMP Tue Aug 16 04:10:59 UTC 2011 x86_64 x86_64
Alert Count                   1
First Seen                    Tue 06 Sep 2011 12:55:27 AM EDT
Last Seen                     Tue 06 Sep 2011 12:55:27 AM EDT
Local ID                      c8696d76-5fe7-4d49-aad9-3bf67a37ce2b

Raw Audit Messages
type=AVC msg=audit(1315284927.466:87): avc:  denied  { write } for  pid=3513 comm="smbd" name="cache" dev=dm-1 ino=1310724 scontext=system_u:system_r:smbd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=dir


type=SYSCALL msg=audit(1315284927.466:87): arch=x86_64 syscall=mkdir success=no exit=EACCES a0=7f76e97d0cd0 a1=1ed a2=0 a3=7fff9c3af5c0 items=0 ppid=3512 pid=3513 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=smbd exe=/usr/sbin/smbd subj=system_u:system_r:smbd_t:s0 key=(null)

Hash: smbd,smbd_t,var_t,dir,write

audit2allow

#============= smbd_t ==============
#!!!! This avc is allowed in the current policy

allow smbd_t var_t:dir write;

audit2allow -R

#============= smbd_t ==============
#!!!! This avc is allowed in the current policy

allow smbd_t var_t:dir write;

Comment 1 Miroslav Grepl 2011-09-06 06:28:29 UTC
If you want to share this you will need to enable the boolean

---

If you want to allow samba to share any file/directory read/write.
Then you must tell SELinux about this by enabling the 'samba_export_all_rw'
boolean.
Do
setsebool -P samba_export_all_rw 1


---

Or why do you think this is a bug?