Bug 427733

Summary: samba_share_t:filesystem getattr denied - no used space/capacity info available for clients
Product: [Fedora] Fedora Reporter: Tomasz Ostrowski <tometzky+redhat>
Component: selinux-policyAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 7   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.6.4-69 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-01-29 10:54:39 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 Tomasz Ostrowski 2008-01-07 09:20:27 UTC
Description of problem:
When samba share is on dedicated partition mounted with option
context="system_u:object_r:samba_share_t:s0" then clients are unable to get used
space and capacity information from a share.

The following is logged to audit.log:

type=AVC msg=audit(1199692559.651:766): avc:  denied  { getattr } for  pid=2440
comm="smbd" name="/" dev=sdb1 ino=2 scontext=user_u:system_r:smbd_t:s0
tcontext=system_u:object_r:samba_share_t:s0 tclass=filesystem

type=SYSCALL msg=audit(1199692559.651:766): arch=40000003 syscall=268 success=no
exit=-13 a0=b7ef4677 a1=54 a2=bf8ac548 a3=bf8ac548 items=0 ppid=2347 pid=2440
auid=500 uid=559 gid=0 euid=559 suid=0 fsuid=559 egid=100 sgid=0 fsgid=100
tty=(none) comm="smbd" exe="/usr/sbin/smbd" subj=user_u:system_r:smbd_t:s0
key=(null)


Version-Release number of selected component (if applicable):
selinux-policy-2.6.4-66.fc7
samba-3.0.28-0.fc7

How reproducible:
Always

Steps to Reproduce:

# creating dedicated share partition
service smb stop
dd if=/dev/zero of=/tmp/shares.img bs=1M count=10
mkfs.ext2 -F /tmp/shares.img 
mkdir /tmp/shares
mount -o loop,context="system_u:object_r:samba_share_t:s0" \
  /tmp/shares.img /tmp/shares

# defining share
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
echo -e "[global]\n\tsecurity=share\n\n" \
  > /etc/samba/smb.conf
echo -e "[test]\n\tguest ok=yes\n\tguest only=yes\n\tpath=/tmp/shares" \
  >> /etc/samba/smb.conf
service smb start
smbclient //localhost/test guest -c "dir"
audit2allow -l < /var/log/audit/audit.log

# cleaning up
service smb stop
mv -f /etc/samba/smb.conf.bak /etc/samba/smb.conf
umount /tmp/shares


Actual results (along output):
0 blocks of size 0. 10 blocks available
allow smbd_t samba_share_t:filesystem getattr;


Expected results (along output):
19822 blocks of size 512. 18614 blocks available

Comment 1 Daniel Walsh 2008-01-08 18:43:58 UTC
You can allow this for now by executing 

# audit2allow -M mypol -i /var/log/audit/audit.log 
# semodule -i mypol.pp

Fixed in selinux-policy-2.6.4-69.fc7