Bug 1511489

Summary: selinux: ganesha.nfsd run in unconfined domain
Product: Red Hat Enterprise Linux 7 Reporter: Kaleb KEITHLEY <kkeithle>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: unspecified Docs Contact:
Priority: high    
Version: 7.5CC: benl, dwalsh, jijoy, kdreyer, kkeithle, lmiksik, lvrabec, mmalik, msaini, mthacker, pasik, plautrba, salmy, skoduri, ssekidde, toneata, zpytela
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-216.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1511486
: 1628247 1638257 (view as bug list) Environment:
Last Closed: 2019-08-06 12:51:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1511486    
Bug Blocks: 1518140, 1637783, 1638257, 1653106    

Description Kaleb KEITHLEY 2017-11-09 12:57:38 UTC
+++ This bug was initially created as a clone of Bug #1511486 +++

Description of problem:

nfs-ganesha is a userspace NFS server daemon. With every release of selinux-policy-targeted we find new AVCs that need to be addressed.

We had a conversation with Dan Walsh, and we agreed that, just like knfsd, ganesha.nfsd should run in an unconfined domain.

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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 6 Ken Dreyer (Red Hat) 2018-08-03 21:43:11 UTC
Lukas, would you pleas set Fixed In Version for this bug?

Comment 10 Milos Malik 2018-09-05 13:25:15 UTC
Following SELinux denials appeared in enforcing mode:
----
type=PROCTITLE msg=audit(09/05/2018 09:21:40.503:7883) : proctitle=/usr/bin/ganesha.nfsd -L /var/log/ganesha.log -f /etc/ganesha/ganesha.conf -N NIV_EVENT 
type=PATH msg=audit(09/05/2018 09:21:40.503:7883) : item=1 name=/var/run/ganesha objtype=CREATE cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=PATH msg=audit(09/05/2018 09:21:40.503:7883) : item=0 name=/var/run/ inode=7374 dev=00:13 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_run_t:s0 objtype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=CWD msg=audit(09/05/2018 09:21:40.503:7883) :  cwd=/ 
type=SYSCALL msg=audit(09/05/2018 09:21:40.503:7883) : arch=x86_64 syscall=mkdir success=no exit=EACCES(Permission denied) a0=0x7f602f418240 a1=sticky,0274 a2=0x55782bf141c0 a3=0x55782bf1c0ec items=2 ppid=1 pid=203748 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ganesha.nfsd exe=/usr/bin/ganesha.nfsd subj=system_u:system_r:nfsd_t:s0 key=(null) 
type=AVC msg=audit(09/05/2018 09:21:40.503:7883) : avc:  denied  { create } for  pid=203748 comm=ganesha.nfsd name=ganesha scontext=system_u:system_r:nfsd_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=dir permissive=0 
----
type=PROCTITLE msg=audit(09/05/2018 09:21:40.525:7884) : proctitle=/usr/bin/ganesha.nfsd -L /var/log/ganesha.log -f /etc/ganesha/ganesha.conf -N NIV_EVENT 
type=PATH msg=audit(09/05/2018 09:21:40.525:7884) : item=0 name=/etc/krb5.keytab inode=4576622 dev=fd:00 mode=file,644 ouid=root ogid=root rdev=00:00 obj=unconfined_u:object_r:krb5_keytab_t:s0 objtype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=CWD msg=audit(09/05/2018 09:21:40.525:7884) :  cwd=/ 
type=SYSCALL msg=audit(09/05/2018 09:21:40.525:7884) : arch=x86_64 syscall=open success=no exit=EACCES(Permission denied) a0=0x7f602f418c40 a1=O_RDONLY a2=0x1b6 a3=0x7fffc76c58a0 items=1 ppid=1 pid=203748 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ganesha.nfsd exe=/usr/bin/ganesha.nfsd subj=system_u:system_r:nfsd_t:s0 key=(null) 
type=AVC msg=audit(09/05/2018 09:21:40.525:7884) : avc:  denied  { read } for  pid=203748 comm=ganesha.nfsd name=krb5.keytab dev="dm-0" ino=4576622 scontext=system_u:system_r:nfsd_t:s0 tcontext=unconfined_u:object_r:krb5_keytab_t:s0 tclass=file permissive=0 
----

