Bug 467300 - mls causes nfs server prolems
mls causes nfs server prolems
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-16 14:50 EDT by Robert Story
Modified: 2009-06-10 07:10 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-06-10 07:10:51 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Robert Story 2008-10-16 14:50:50 EDT
Description of problem:


Version-Release number of selected component (if applicable):
selinux-policy-3.3.1-95.fc9.noarch

How reproducible:


Steps to Reproduce:
1. try to export a filesystem on a mls enforcing server
  
Actual results:
startup:
Oct 16 14:00:54 keymaster exportfs[1983]: failed to lock /var/lib/nfs/xtab
Oct 16 14:00:54 keymaster exportfs[1983]: failed to lock /var/lib/nfs/etab
Oct 16 14:00:54 keymaster exportfs[1983]: can't open /var/lib/nfs/etab.tmp for writing
Oct 16 14:00:54 keymaster exportfs[1983]: failed to lock /var/lib/nfs/xtab
Oct 16 14:00:54 keymaster exportfs[1983]: can't open /var/lib/nfs/xtab.tmp for writing

trying to stop:
# run_init service nfs stop
Authenticating root.
Password:
Shutting down NFS mountd:                                  [FAILED]
Shutting down NFS daemon:                                  [FAILED]
Shutting down NFS quotas:                                  [FAILED]
exportfs: failed to lock /var/lib/nfs/etab
Shutting down NFS services:                                [FAILED]
Shutting down RPC svcgssd:                                 [FAILED]


Expected results:
no errors

Additional info:

This is the policy I currently have for my mls enforcing nfsserver:

module mynfsserver 1.0.13;

require {
        type var_lib_nfs_t;
        type kernel_t;
        type nfsd_t;
        type rpcd_t;
        type gssd_t;
        type initrc_t;
        type mnt_t;
        class tcp_socket { read write };
        class file { unlink rename create lock read write };
        class dir { read write add_name remove_name getattr search };
        class process ptrace;
}

#============= initrc_t ==============
allow initrc_t var_lib_nfs_t:file { unlink rename lock read write create };
allow initrc_t var_lib_nfs_t:dir { write add_name remove_name };
# idmap is rpcd_t
allow initrc_t rpcd_t:process ptrace;
# rpcbind it initrc_t
allow initrc_t initrc_t:process ptrace;
allow initrc_t kernel_t:process ptrace;
allow initrc_t gssd_t:process ptrace;
allow initrc_t nfsd_t:process ptrace;

#============= kernel_t ==============
allow kernel_t var_lib_nfs_t:dir read;
allow kernel_t nfsd_t:tcp_socket { read write };

#============= nfsd_t ==============
allow nfsd_t mnt_t:dir { getattr search };
Comment 1 Robert Story 2008-10-16 18:46:39 EDT
forgot to include avc...  below, newaudit is a script i wrote to show new avcs since the last run of the script..

[root@keymaster ~]# run_init service nfs stop
 ... [ all success]

[root@keymaster ~]# newaudit
none

[root@keymaster ~]# semodule -r sefosnfsserver

[root@keymaster ~]# newaudit
*** /tmp/newaudit       2008-10-16 18:38:56.000000000 -0400
--- /tmp/newaudit.new   2008-10-16 18:42:53.000000000 -0400
***************
*** 3156 ****
--- 3157 ----
+ type=USER_AVC msg=audit(1224196770.264:281): user pid=1758 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s15:c0.c1023 msg='avc:  received policyload notice (seqno=2) : exe="?" (sauid=81, hostname=?, addr=?, terminal=?)'

[root@keymaster ~]# run_init service nfs start
Authenticating root.
Password:
Starting RPC svcgssd:                                      [  OK  ]
Starting NFS services:  exportfs: failed to lock /var/lib/nfs/etab
exportfs: can't open /var/lib/nfs/etab.tmp for writing
                                                           [  OK  ]
Starting NFS quotas: rpc.rquotad: Cannot bind to given address: Permission denied
                                                           [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]

