Bug 679213

Summary: SELinux is preventing /usr/sbin/smbd from 'getattr' accesses on the file /mnt/ymislegt/.hal-mtab-lock.
Product: [Fedora] Fedora Reporter: Flóki Pálsson <flokip>
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: dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:f4e82bd1184f37c315c30608e7c0f7f36b9231abc2f0f66242436707c70a8b38
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-21 22:29:38 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 Flóki Pálsson 2011-02-21 22:17:53 UTC
SELinux is preventing /usr/sbin/smbd from 'getattr' accesses on the file /mnt/ymislegt/.hal-mtab-lock.

*****  Plugin samba_share (57.8 confidence) suggests  ************************

If you want to allow smbd to have getattr access on the .hal-mtab-lock file
Then you need to change the label on '/mnt/ymislegt/.hal-mtab-lock'
Do
# semanage fcontext -a -t samba_share_t '/mnt/ymislegt/.hal-mtab-lock'
# restorecon  -v '/mnt/ymislegt/.hal-mtab-lock'

*****  Plugin file (9.48 confidence) suggests  *******************************

If you think this is caused by a badly mislabeled machine.
Then you need to fully relabel.
Do
touch /.autorelabel; reboot

*****  Plugin file (9.48 confidence) suggests  *******************************

If you think this is caused by a badly mislabeled machine.
Then you need to fully relabel.
Do
touch /.autorelabel; reboot

*****  Plugin catchall_boolean (9.48 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.
Do
setsebool -P samba_export_all_ro 1

*****  Plugin catchall_boolean (9.48 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 (6.11 confidence) suggests  ********************

If you want to allow smbd to have getattr access on the .hal-mtab-lock file
Then you need to change the label on /mnt/ymislegt/.hal-mtab-lock
Do
# semanage fcontext -a -t FILE_TYPE '/mnt/ymislegt/.hal-mtab-lock'
where FILE_TYPE is one of the following: abrt_helper_exec_t, user_cron_spool_t, cupsd_rw_etc_t, sssd_public_t, device_t, smbd_keytab_t, locale_t, etc_t, ld_so_t, proc_t, sysfs_t, krb5_keytab_t, textrel_shlib_t, crack_db_t, samba_share_t, krb5_conf_t, proc_kmsg_t, rpm_script_tmp_t, auth_cache_t, udev_tbl_t, logfile, shell_exec_t, sosreport_tmp_t, rpm_tmp_t, updpwd_exec_t, user_tmp_t, mtrr_device_t, samba_etc_t, samba_log_t, ld_so_cache_t, smbd_tmp_t, faillog_t, proc_mdstat_t, proc_net_t, chkpwd_exec_t, qemu_tmp_t, samba_var_t, user_home_t, initrc_var_run_t, net_conf_t, public_content_t, anon_inodefs_t, etc_runtime_t, samba_net_tmp_t, samba_secrets_t, sysctl_kernel_t, abrt_var_run_t, nmbd_var_run_t, pcscd_var_run_t, smbd_exec_t, smbd_var_run_t, proc_kcore_t, sysctl_crypto_t, public_content_rw_t, lpr_exec_t, fail2ban_var_lib_t, abrt_t, bin_t, cert_t, lib_t, sysctl_fs_t, smbd_t, usr_t, wtmp_t, root_t, samba_unconfined_script_exec_t, net_conf_t, krb5_host_rcache_t, cert_t. 
Then execute: 
restorecon -v '/mnt/ymislegt/.hal-mtab-lock'


*****  Plugin catchall (1.62 confidence) suggests  ***************************

If you believe that smbd should be allowed getattr access on the .hal-mtab-lock 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 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:file_t:s0
Target Objects                /mnt/ymislegt/.hal-mtab-lock [ file ]
Source                        smbd
Source Path                   /usr/sbin/smbd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           samba-3.6.0-64pre1.fc15.1
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.14-2.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.38-0.rc5.git1.1.fc15.x86_64 #1
                              SMP Thu Feb 17 01:49:02 UTC 2011 x86_64 x86_64
Alert Count                   3
First Seen                    lau 19.feb 2011, 14:32:45 GMT
Last Seen                     lau 19.feb 2011, 14:32:45 GMT
Local ID                      bd7e74ef-aa87-42a4-a7e0-51d498bf8f09

Raw Audit Messages
type=AVC msg=audit(1298125965.436:493): avc:  denied  { getattr } for  pid=3911 comm="smbd" path="/mnt/ymislegt/.hal-mtab-lock" dev=sda2 ino=12 scontext=system_u:system_r:smbd_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file


type=SYSCALL msg=audit(1298125965.436:493): arch=x86_64 syscall=stat success=no exit=EACCES a0=7fa180a78cd0 a1=7fffbb6701f0 a2=7fffbb6701f0 a3=7fa17f9731d0 items=0 ppid=3434 pid=3911 auid=4294967295 uid=0 gid=0 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=(none) ses=4294967295 comm=smbd exe=/usr/sbin/smbd subj=system_u:system_r:smbd_t:s0 key=(null)

Hash: smbd,smbd_t,file_t,file,getattr

audit2allow

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

allow smbd_t file_t:file getattr;

audit2allow -R

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

allow smbd_t file_t:file getattr;

Comment 1 Daniel Walsh 2011-02-21 22:29:38 UTC
If you want to share a random file system from an SELinux system, you will either have to label the mount point


mount -o context="system_u:system_r:samba_share_t:s0" /mnt/ymislegt

Or add labels to the share

chcon -Rt samba_share_t /mnt/ymislegt

Comment 2 Daniel Walsh 2011-02-21 22:30:04 UTC
*** Bug 679215 has been marked as a duplicate of this bug. ***