# rpm -qa selinux\* \*ganesha\* | sort
nfs-ganesha-2.3.2-1.el7.x86_64
selinux-policy-3.13.1-223.el7.noarch
selinux-policy-devel-3.13.1-223.el7.noarch
selinux-policy-doc-3.13.1-223.el7.noarch
selinux-policy-minimum-3.13.1-223.el7.noarch
selinux-policy-mls-3.13.1-223.el7.noarch
selinux-policy-sandbox-3.13.1-223.el7.noarch
selinux-policy-targeted-3.13.1-223.el7.noarch
#

Comment 11 Milos Malik 2018-09-05 13:43:25 UTC
Following SELinux denials appeared in permissive mode:
----
type=PROCTITLE msg=audit(09/05/2018 15:40:45.053:4128) : proctitle=/usr/bin/ganesha.nfsd -L /var/log/ganesha.log -f /etc/ganesha/ganesha.conf -N NIV_EVENT 
type=PATH msg=audit(09/05/2018 15:40:45.053:4128) : item=1 name=/var/run/ganesha inode=1199684 dev=00:16 mode=dir,sticky,274 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_run_t:s0 nametype=CREATE cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=PATH msg=audit(09/05/2018 15:40:45.053:4128) : item=0 name=/var/run/ inode=9016 dev=00:16 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_run_t:s0 nametype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=CWD msg=audit(09/05/2018 15:40:45.053:4128) : cwd=/ 
type=SYSCALL msg=audit(09/05/2018 15:40:45.053:4128) : arch=x86_64 syscall=mkdir success=yes exit=0 a0=0x7fe434418240 a1=sticky,0274 a2=0x55d2a3bb31c0 a3=0x55d2a3bbb0ec items=2 ppid=1 pid=244409 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ganesha.nfsd exe=/usr/bin/ganesha.nfsd subj=system_u:system_r:nfsd_t:s0 key=(null) 
type=AVC msg=audit(09/05/2018 15:40:45.053:4128) : avc:  denied  { create } for  pid=244409 comm=ganesha.nfsd name=ganesha scontext=system_u:system_r:nfsd_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=dir permissive=1 
----
type=PROCTITLE msg=audit(09/05/2018 15:40:55.513:4133) : proctitle=/usr/bin/ganesha.nfsd -L /var/log/ganesha.log -f /etc/ganesha/ganesha.conf -N NIV_EVENT 
type=PATH msg=audit(09/05/2018 15:40:55.513:4133) : item=0 name=/etc/krb5.keytab inode=8767328 dev=fd:03 mode=file,644 ouid=root ogid=root rdev=00:00 obj=unconfined_u:object_r:krb5_keytab_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=CWD msg=audit(09/05/2018 15:40:55.513:4133) : cwd=/ 
type=SYSCALL msg=audit(09/05/2018 15:40:55.513:4133) : arch=x86_64 syscall=open success=yes exit=28 a0=0x7f9d6e018b40 a1=O_RDONLY a2=0x1b6 a3=0x7fffa9394f60 items=1 ppid=1 pid=245167 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ganesha.nfsd exe=/usr/bin/ganesha.nfsd subj=system_u:system_r:nfsd_t:s0 key=(null) 
type=AVC msg=audit(09/05/2018 15:40:55.513:4133) : avc:  denied  { open } for  pid=245167 comm=ganesha.nfsd path=/etc/krb5.keytab dev="vda3" ino=8767328 scontext=system_u:system_r:nfsd_t:s0 tcontext=unconfined_u:object_r:krb5_keytab_t:s0 tclass=file permissive=1 
type=AVC msg=audit(09/05/2018 15:40:55.513:4133) : avc:  denied  { read } for  pid=245167 comm=ganesha.nfsd name=krb5.keytab dev="vda3" ino=8767328 scontext=system_u:system_r:nfsd_t:s0 tcontext=unconfined_u:object_r:krb5_keytab_t:s0 tclass=file permissive=1 
----
type=PROCTITLE msg=audit(09/05/2018 15:40:55.513:4134) : proctitle=/usr/bin/ganesha.nfsd -L /var/log/ganesha.log -f /etc/ganesha/ganesha.conf -N NIV_EVENT 
type=SYSCALL msg=audit(09/05/2018 15:40:55.513:4134) : arch=x86_64 syscall=fcntl success=yes exit=0 a0=0x1c a1=F_SETLKW a2=0x7fffa9395490 a3=0x7fffa9394f60 items=0 ppid=1 pid=245167 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ganesha.nfsd exe=/usr/bin/ganesha.nfsd subj=system_u:system_r:nfsd_t:s0 key=(null) 
type=AVC msg=audit(09/05/2018 15:40:55.513:4134) : avc:  denied  { lock } for  pid=245167 comm=ganesha.nfsd path=/etc/krb5.keytab dev="vda3" ino=8767328 scontext=system_u:system_r:nfsd_t:s0 tcontext=unconfined_u:object_r:krb5_keytab_t:s0 tclass=file permissive=1 
----

