Bug 441991 - SELinux prevented slapd from reading files stored on a NFS filesytem.
SELinux prevented slapd from reading files stored on a NFS filesytem.
Product: Fedora
Classification: Fedora
Component: openldap (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Jan Safranek
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-04-10 23:47 EDT by Kahlil Hodgson
Modified: 2008-11-26 06:09 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-11-26 06:09:15 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Kahlil Hodgson 2008-04-10 23:47:20 EDT
Despite having: 

<kal@buffy:~> getsebool use_nfs_home_dirs
use_nfs_home_dirs --> on

I'm getting:

Source Context                unconfined_u:system_r:setsebool_t:s0-s0:c0.c1023
Target Context                system_u:object_r:nfs_t:s0
Target Objects                ./.ldaprc [ file ]
Source                        setsebool
Source Path                   /usr/sbin/setsebool
Port                          <Unknown>
Host                          buffy.finexium.com
Source RPM Packages           policycoreutils-2.0.33-3.fc8
Target RPM Packages           
Policy RPM                    selinux-policy-3.0.8-98.fc8
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   use_nfs_home_dirs
Host Name                     buffy.finexium.com
Platform                      Linux buffy.finexium.com #1 SMP
                              Sat Mar 29 09:15:49 EDT 2008 x86_64 x86_64
Alert Count                   2
First Seen                    Wed Mar 26 12:20:43 2008
Last Seen                     Fri Apr 11 13:41:45 2008
Local ID                      4182386b-03a4-4bea-9e30-8e8a4b88e1ab
Line Numbers                  

Raw Audit Messages            

host=buffy.finexium.com type=AVC msg=audit(1207885305.669:2154): avc:  denied  {
read } for  pid=25892 comm="setsebool" name=".ldaprc" dev=0:17 ino=1279136
tcontext=system_u:object_r:nfs_t:s0 tclass=file

host=buffy.finexium.com type=SYSCALL msg=audit(1207885305.669:2154):
arch=c000003e syscall=2 success=no exit=-13 a0=2aaaae264460 a1=0 a2=1b6 a3=0
items=0 ppid=25184 pid=25892 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0
sgid=0 fsgid=0 tty=pts2 comm="setsebool" exe="/usr/sbin/setsebool"
subj=unconfined_u:system_r:setsebool_t:s0-s0:c0.c1023 key=(null)

However it does not appear to be impacting anything important (yet).
Comment 1 Kahlil Hodgson 2008-04-10 23:48:12 EDT
Oh, and I only get it when restarting nscd.
Comment 2 Daniel Walsh 2008-04-11 12:47:44 EDT
This looks like a leaked file descriptor to .ldaprc.  I have no idea how it is
happening.  It can probably be safely ignored.
Comment 3 Kahlil Hodgson 2008-05-05 01:56:53 EDT
Don't know if this helps, but I have recently added 'root_squash' to my NFS
export definitions, and now I no longer get the alert on restart of 'nscd'.
Comment 4 Jan Safranek 2008-05-05 08:38:13 EDT
I am not sure I understand the bug correctly. Please correct me if I am wrong: 
- you have users in ldap and configured /etc/ldap.conf and /etc/nsswitch.conf
- you have root's home on nfs volume
- the nfs volume has no_root_squash
- and if you run "service nscd restart", you get the AVC above

If the above is correct, I do not understand why nscd calls /usr/sbin/setsebool
- it doesn't do that on my machine and I do not see any reason to do so. Please
provide strace of the nscd, i.e. run "service nscd stop; strace -o
nscd-trace.log nscd -d"
Comment 5 Kahlil Hodgson 2008-05-05 21:40:54 EDT
Not quite :-)

- Unprivileged users are in ldap (as above) running over TLS
- I'm using pam_ldap for authentication
- /home is an NFS mount point, /root is local
- selinux has use_nfs_home_dirs set to on
- sealertd was giving me the above warnings (nscd does not call setbool, I was
simply proving that use_nfs_home_dirs was set ;-) )
- I noticed the alert when I restarted nscd ... _ahhh_... I was using sudo!

So when I do 'sudo service nscd restart' from my home directory I was getting
the alert consistently. (Sorry, I forgot to mention the sudo bit).

Now that I have set 'root_squash' for the NFS export, the error has gone,
presumably because root can't see into my home dir anymore, and won't attempt to
access '~/.ldaprc', and hence won't trigger the SE alert.  My guess is nscd is
not checking its $EUID when its looking for conf files.

Hmmm, lots of things have changed since I reported this bug.  If I get a chance
I'll mount home on a safe box with 'no_root_squash' set and see if I can
reproduce again.

Comment 6 Jan Safranek 2008-05-06 03:40:52 EDT
Well, that sounds better, but the AVC above is produced by /usr/sbin/setsebool,
not nscd.
Comment 7 Jan Safranek 2008-05-15 07:49:42 EDT
I am still not able to reproduce it. Today I reviewed the code and I see that
ldap client library opens the .ldaprc only to read it and then it is immediately
closed. Please provide strace of the application (ncsd? sudo? setsebool?), which
causes the AVC.
Comment 8 Kahlil Hodgson 2008-05-15 18:28:08 EDT
Sorry, been off the internet for a week.  I'll should be able to get you a trace
this weekend :-)
Comment 9 Kahlil Hodgson 2008-05-17 23:27:08 EDT
I turned 'no_root_squash' back on for one of my servers, but no sign of the
AVC, so that was just a coincidence.  A lot of things have changed since I
reported the bug -- both selinux and kernel have been upgraded -- and sadly I
did not make a copy of the OS at the time -- I think I'll do that in future.  I
gather we have just hit some really weird edge case.  Alhough I would be nice to
understand what was going wrong, I'm happy to let this bug slide for the moment
(it never stopped anything from working) as I don't have a lot of spare time
left to track the issue.


Comment 10 Jan Safranek 2008-05-19 02:23:53 EDT
ok, I'm  setting needinfo to clearly state where is the ball
Comment 11 Bug Zapper 2008-11-26 05:28:00 EST
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  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 '8'.

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 8'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 8 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: 
Comment 12 Jan Safranek 2008-11-26 06:09:15 EST
reporter did not provide enough information to track this bug and workaround is available.

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