Bug 1900175

Summary: SELinux is preventing pool-geoclue from 'write' accesses on the sock_file io.systemd.Resolve.
Product: [Fedora] Fedora Reporter: Adam Williamson (Red Hat non-Fedora) <awilliam>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: high    
Version: 34CC: dwalsh, grepl.miroslav, lvrabec, mmalik, omosnace, plautrba, vmojzis, vondruch, zpytela
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:01e7215c472e9010ae813aa0de43a5ff5f16982d917495e44fbcb129d1087ae0;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-09-21 18:27:03 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 Adam Williamson (Red Hat non-Fedora) 2020-11-21 06:46:07 UTC
Description of problem:
Just happens periodically on my laptop after upgrading it to Rawhide. I don't seem to have to do anything in particular to trigger it.
SELinux is preventing pool-geoclue from 'write' accesses on the sock_file io.systemd.Resolve.

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

If you believe that pool-geoclue should be allowed write access on the io.systemd.Resolve sock_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 'pool-geoclue' --raw | audit2allow -M my-poolgeoclue
# semodule -X 300 -i my-poolgeoclue.pp

Additional Information:
Source Context                system_u:system_r:geoclue_t:s0
Target Context                system_u:object_r:systemd_resolved_var_run_t:s0
Target Objects                io.systemd.Resolve [ sock_file ]
Source                        pool-geoclue
Source Path                   pool-geoclue
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-3.14.7-8.fc34.noarch
Local Policy RPM              selinux-policy-targeted-3.14.7-8.fc34.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.10.0-0.rc4.78.fc34.x86_64 #1 SMP
                              Mon Nov 16 17:13:58 UTC 2020 x86_64 x86_64
Alert Count                   109
First Seen                    2020-11-20 11:51:42 PST
Last Seen                     2020-11-20 22:44:31 PST
Local ID                      fb400941-5e95-4ea1-a203-48e359341267

Raw Audit Messages
type=AVC msg=audit(1605941071.614:1664): avc:  denied  { write } for  pid=1413 comm="pool-geoclue" name="io.systemd.Resolve" dev="tmpfs" ino=1647 scontext=system_u:system_r:geoclue_t:s0 tcontext=system_u:object_r:systemd_resolved_var_run_t:s0 tclass=sock_file permissive=0


Hash: pool-geoclue,geoclue_t,systemd_resolved_var_run_t,sock_file,write

Version-Release number of selected component:
selinux-policy-targeted-3.14.7-8.fc34.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.14.0
hashmarkername: setroubleshoot
kernel:         5.10.0-0.rc4.78.fc34.x86_64
type:           libreport

Comment 1 Adam Williamson (Red Hat non-Fedora) 2020-11-30 06:10:19 UTC

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

Comment 2 Vít Ondruch 2021-01-24 21:17:26 UTC
I observe this issue again:

~~~
SELinux brání pool-geoclue z write přístupu k sock_file io.systemd.Resolve.

***** Plugin catchall (100. důvěry) naznačuje*********************************

Pokud jste přesvědčeni, že má pool-geoclue mít ve výchozím stavu přístup write na io.systemd.Resolve sock_file.
Pak měli byste tento problém nahlásit jako chybu.
Abyste přístup povolili, můžete vygenerovat lokální modul pravidel.
Udělejte
prozatím tento přístup povolíte příkazy:
# ausearch -c 'pool-geoclue' --raw | audit2allow -M my-poolgeoclue
# semodule -X 300 -i my-poolgeoclue.pp

Doplňující informace:
Kontext zdroje                system_u:system_r:geoclue_t:s0
Kontext cíle                  system_u:object_r:systemd_resolved_var_run_t:s0
Objekty cíle                  io.systemd.Resolve [ sock_file ]
Zdroj                         pool-geoclue
Cesta zdroje                  pool-geoclue
Port                          <Neznámé>
Počítač                       fedora
RPM balíčky zdroje            
RPM balíčky cíle              
SELinux Policy RPM            selinux-policy-targeted-3.14.7-14.fc34.noarch
Local Policy RPM              selinux-policy-targeted-3.14.7-14.fc34.noarch
Selinux povolen               True
Typ politiky                  targeted
Vynucovací režim              Enforcing
Název počítače                fedora
Platforma                     Linux fedora 5.10.7-200.fc33.x86_64 #1 SMP Tue Jan
                              12 20:20:11 UTC 2021 x86_64 x86_64
Počet upozornění              70
Poprvé viděno                 2021-01-23 19:13:08 CET
Naposledy viděno              2021-01-24 21:31:41 CET
Místní ID                     f6fbb9de-3cbf-4285-a54f-cdc5d0b16cde

Původní zprávy auditu
type=AVC msg=audit(1611520301.387:6936): avc:  denied  { write } for  pid=1103 comm="pool-geoclue" name="io.systemd.Resolve" dev="tmpfs" ino=1482 scontext=system_u:system_r:geoclue_t:s0 tcontext=system_u:object_r:systemd_resolved_var_run_t:s0 tclass=sock_file permissive=0


Hash: pool-geoclue,geoclue_t,systemd_resolved_var_run_t,sock_file,write
~~~

Comment 3 Zdenek Pytela 2021-01-25 21:12:52 UTC
The fix seems not have been complex enough.
https://github.com/fedora-selinux/selinux-policy/pull/551

Comment 4 Zdenek Pytela 2021-02-01 16:36:31 UTC
commit d356d9fbe2a5de71c7811fc8797302eef4102163 (HEAD -> rawhide, upstream/rawhide)
Author: Zdenek Pytela <zpytela>
Date:   Mon Jan 25 22:08:16 2021 +0100

    Allow domain write to systemd-resolved PID socket files

    Previously, the permission was allowed for the nsswitch_domain
    attribute which turned out not to be sufficient.

    Resolves: rhbz#1900175

Comment 5 Ben Cotton 2021-02-09 16:22:33 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.