Bug 1584461

Summary: SELinux is preventing pkla-check-auth from 'read' accesses on the file /etc/authselect/nsswitch.conf.
Product: [Fedora] Fedora Reporter: keane.mokelley+spam
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: dwalsh, lvrabec, mailinglists35, marvin.sinci, mgrepl, mmalik, plautrba, pmoore
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: abrt_hash:9058d18b3c11df204192f8df69a5f4a2dee873d887808d1e98e6d3eb22dd644c;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-01 12:51:43 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:

Description keane.mokelley+spam 2018-05-31 01:16:38 UTC
Description of problem:
SELinux is preventing pkla-check-auth from 'read' accesses on the file /etc/authselect/nsswitch.conf.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/etc/authselect/nsswitch.conf default label should be etc_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /etc/authselect/nsswitch.conf

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that pkla-check-auth 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:
# ausearch -c 'pkla-check-auth' --raw | audit2allow -M my-pklacheckauth
# semodule -X 300 -i my-pklacheckauth.pp

Additional Information:
Source Context                system_u:system_r:policykit_auth_t:s0
Target Context                system_u:object_r:unlabeled_t:s0
Target Objects                /etc/authselect/nsswitch.conf [ file ]
Source                        pkla-check-auth
Source Path                   pkla-check-auth
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.1-29.fc28.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.16.12-300.fc28.x86_64 #1 SMP Fri
                              May 25 21:13:28 UTC 2018 x86_64 x86_64
Alert Count                   3
First Seen                    2018-05-30 20:10:33 CDT
Last Seen                     2018-05-30 20:10:33 CDT
Local ID                      3494dfbe-b4d5-4ceb-b9bf-871e1e6b257d

Raw Audit Messages
type=AVC msg=audit(1527729033.777:1591): avc:  denied  { read } for  pid=7314 comm="pkla-check-auth" name="nsswitch.conf" dev="loop1" ino=818 scontext=system_u:system_r:policykit_auth_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=0


Hash: pkla-check-auth,policykit_auth_t,unlabeled_t,file,read

Version-Release number of selected component:
selinux-policy-3.14.1-29.fc28.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.5
hashmarkername: setroubleshoot
kernel:         4.16.12-300.fc28.x86_64
type:           libreport

Comment 1 Lukas Vrabec 2018-06-01 12:51:43 UTC
HI, 

Could you run:

# restorecon -Rv / 

To restore SELinux labels on your system? 

THanks.

Comment 2 keane.mokelley+spam 2018-06-02 17:53:29 UTC
(In reply to Lukas Vrabec from comment #1)
> HI, 
> 
> Could you run:
> 
> # restorecon -Rv / 
> 
> To restore SELinux labels on your system? 
> 
> THanks.

No, /etc/authselect/nsswitch.conf is mounted read-only by snapd:

`/var/lib/snapd/snaps/core_4650.snap on /etc/authselect/nsswitch.conf type squashfs (ro,nodev,relatime,seclabel)`

Comment 3 Mai Ling 2018-08-04 07:57:29 UTC
(In reply to Lukas Vrabec from comment #1)
> HI, 
> 
> Could you run:
> 
> # restorecon -Rv / 
> 
> To restore SELinux labels on your system? 
> 
> THanks.

Dear Lukas,

Could you help retitle this, redirect the bug to snapd package and reopen?
I understand this is not caused by selinux but by snapd installing a file not compliant with selinux. (for me it's also snapd the cause of this[1])

The effect is frustrating as I'm getting these selinux alerts all the time: https://i.imgur.com/vt2Mv9L.png

Thank you.


[1]

[asus@localhost ~]$ grep /etc/authselect/nsswitch.conf /proc/mounts 
/dev/loop1 /etc/authselect/nsswitch.conf squashfs ro,seclabel,nodev,relatime 0 0

[asus@localhost ~]$ losetup /dev/loop1
/dev/loop1: []: (/var/lib/snapd/snaps/core_4917.snap)

[asus@localhost ~]$ sudo blockdev --getro /dev/loop1
1

Comment 4 Mai Ling 2018-08-04 08:30:22 UTC
nevermind, filed https://bugzilla.redhat.com/show_bug.cgi?id=1612430