RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1052817 - SELinux prevents glusterfsd from accessing a local directory
Summary: SELinux prevents glusterfsd from accessing a local directory
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.0
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Michal Trunecka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-14 06:07 UTC by Shanzhi Yu
Modified: 2014-09-30 23:35 UTC (History)
7 users (show)

Fixed In Version: selinux-policy-3.12.1-117.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 10:31:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Shanzhi Yu 2014-01-14 06:07:21 UTC
Description of problem:

Selinux prevent glusterfs  access local directory

Version-Release number of selected component (if applicable):

selinux-policy-3.12.1-115.el7.noarch

libvirt-1.1.1-18.el7.x86_64
qemu-kvm-rhev-1.5.3-34.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1.prepare glusterfs server and volume
#gluster volume  info gluster-vol1 
 
Volume Name: gluster-vol1
Type: Distribute
Volume ID: 32fe2d1d-7a2a-45d9-8a96-faab68253edd
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: 10.66.106.20:/mnt/gluster-volume1
Brick2: 10.66.106.22:/mnt/gluster-volume1
Options Reconfigured:
server.allow-insecure: on

2.create an netfs type pool
#mkdir /var/lib/libvirt/images/netfs
#ll -Z /var/lib/libvirt/images|grep netfs

drwxr-xr-x. root root system_u:object_r:nfs_t:s0       netfs

# virsh pool-create-as gluster --type netfs --source-host 10.66.106.20 --source-path gluster-vol1 --source-format glusterfs --target /var/lib/libvirt/images/netfs/ 

error: Failed to create pool gluster
error: internal error: Child process (/usr/bin/mount -t glusterfs 10.66.106.20:gluster-vol1 -o direct-io-mode=1 /var/lib/libvirt/images/netfs) unexpected exit status 1: 2014-01-13 03:33:09.963+0000: 6226: debug : virFileClose:90 : Closed fd 26
2014-01-13 03:33:09.963+0000: 6226: debug : virFileClose:90 : Closed fd 28
2014-01-13 03:33:09.963+0000: 6226: debug : virFileClose:90 : Closed fd 22
/usr/bin/fusermount-glusterfs: mount failed: Permission denied

3.#grep glusterfs /var/log/audit/audit.log

type=AVC msg=audit(1389679054.415:6890): avc:  denied  { mounton } for  pid=32442 comm="glusterfs" path="/var/lib/libvirt/images/netfs" dev="0:35" ino=9508905 scontext=system_u:system_r:glusterd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:nfs_t:s0 tclass=dir
type=SYSCALL msg=audit(1389679054.415:6890): arch=c000003e syscall=165 success=no exit=-13 a0=7fb021cdbb50 a1=7fb021cdb680 a2=7fb01e869028 a3=0 items=0 ppid=32441 pid=32442 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="glusterfs" exe="/usr/sbin/glusterfsd" subj=system_u:system_r:glusterd_t:s0-s0:c0.c1023 key=(null)
type=SYSCALL msg=audit(1389679054.417:6891): arch=c000003e syscall=165 success=no exit=-13 a0=7f9a762e6240 a1=7f9a762e5070 a2=7f9a762e62a0 a3=6 items=0 ppid=32442 pid=32447 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="fusermount-glus" exe="/usr/bin/fusermount-glusterfs" subj=system_u:system_r:glusterd_t:s0-s0:c0.c1023 key=(null)



Actual results:


Expected results:

should succeed creating pool in step 2

Additional info:

workaround:
# grep glusterfs /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp
or
disable selinux

I can run "mount -t glusterfs 10.66.106.20:gluster-vol1 -o direct-io-mode=1 /var/lib/libvirt/images/netfs" with root,there is no permission error.

Comment 2 Shanzhi Yu 2014-01-14 06:44:00 UTC
sorry,please refer to this audit log