Comment 13 Milos Malik 2018-09-12 14:35:43 UTC
Issues mentioned in comment#10 and comment#11 are addressed in BZ#1628247.

Comment 14 Milos Malik 2018-09-12 15:16:38 UTC
# seinfo -tnfsd_t -x
   nfsd_t
      nsswitch_domain
      corenet_unlabeled_type
      domain
      fixed_disk_raw_read
      kernel_system_state_reader
      netlabel_peer_type
      daemon
      syslog_client_type
      pcmcia_typeattr_7
      pcmcia_typeattr_6
      pcmcia_typeattr_5
      pcmcia_typeattr_4
      pcmcia_typeattr_3
      pcmcia_typeattr_2
      pcmcia_typeattr_1
      rpc_domain
      userdom_filetrans_type
   Aliases
      ganesha_t
#

Not sure why nfsd_t was chosen as a replacement for ganesha_t, because nfsd_t is not an unconfined domain. SELinux denials still appear (for example BZ#1628247) and the automated TC fails in certain old test phases.

Comment 15 Kaleb KEITHLEY 2018-09-12 16:32:55 UTC
At the time that we (i.e. nfs-ganesha team) talked to Dan Walsh (2018-09-xx) he apparently thought it was an unconfined domain. Was that not the case?

Comment 17 Milos Malik 2018-09-25 09:14:02 UTC
Because selinux-policy in RHEL-7.6 does not define aliases for ganesha booleans, following error messages appear:

  Installing : glusterfs-ganesha-3.12.2-20.el7rhgs.x86_64                 44/44 
ValueError: Boolean ganesha_use_fusefs is not defined
ValueError: Boolean ganesha_use_fusefs is not defined

Following SELinux types were defined in RHEL-7.5 but they are NOT defined in RHEL-7.6:

# seinfo -tganesha_var_run_t -x
ERROR: could not find datum for type ganesha_var_run_t
# seinfo -tganesha_tmp_t -x
ERROR: could not find datum for type ganesha_tmp_t
#

Because our automated TC for ganesha fails in 4 of 9 phases, I would really recommend to all interested parties to reconsider the purpose of this bug. The fails indicate that ganesha will be broken in certain use cases, if the fix goes out with RHEL-7.6 GA.

Comment 18 Milos Malik 2018-09-25 09:18:52 UTC
Hi Dan, I would like to know your opinion about this bug. My reasons for FailedQA are written in comment#14 and comment#17.

Comment 19 Lukas Vrabec 2018-10-08 11:31:07 UTC
Thanks Milos for heads up. 

Could somebody from ganesha help with testing this? 

Thanks,
Lukas.

Comment 23 Lukas Vrabec 2018-10-10 14:14:49 UTC
*** Bug 1637817 has been marked as a duplicate of this bug. ***

Comment 40 errata-xmlrpc 2019-08-06 12:51:45 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-2019:2127