Bug 1732723 - SELinux is preventing p11_child from 'search' accesses on the directory .config.
Summary: SELinux is preventing p11_child from 'search' accesses on the directory .config.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 30
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:ec5de9ccd2bccf999ab26473fce...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-24 08:27 UTC by Jakub Jelen
Modified: 2019-09-06 12:33 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.14.3-42.fc30 selinux-policy-3.14.3-45.fc30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-06 12:33:54 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jakub Jelen 2019-07-24 08:27:24 UTC
Description of problem:
After configuring SSSD to use smart cards for local login, it fails to use softhsm pkcs11 module (automatically loaded from p11-kit).
SELinux is preventing p11_child from 'search' accesses on the directory .config.

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

If you believe that p11_child should be allowed search access on the .config 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 'p11_child' --raw | audit2allow -M my-p11child
# semodule -X 300 -i my-p11child.pp

Additional Information:
Source Context                system_u:system_r:sssd_t:s0
Target Context                unconfined_u:object_r:config_home_t:s0
Target Objects                .config [ dir ]
Source                        p11_child
Source Path                   p11_child
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.3-41.fc30.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.1.16-300.fc30.x86_64 #1 SMP Wed
                              Jul 3 15:06:51 UTC 2019 x86_64 x86_64
Alert Count                   501
First Seen                    2019-07-03 11:01:28 CEST
Last Seen                     2019-07-24 10:24:21 CEST
Local ID                      fa8b4829-7934-412b-9890-eb092e566d51

Raw Audit Messages
type=AVC msg=audit(1563956661.406:1469): avc:  denied  { search } for  pid=15332 comm="p11_child" name=".config" dev="dm-1" ino=2754153 scontext=system_u:system_r:sssd_t:s0 tcontext=unconfined_u:object_r:config_home_t:s0 tclass=dir permissive=0


Hash: p11_child,sssd_t,config_home_t,dir,search

Version-Release number of selected component:
selinux-policy-3.14.3-41.fc30.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.10.1
hashmarkername: setroubleshoot
kernel:         5.1.16-300.fc30.x86_64
type:           libreport

Comment 1 Jakub Jelen 2019-07-24 08:29:11 UTC
There is one more alert with every login, since the softhsm also tries to search system path:

SELinux is preventing p11_child from search access on the directory /var/lib/softhsm.

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

If you believe that p11_child should be allowed search access on the softhsm 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 'p11_child' --raw | audit2allow -M my-p11child
# semodule -X 300 -i my-p11child.pp

Additional Information:
Source Context                system_u:system_r:sssd_t:s0
Target Context                system_u:object_r:named_cache_t:s0
Target Objects                /var/lib/softhsm [ dir ]
Source                        p11_child
Source Path                   p11_child
Port                          <Unknown>
Host                          t470s.jjelen.redhat.com
Source RPM Packages           
Target RPM Packages           softhsm-2.5.0-3.fc30.1.x86_64
Policy RPM                    selinux-policy-3.14.3-41.fc30.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     t470s.jjelen.redhat.com
Platform                      Linux t470s.jjelen.redhat.com
                              5.1.16-300.fc30.x86_64 #1 SMP Wed Jul 3 15:06:51
                              UTC 2019 x86_64 x86_64
Alert Count                   501
First Seen                    2019-07-03 11:01:28 CEST
Last Seen                     2019-07-24 10:24:21 CEST
Local ID                      0cacfb2f-f3dc-455b-ab9e-b8b05647213b

Raw Audit Messages
type=AVC msg=audit(1563956661.406:1470): avc:  denied  { search } for  pid=15332 comm="p11_child" name="softhsm" dev="dm-1" ino=791764 scontext=system_u:system_r:sssd_t:s0 tcontext=system_u:object_r:named_cache_t:s0 tclass=dir permissive=0


Hash: p11_child,sssd_t,named_cache_t,dir,search

Comment 2 Lukas Vrabec 2019-07-24 20:11:33 UTC
commit a5bd00d73ce3a011650a38465aeb0091d0faf178 (HEAD -> rawhide)
Author: Lukas Vrabec <lvrabec>
Date:   Wed Jul 24 22:10:10 2019 +0200

    Allow sssd_t domain to read gnome config and named cache files
    
    After configuring SSSD to use smart cards for local login, it fails to
    use softhsm pkcs11 module (automatically loaded from p11-kit). This
    commit fixes the issue

Comment 5 Fedora Update System 2019-07-26 09:18:39 UTC
FEDORA-2019-8c534abad8 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-8c534abad8

Comment 6 Fedora Update System 2019-07-27 01:22:23 UTC
selinux-policy-3.14.3-42.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-8c534abad8

Comment 7 Fedora Update System 2019-07-28 01:23:49 UTC
selinux-policy-3.14.3-42.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Jakub Jelen 2019-07-30 16:32:50 UTC
I guess I should have submitted all the AVCs generated in permissive, since after the above update, one more pops up. Can you add also this one?

After switching to permissive, I am not getting any more issues (I don't have any softhsm tokens systemwide), but generally, I think everything under /var/lib/softhsm should have separate label, which should be accessible by sssd in this case.

Can you have a look also into this issue?

Attaching the AVC I am getting (the tokens is a directory under /var/lib/softhsm):

type=AVC msg=audit(1564503006.772:721): avc:  denied  { read } for  pid=15226 comm="p11_child" name="tokens" dev="dm-1" ino=791776 scontext=system_u:system_r:sssd_t:s0 tcontext=system_u:object_r:named_cache_t:s0 tclass=dir permissive=0

Comment 9 Lukas Vrabec 2019-08-01 08:52:26 UTC
commit 990dba1c4b6cf8d605bd1aa0e5ded481c585e0e7 (HEAD -> rawhide, origin/rawhide, origin/HEAD)
Author: Lukas Vrabec <lvrabec>
Date:   Thu Aug 1 10:36:43 2019 +0200

    Update bind_read_cache() interface to allow caller domain also list named_cache_t dirs.
    
    Resolves: rhbz#1732723

Comment 10 Fedora Update System 2019-09-05 06:52:21 UTC
FEDORA-2019-be14ea0375 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-be14ea0375

Comment 11 Fedora Update System 2019-09-05 12:53:17 UTC
selinux-policy-3.14.3-45.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-be14ea0375

Comment 12 Fedora Update System 2019-09-06 12:33:54 UTC
selinux-policy-3.14.3-45.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.


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