# grep gluster /var/log/audit/audit.log
type=AVC msg=audit(1389681621.988:7057): avc:  denied  { mounton } for  pid=2399 comm="glusterfs" path="/var/lib/libvirt/images/netfs" dev="sda1" ino=203763571 scontext=system_u:system_r:glusterd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:virt_image_t:s0 tclass=dir
type=SYSCALL msg=audit(1389681621.988:7057): arch=c000003e syscall=165 success=no exit=-13 a0=7f264d4e2b50 a1=7f264d4e2680 a2=7f2649e94028 a3=0 items=0 ppid=2398 pid=2399 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="glusterfs" exe="/usr/sbin/glusterfsd" subj=system_u:system_r:glusterd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1389681621.990:7058): avc:  denied  { mounton } for  pid=2404 comm="fusermount-glus" path="/var/lib/libvirt/images/netfs" dev="sda1" ino=203763571 scontext=system_u:system_r:glusterd_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:virt_image_t:s0 tclass=dir
type=SYSCALL msg=audit(1389681621.990:7058): arch=c000003e syscall=165 success=no exit=-13 a0=7fb4210e9240 a1=7fb4210e8070 a2=7fb4210e92a0 a3=6 items=0 ppid=2399 pid=2404 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="fusermount-glus" exe="/usr/bin/fusermount-glusterfs" subj=system_u:system_r:glusterd_t:s0-s0:c0.c1023 key=(null)

Comment 3 Miroslav Grepl 2014-01-14 08:17:44 UTC
(In reply to Shanzhi Yu from comment #2)
> sorry,please refer to this audit log
> 
> # grep gluster /var/log/audit/audit.log
> type=AVC msg=audit(1389681621.988:7057): avc:  denied  { mounton } for 
> pid=2399 comm="glusterfs" path="/var/lib/libvirt/images/netfs" dev="sda1"
> ino=203763571 scontext=system_u:system_r:glusterd_t:s0-s0:c0.c1023
> tcontext=unconfined_u:object_r:virt_image_t:s0 tclass=dir
> type=SYSCALL msg=audit(1389681621.988:7057): arch=c000003e syscall=165
> success=no exit=-13 a0=7f264d4e2b50 a1=7f264d4e2680 a2=7f2649e94028 a3=0
> items=0 ppid=2398 pid=2399 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0
> egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="glusterfs"
> exe="/usr/sbin/glusterfsd" subj=system_u:system_r:glusterd_t:s0-s0:c0.c1023
> key=(null)
> type=AVC msg=audit(1389681621.990:7058): avc:  denied  { mounton } for 
> pid=2404 comm="fusermount-glus" path="/var/lib/libvirt/images/netfs"
> dev="sda1" ino=203763571
> scontext=system_u:system_r:glusterd_t:s0-s0:c0.c1023
> tcontext=unconfined_u:object_r:virt_image_t:s0 tclass=dir
> type=SYSCALL msg=audit(1389681621.990:7058): arch=c000003e syscall=165
> success=no exit=-13 a0=7fb4210e9240 a1=7fb4210e8070 a2=7fb4210e92a0 a3=6
> items=0 ppid=2399 pid=2404 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0
> egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="fusermount-glus"
> exe="/usr/bin/fusermount-glusterfs"
> subj=system_u:system_r:glusterd_t:s0-s0:c0.c1023 key=(null)

So these AVC come from

virsh pool-create-as gluster --type netfs --source-host 10.66.106.20 --source-path gluster-vol1 --source-format glusterfs --target /var/lib/libvirt/images/netfs/

Comment 4 Michal Trunecka 2014-01-20 14:35:56 UTC
Shanzhi, could you please confirm it works fine with the current policy? (3.12.1-117.el7 or newer)

Comment 5 Shanzhi Yu 2014-01-21 02:05:10 UTC
(In reply to Michal Trunecka from comment #4)
> Shanzhi, could you please confirm it works fine with the current policy?
> (3.12.1-117.el7 or newer)

Michal,

I'd like to tell you it works fine with 3.12.1-117,so I will change it to VERIFIED status.

Comment 7 Ludek Smid 2014-06-13 10:31:27 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.