Bug 859644

Summary: SELinux is preventing /usr/bin/python2.7 from 'read' accesses on the file /etc/nsswitch.conf.
Product: [Fedora] Fedora Reporter: Luya Tshimbalanga <luya>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:5e432ab8a721e88970ee31d4f56c9cb65ee7a2a44d1bd839aeef438c9d966180
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-12 07:36:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: type
none
File: hashmarkername none

Description Luya Tshimbalanga 2012-09-22 18:17:30 UTC
Additional info:
libreport version: 2.0.13
kernel:         3.6.0-0.rc6.git0.1.fc18.x86_64

description:
:SELinux is preventing /usr/bin/python2.7 from 'read' accesses on the file /etc/nsswitch.conf.
:
:*****  Plugin catchall (100. confidence) suggests  ***************************
:
:If you believe that python2.7 should be allowed read access on the nsswitch.conf 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 tuned /var/log/audit/audit.log | audit2allow -M mypol
:# semodule -i mypol.pp
:
:Additional Information:
:Source Context                system_u:system_r:tuned_t:s0
:Target Context                system_u:object_r:system_dbusd_var_lib_t:s0
:Target Objects                /etc/nsswitch.conf [ file ]
:Source                        tuned
:Source Path                   /usr/bin/python2.7
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           bash-4.2.37-6.fc18.x86_64
:Target RPM Packages           glibc-2.16-15.fc18.x86_64
:Policy RPM                    selinux-policy-3.11.1-21.fc18.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed) 3.6.0-0.rc6.git0.1.fc18.x86_64 #1
:                              SMP Mon Sep 17 13:16:51 UTC 2012 x86_64 x86_64
:Alert Count                   67
:First Seen                    2012-09-20 21:11:21 PDT
:Last Seen                     2012-09-22 11:14:54 PDT
:Local ID                      10aec680-e17f-4d9d-8343-cc12d2bbbbce
:
:Raw Audit Messages
:type=AVC msg=audit(1348337694.969:692): avc:  denied  { read } for  pid=2925 comm="sh" name="nsswitch.conf" dev="dm-1" ino=2490725 scontext=system_u:system_r:tuned_t:s0 tcontext=system_u:object_r:system_dbusd_var_lib_t:s0 tclass=file
:
:
:type=SYSCALL msg=audit(1348337694.969:692): arch=x86_64 syscall=open success=no exit=EACCES a0=30e3178512 a1=80000 a2=1b6 a3=238 items=0 ppid=574 pid=2925 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=sh exe=/usr/bin/bash subj=system_u:system_r:tuned_t:s0 key=(null)
:
:Hash: tuned,tuned_t,system_dbusd_var_lib_t,file,read
:
:audit2allow
:
:#============= tuned_t ==============
:allow tuned_t system_dbusd_var_lib_t:file read;
:
:audit2allow -R
:
:#============= tuned_t ==============
:allow tuned_t system_dbusd_var_lib_t:file read;
:

Comment 1 Luya Tshimbalanga 2012-09-22 18:17:32 UTC
Created attachment 615889 [details]
File: type

Comment 2 Luya Tshimbalanga 2012-09-22 18:17:34 UTC
Created attachment 615890 [details]
File: hashmarkername

Comment 3 Miroslav Grepl 2012-09-24 10:42:56 UTC
The problem is the nsswitch.conf is mislabeled.

Did you do an upgrade or is this a fresh install?

# restorecon -R -v /etc/nsswitch


will fix it.

Comment 4 Luya Tshimbalanga 2012-09-24 18:07:06 UTC
That was an upgrade since August 2012.

Comment 5 Luya Tshimbalanga 2012-09-25 21:36:31 UTC
(In reply to comment #3)
> The problem is the nsswitch.conf is mislabeled.
> 
> Did you do an upgrade or is this a fresh install?
> 
> # restorecon -R -v /etc/nsswitch
> 

# restorecon -R -v /etc/nsswitch
restorecon:  lstat(/etc/nsswitch) failed:  No such file or directory


# restorecon -R -v /etc/nsswitch.conf command worked but the sealert keeps popping 11 alerts related to nsswitch.conf.

Here is ls command 
]# ls -al /etc/ | grep nsswitchw
-rw-r--r--.   1 root root     1717 Aug 18 01:54 nsswitch.conf
-rw-r--r--.   1 root root     1717 Aug 15 19:57 nsswitch.conf.bak

I am reopening the bug because the problem still occurs.

Comment 6 Miroslav Grepl 2012-09-26 04:54:43 UTC
# ls -Z /etc/nsswitch.conf*

Comment 7 Luya Tshimbalanga 2012-09-26 18:58:08 UTC
# ls -alZ /etc/ | grep nsswitch
-rw-r--r--. root root   system_u:object_r:system_dbusd_var_lib_t:s0 nsswitch.conf
-rw-r--r--. root root   system_u:object_r:etc_t:s0       nsswitch.conf.bak

I removed the bak file

Comment 8 Daniel Walsh 2012-09-26 20:24:42 UTC
The question I have is how did this happen?  What created nsswitch as system_dbusd_var_lib_t and then mv'd it to /etc?

Comment 9 Miroslav Grepl 2012-09-26 20:40:55 UTC
I would say an upgrade issue.

$ restorecon -v /etc/nsswitch.conf*

and then you will see if this happens again.

Comment 10 Luya Tshimbalanga 2012-09-26 21:39:14 UTC
Yes it happens again after applying

$ restorecon -v /etc/nsswitch.conf*

Source process according to sealert:
mcelog, rpc.statd, dbus-daemon, unix-chkpwd, systemd-tmpfiles, tuned

Is tuned the cause of mislabeling?

Comment 11 Daniel Walsh 2012-09-26 21:42:18 UTC
No something is creating this file with the wrong label.

Is something other then dbus running with the dbus label?

ps -eZ | grep system_dbusd_t

Comment 12 Luya Tshimbalanga 2012-09-26 21:45:47 UTC
(In reply to comment #11)
> Is something other then dbus running with the dbus label?
> 
> ps -eZ | grep system_dbusd_t

$ ps -eZ | grep system_dbusd_t
system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 512 ? 00:00:01 dbus-daemon

Comment 13 Miroslav Grepl 2012-09-27 10:51:28 UTC
Does it happen on reboot?

Comment 14 Luya Tshimbalanga 2012-09-27 17:56:06 UTC
(In reply to comment #13)
> Does it happen on reboot?

Yes, it happened on reboot.=(

Comment 15 Daniel Walsh 2012-10-11 18:42:08 UTC
Is this still happening?

Comment 16 Luya Tshimbalanga 2012-10-11 22:01:13 UTC
(In reply to comment #15)
> Is this still happening?

Yes, it was still happening until I did a fresh installation of F18.
Be in mind the problem occurred after an upgrade from F17 to F18.

Comment 17 Miroslav Grepl 2012-10-12 07:36:36 UTC
Ok then it was an upgrade issue. Let's close it and re-open if we see it again. Thank you.