[root@keymaster ~]# newaudit
*** /tmp/newaudit       2008-10-16 18:42:53.000000000 -0400
--- /tmp/newaudit.new   2008-10-16 18:43:10.000000000 -0400
***************
*** 3157 ****
--- 3158,3161 ----
+ type=AVC msg=audit(1224196987.162:285): avc:  denied  { lock } for  pid=2226 comm="exportfs" path="/var/lib/nfs/etab" dev=dm-0 ino=97874 scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:object_r:var_lib_nfs_t:s0 tclass=file
+ type=AVC msg=audit(1224196987.165:286): avc:  denied  { write } for  pid=2226 comm="exportfs" name="nfs" dev=dm-0 ino=97672 scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:object_r:var_lib_nfs_t:s0 tclass=dir
+ type=AVC msg=audit(1224196987.191:287): avc:  denied  { name_bind } for  pid=2228 comm="rpc.rquotad" src=875 scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:object_r:hi_reserved_port_t:s0 tclass=tcp_socket
+ type=AVC msg=audit(1224196987.193:288): avc:  denied  { name_bind } for  pid=2228 comm="rpc.rquotad" src=713 scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:object_r:hi_reserved_port_t:s0 tclass=tcp_socket

[root@keymaster ~]# run_init service nfs stop
Authenticating root.
Password:
Shutting down NFS mountd:                                  [FAILED]
Shutting down NFS daemon:                                  [FAILED]
Shutting down NFS quotas:                                  [FAILED]
exportfs: failed to lock /var/lib/nfs/etab
Shutting down NFS services:                                [FAILED]
Shutting down RPC svcgssd:                                 [FAILED]

[root@keymaster ~]# newaudit
*** /tmp/newaudit       2008-10-16 18:43:10.000000000 -0400
--- /tmp/newaudit.new   2008-10-16 18:43:25.000000000 -0400
***************
*** 3161 ****
--- 3162 ----
+ type=AVC msg=audit(1224197003.561:291): avc:  denied  { lock } for  pid=2295 comm="exportfs" path="/var/lib/nfs/etab" dev=dm-0 ino=97874 scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:object_r:var_lib_nfs_t:s0 tclass=file


The stops above work once the ptrace permissions are added.. apparently ptrace is don't audited...
Comment 2 Robert Story 2008-10-16 18:54:43 EDT
A sampling of the 2 pages of avcs I get trying to stop nfs after running 'semodule -DB'

+ type=AVC msg=audit(1224197435.639:649): avc:  denied  { ptrace } for  pid=2351 comm="pidof" scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:system_r:nfsd_t:s0-s15:c0.c1023 tclass=process
+ type=AVC msg=audit(1224197435.640:650): avc:  denied  { ptrace } for  pid=2351 comm="pidof" scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:system_r:rpcd_t:s0-s15:c0.c1023 tclass=process
+ type=AVC msg=audit(1224197435.640:651): avc:  denied  { ptrace } for  pid=2351 comm="pidof" scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tclass=process
+ type=AVC msg=audit(1224197435.641:652): avc:  denied  { ptrace } for  pid=2351 comm="pidof" scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tclass=process
+ type=AVC msg=audit(1224197435.641:653): avc:  denied  { ptrace } for  pid=2351 comm="pidof" scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tclass=process
+ type=AVC msg=audit(1224197435.642:654): avc:  denied  { ptrace } for  pid=2351 comm="pidof" scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tclass=process
+ type=AVC msg=audit(1224197435.642:655): avc:  denied  { ptrace } for  pid=2351 comm="pidof" scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:system_r:kernel_t:s15:c0.c1023 tclass=process
+ type=AVC msg=audit(1224197435.643:656): avc:  denied  { ptrace } for  pid=2351 comm="pidof" scontext=system_u:system_r:initrc_t:s0-s15:c0.c1023 tcontext=system_u:system_r:kernel_t:s15:c0.c1023 tclass=process
Comment 3 Daniel Walsh 2008-10-20 14:41:38 EDT
Fixed in selinux-policy-3.3.1-103.fc9.noarch
Comment 4 Bug Zapper 2009-06-09 22:59:15 EDT
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

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