Bug 859644 - SELinux is preventing /usr/bin/python2.7 from 'read' accesses on the file /etc/nsswitch.conf.
SELinux is preventing /usr/bin/python2.7 from 'read' accesses on the file /et...
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Grepl
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2012-09-22 14:17 EDT by Luya Tshimbalanga
Modified: 2012-10-12 03:36 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-10-12 03:36:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
File: type (9 bytes, text/plain)
2012-09-22 14:17 EDT, Luya Tshimbalanga
no flags Details
File: hashmarkername (14 bytes, text/plain)
2012-09-22 14:17 EDT, Luya Tshimbalanga
no flags Details

  None (edit)
Description Luya Tshimbalanga 2012-09-22 14:17:30 EDT
Additional info:
libreport version: 2.0.13
kernel:         3.6.0-0.rc6.git0.1.fc18.x86_64

: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.
: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
:#============= 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 14:17:32 EDT
Created attachment 615889 [details]
File: type
Comment 2 Luya Tshimbalanga 2012-09-22 14:17:34 EDT
Created attachment 615890 [details]
File: hashmarkername
Comment 3 Miroslav Grepl 2012-09-24 06:42:56 EDT
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 14:07:06 EDT
That was an upgrade since August 2012.
Comment 5 Luya Tshimbalanga 2012-09-25 17:36:31 EDT
(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 00:54:43 EDT
# ls -Z /etc/nsswitch.conf*
Comment 7 Luya Tshimbalanga 2012-09-26 14:58:08 EDT
# 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 16:24:42 EDT
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 16:40:55 EDT
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 17:39:14 EDT
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 17:42:18 EDT
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 17:45:47 EDT
(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 06:51:28 EDT
Does it happen on reboot?
Comment 14 Luya Tshimbalanga 2012-09-27 13:56:06 EDT
(In reply to comment #13)
> Does it happen on reboot?

Yes, it happened on reboot.=(
Comment 15 Daniel Walsh 2012-10-11 14:42:08 EDT
Is this still happening?
Comment 16 Luya Tshimbalanga 2012-10-11 18:01:13 EDT
(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 03:36:36 EDT
Ok then it was an upgrade issue. Let's close it and re-open if we see it again. Thank you.

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