Bug 2188783

Summary: SELinux is preventing nfsidmap from 'read' accesses on the directory userdb.
Product: [Fedora] Fedora Reporter: Alvin <alvin>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 38CC: alvin, dwalsh, j, lvrabec, mmalik, nknazeko, omosnacek, pkoncity, rolandh, vmojzis, zpytela
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:0c75e9dad060c91dd85759c35ba36f59b8e75246a52ca026fcb87184c93b8179;VARIANT_ID=;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-02 09:51:56 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: description
none
File: os_info
none
custom TE SELinux policy workaround none

Description Alvin 2023-04-22 09:02:01 UTC
Description of problem:
The error gets thrown when navigating to an NFS share using autofs.
SELinux is preventing nfsidmap from 'read' accesses on the directory userdb.

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

If you believe that nfsidmap should be allowed read access on the userdb directory 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 'nfsidmap' --raw | audit2allow -M my-nfsidmap
# semodule -X 300 -i my-nfsidmap.pp

Additional Information:
Source Context                system_u:system_r:nfsidmap_t:s0
Target Context                system_u:object_r:systemd_userdbd_runtime_t:s0
Target Objects                userdb [ dir ]
Source                        nfsidmap
Source Path                   nfsidmap
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-38.11-1.fc38.noarch
Local Policy RPM              selinux-policy-targeted-38.11-1.fc38.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 6.2.11-300.fc38.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Thu Apr 13 20:27:09 UTC 2023
                              x86_64
Alert Count                   10
First Seen                    2023-04-21 22:55:30 CEST
Last Seen                     2023-04-22 10:59:29 CEST
Local ID                      700fac0f-174e-44ed-929f-9d651ed18cca

Raw Audit Messages
type=AVC msg=audit(1682153969.670:357): avc:  denied  { read } for  pid=15563 comm="nfsidmap" name="userdb" dev="tmpfs" ino=43 scontext=system_u:system_r:nfsidmap_t:s0 tcontext=system_u:object_r:systemd_userdbd_runtime_t:s0 tclass=dir permissive=0


Hash: nfsidmap,nfsidmap_t,systemd_userdbd_runtime_t,dir,read

Version-Release number of selected component:
selinux-policy-targeted-38.11-1.fc38.noarch

Additional info:
reporter:       libreport-2.17.9
reason:         SELinux is preventing nfsidmap from 'read' accesses on the directory userdb.
package:        selinux-policy-targeted-38.11-1.fc38.noarch
component:      selinux-policy
hashmarkername: setroubleshoot
type:           libreport
kernel:         6.2.11-300.fc38.x86_64
comment:        The error gets thrown when navigating to an NFS share using autofs.
component:      selinux-policy

Comment 1 Alvin 2023-04-22 09:02:03 UTC
Created attachment 1959054 [details]
File: description

Comment 2 Alvin 2023-04-22 09:02:04 UTC
Created attachment 1959055 [details]
File: os_info

Comment 3 Roland Hermans 2023-04-22 15:06:14 UTC
Created attachment 1959117 [details]
custom TE SELinux policy workaround

We ran into this issue too and I needed to add multiple allow statements in a custom policy to get nfsidmap working again. In our situation the user database is in an LDAP database that is accessed via sssd.

Comment 4 Ondrej Mosnáček 2023-05-02 09:51:56 UTC

*** This bug has been marked as a duplicate of bug 2180611 ***