Bug 1447669 - [SELinux] statedump is not able to dump the file in /var/run/gluster because of SELinux permissions.
Summary: [SELinux] statedump is not able to dump the file in /var/run/gluster because ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.3
Hardware: All
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 1445693
TreeView+ depends on / blocked
 
Reported: 2017-05-03 12:37 UTC by Niels de Vos
Modified: 2017-08-01 15:26 UTC (History)
15 users (show)

Fixed In Version: selinux-policy-3.13.1-152.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1445693
Environment:
Last Closed: 2017-08-01 15:26:23 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1861 0 normal SHIPPED_LIVE selinux-policy bug fix update 2017-08-01 17:50:24 UTC

Description Niels de Vos 2017-05-03 12:37:05 UTC
+++ This bug was initially created as a clone of Bug #1445693 +++

Description of problem:
*********************************
On a samba setup , if the statedump command is executed to collect the statedump on gfapi side , the file is not getting dumped to the location /var/run/gluster.

There are two issues observed :
1. One is the /var/run/gluster doesn't have write permission.
2. SELINUX is preventing smbd to write to /var/run/gluster

the 1st issue is been discussed in upstream and there is another bug which may track it.

For 2nd issue we need SELinux policy to set context for smbd to access and write to /var/run/gluster

After setting the SELinux to permissive and providing permission to user, it was able to dump.

We need to check on default path for dumping statedump as this issue may occur even with non-root user as well.


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

glusterfs-3.8.4-23.el7rhgs.x86_64



How reproducible:
****************************
Always

Steps to Reproduce:
****************************
1. Create a samba setup 
2. mount a volume, run some I/O's
3. Run statedump command as following and check for the file:

gluster volume statedump testvol client 10.70.47.45:32036


Actual results:
***************************
The file is not getting dumped in default location due to SELINUX preventing smbd to access and write to /var/run/gluster.

type=AVC msg=audit(1493119101.557:152328): avc:  denied  { write } for  pid=32043 comm="smbd" name="gluster" dev="tmpfs" ino=14636 scontext=system_u:system_r:smbd_t:s0 tcontext=system_u:object_r:glusterd_var_run_t:s0 tclass=dir


Expected results:
****************************
statedump should succeed and dumps the file in /var/run/gluster.


Additional info:
*********************
How are we going to handle the permissions on this location?
May be change the default location to /var/log/glusterfs?


--- Additional comment from Niels de Vos on 2017-05-03 14:30:48 CEST ---

This needs to be addressed in the selinux-policy package. Any process using libgfapi.so should have SELinux permissions to create new files under /var/run/gluster/

We could think about changing the default location of the statedumps, but that will affect other tools that try to collect those files. It probably is a good idea to give gfapi users the option to select a different directory. The directory probably needs to be different per application, otherwise the new default location will likely have problems with other applications...

Comment 1 Niels de Vos 2017-05-03 12:43:08 UTC
This is a request to allow the Samba process (smbd) to generate debugging files (statedumps) under /var/run/gluster. These files are created through the libgfapi.so library that provides integration of a GlusterFS client in the Samba (vfs_glusterfs) process.

The default path for these statedump files is not configurable through libgfapi.so at the moment. It is still open if other projects want to use a new function to configure the path, or have their processes run with a user that is part of the "gluster" group (group writable permissions on /var/run/gluster).

Other processes might be affected by this SELinux restriction too. However testing with QEMU (after giving additional write permissions on /var/run/gluster) worked fine.

Comment 2 Milos Malik 2017-05-03 12:56:01 UTC
Unfortunately, the samba_load_libgfapi boolean does not help here.

Comment 13 errata-xmlrpc 2017-08-01 15:26:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1861


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