Bug 1007873

Summary: SELinux is preventing /usr/sbin/nmbd from 'read' accesses on the file nmbd.pid.
Product: [Fedora] Fedora Reporter: Ferdinand Mácha <Ferdinand.Macha>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:84c6e6f9303bdb90de2d1e1889bc818f82d2052641252f8064d9eff8f88f45d7
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-13 14:04:34 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 Ferdinand Mácha 2013-09-13 13:31:43 UTC
Description of problem:
systemctl restart nmb.service
SELinux is preventing /usr/sbin/nmbd from 'read' accesses on the file nmbd.pid.

*****  Plugin catchall_boolean (47.5 confidence) suggests  *******************

If you want to allow samba to share any file/directory read only.
Then you must tell SELinux about this by enabling the 'samba_export_all_ro' boolean.
You can read 'samba_selinux' man page for more details.
Do
setsebool -P samba_export_all_ro 1

*****  Plugin catchall_boolean (47.5 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.
You can read 'samba_selinux' man page for more details.
Do
setsebool -P samba_export_all_rw 1

*****  Plugin catchall (6.38 confidence) suggests  ***************************

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

Additional Information:
Source Context                system_u:system_r:nmbd_t:s0
Target Context                unconfined_u:object_r:var_run_t:s0
Target Objects                nmbd.pid [ file ]
Source                        nmbd
Source Path                   /usr/sbin/nmbd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           samba-4.0.9-1.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-100.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.10.10-100.fc18.x86_64 #1 SMP Thu
                              Aug 29 20:13:09 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-09-13 15:28:50 CEST
Last Seen                     2013-09-13 15:28:50 CEST
Local ID                      a9375e9e-afd1-4a2e-83a9-433e826b5514

Raw Audit Messages
type=AVC msg=audit(1379078930.466:383): avc:  denied  { read } for  pid=6887 comm="nmbd" name="nmbd.pid" dev="tmpfs" ino=1437613 scontext=system_u:system_r:nmbd_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=file


type=SYSCALL msg=audit(1379078930.466:383): arch=x86_64 syscall=open success=no exit=EACCES a0=7f0b4b2819a0 a1=800 a2=1a4 a3=e items=0 ppid=1 pid=6887 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=nmbd exe=/usr/sbin/nmbd subj=system_u:system_r:nmbd_t:s0 key=(null)

Hash: nmbd,nmbd_t,var_run_t,file,read

audit2allow

#============= nmbd_t ==============
#!!!! This avc can be allowed using one of the these booleans:
#     samba_export_all_ro, samba_export_all_rw

allow nmbd_t var_run_t:file read;

audit2allow -R
require {
	type nmbd_t;
}

#============= nmbd_t ==============
files_exec_generic_pid_files(nmbd_t)


Additional info:
reporter:       libreport-2.1.6
hashmarkername: setroubleshoot
kernel:         3.10.10-100.fc18.x86_64
type:           libreport

Comment 1 Lukas Vrabec 2013-09-13 14:04:34 UTC
This command fix your problem:

setsebool -P samba_export_all_ro 1

Comment 2 Miroslav Grepl 2013-09-16 11:29:03 UTC
Actually

"nmbd.pid"

is mislabeled. It happens if a user runs a service directly without using service script.

Ferdinand,
execute

# restorecon -R -v /var/run/nmbd*

to fix labeling.