Bug 681277 - SELinux is preventing /usr/sbin/winbindd from 'write' accesses on the file /etc/pki/nssdb/key4.db.
Summary: SELinux is preventing /usr/sbin/winbindd from 'write' accesses on the file /e...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: nss
Version: 19
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Elio Maldonado Batiz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:90e560f7d48...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-03-01 15:59 UTC by Steven Hadfield
Modified: 2015-02-17 13:39 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-17 13:39:54 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Steven Hadfield 2011-03-01 15:59:56 UTC
SELinux is preventing /usr/sbin/winbindd from 'write' accesses on the file /etc/pki/nssdb/key4.db.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that winbindd should be allowed write access on the key4.db file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep winbindd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:winbind_t:s0
Target Context                system_u:object_r:cert_t:s0
Target Objects                /etc/pki/nssdb/key4.db [ file ]
Source                        winbindd
Source Path                   /usr/sbin/winbindd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           samba-winbind-3.6.0-64pre1.fc15.1
Target RPM Packages           nss-sysinit-3.12.9-13.fc16
Policy RPM                    selinux-policy-3.9.15-2.fc16
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed)
                              2.6.38-0.rc6.git0.1.fc16.x86_64 #1 SMP Tue Feb 22
                              18:14:51 UTC 2011 x86_64 x86_64
Alert Count                   37
First Seen                    Tue 22 Feb 2011 01:54:22 PM CST
Last Seen                     Tue 01 Mar 2011 09:58:27 AM CST
Local ID                      a1546412-a0c4-4e76-8e59-91b0d4c34dd2

Raw Audit Messages
type=AVC msg=audit(1298995107.380:737): avc:  denied  { write } for  pid=9280 comm="winbindd" name="key4.db" dev=dm-0 ino=1051941 scontext=system_u:system_r:winbind_t:s0 tcontext=system_u:object_r:cert_t:s0 tclass=file


type=SYSCALL msg=audit(1298995107.380:737): arch=x86_64 syscall=open success=no exit=EACCES a0=7f4f2818d020 a1=42 a2=1a4 a3=7f4f2818d020 items=0 ppid=1 pid=9280 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=winbindd exe=/usr/sbin/winbindd subj=system_u:system_r:winbind_t:s0 key=(null)

Hash: winbindd,winbind_t,cert_t,file,write

audit2allow

#============= winbind_t ==============
allow winbind_t cert_t:file write;

audit2allow -R

#============= winbind_t ==============
allow winbind_t cert_t:file write;

Comment 1 Daniel Walsh 2011-03-01 16:19:16 UTC
Does winbind actually need to write this file or is this an access check?

Comment 2 Simo Sorce 2011-03-01 16:29:06 UTC
I don't know of any direct use of NSS (the crypto lib) in winbind.
This must be coming by way of some other library. (openldap? krb5?)

Comment 3 Steven Hadfield 2011-03-01 17:06:29 UTC
It's hard for me to say whether it requires is or now, since it seems to be
crashing a lot for me because of another bug. 

If I had to guess between openldap or krb5, I'd probably go with Kerberos since
I'm authenticating to Active Directory with a Kerberos domain.

After allowing the cert_t:file permission, it also wants cert_t:dir write.

I've uploaded the winbind logs that were touched today if that will be of any
help:
http://www.letu.edu/people/stevenhadfield/logs/mar-2011/log.wb-LETNET
http://www.letu.edu/people/stevenhadfield/logs/mar-2011/log.winbindd
http://www.letu.edu/people/stevenhadfield/logs/mar-2011/log.winbindd-idmap
http://www.letu.edu/people/stevenhadfield/logs/mar-2011/winbind_audit.log

Let me know if there's anything else I can provide.

Comment 4 Daniel Walsh 2011-03-01 20:05:41 UTC
Eric if this was an access check would the syscall be access instead of open?

Comment 5 Eric Paris 2011-03-01 20:20:21 UTC
It would.  This is an open(2) with a1=flags=0x42

O_RDWR = 0x02
O_CREAT = 0x40

Comment 6 Elio Maldonado Batiz 2011-03-01 21:01:11 UTC
In case it helps: In Rawhide kerberos has added support for NSS
kerberos diff -up f15/krb5.spec master/krb5.spec | grep NSS
 %global WITH_OPENSSL 1
-%global WITH_NSS 0
+%global WITH_NSS 1
 %if %{WITH_OPENSSL}
+%if %{WITH_NSS}
+- turn on NSS as the backend for libk5crypto, adding nss-devel as a build

Comment 7 Elio Maldonado Batiz 2011-03-01 21:12:33 UTC
Which may explain the write acces to /etc/pki/nssdb/key4.db which is the databse holding the secret and private keys. Kerberos may be generating keys. Take this witch a pinch of salt as I am not familiar with kerberos, if indeed is kerberos that's causing the access.

Comment 8 Elio Maldonado Batiz 2011-03-01 21:27:42 UTC
But access to /etc/pki/nssdb/, which is the sytem-wide database, is normally read-only, unless the process is running at root.

Comment 9 Eric Paris 2011-03-01 21:35:08 UTC
In this case the process is running as root.  But SELinux is still denying 'write'.  Obviously if opening this file with write access is correct and required for normal operation selinux policy can be relaxed to allow this to happen.  But until we understand why it is happening and are certain that it happening is a good idea, policy will not be changed....

Comment 10 Simo Sorce 2011-03-01 22:03:48 UTC
AFAIK winbindd really doesn't need access to that DB.
If it is trying to open it it is probably because some library do it by default I guess.
But I think winbindd should be treated like a regular user process in this regard and get only read access.

However if a library open the file for read/wrote just because winbind is running as root i t looks to me that there is a bug in it that should be fixed.
So finding out what library is doing that would be a good idea.

I know in F-14 and later OpenLDAP libraries have been changed to use NSS instead of OpenSSL so they would be one of my candidates.

Comment 11 Rich Megginson 2011-03-01 22:21:22 UTC
openldap opens NSS with NSS_INIT_READONLY

				initctx = NSS_InitContext( realcertdir, prefix, prefix, SECMOD_DB,
										   &initParams, NSS_INIT_READONLY );

or

			int flags = NSS_INIT_READONLY|NSS_INIT_NOCERTDB|NSS_INIT_NOMODDB;
...
			initctx = NSS_InitContext( "", "", "", SECMOD_DB,
									   &initParams, flags );

Comment 12 Daniel Walsh 2011-03-02 19:55:47 UTC
Well we can certainly dont audit it.  I know kerberos does wacky things like determining what access it has to a file, but I thought it did this via access.

Comment 13 Fedora End Of Life 2013-04-03 14:44:42 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 14 Fedora End Of Life 2015-01-09 16:35:30 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

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.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 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, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

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.

Comment 15 Fedora End Of Life 2015-02-17 13:39:54 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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