Bug 1721821 - SELinux is preventing restorecon from 'associate' accesses on the filesystem efi.
Summary: SELinux is preventing restorecon from 'associate' accesses on the filesystem ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 30
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:e452b4358c2d3e23b05cc2d2ba3...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-19 06:40 UTC by dani
Modified: 2019-07-15 05:56 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.14.3-40.fc30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-07-13 01:06:49 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description dani 2019-06-19 06:40:32 UTC
Description of problem:
As per closed bug https://bugzilla.redhat.com/show_bug.cgi?id=1707756 I have run

restorecon -Rv /

as root
SELinux is preventing restorecon from 'associate' accesses on the filesystem efi.

*****  Plugin filesystem_associate (99.5 confidence) suggests   **************

If you believe restorecon should be allowed to create efi files
Then you need to use a different command. You are not allowed to preserve the SELinux context on the target file system.
Do
use a command like "cp -p" to preserve all permissions except SELinux context.

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

If you believe that restorecon should be allowed associate access on the efi filesystem 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 'restorecon' --raw | audit2allow -M my-restorecon
# semodule -X 300 -i my-restorecon.pp

Additional Information:
Source Context                system_u:object_r:efivarfs_t:s0
Target Context                system_u:object_r:sysfs_t:s0
Target Objects                efi [ filesystem ]
Source                        restorecon
Source Path                   restorecon
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.3-37.fc30.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.1.11-300.fc30.x86_64 #1 SMP Mon
                              Jun 17 19:33:15 UTC 2019 x86_64 x86_64
Alert Count                   1
First Seen                    2019-06-19 09:33:26 IDT
Last Seen                     2019-06-19 09:33:26 IDT
Local ID                      5a0c430b-7771-485d-840a-c8f8d5cf56bb

Raw Audit Messages
type=AVC msg=audit(1560926006.247:285): avc:  denied  { associate } for  pid=11447 comm="restorecon" name="efi" dev="sysfs" ino=6150 scontext=system_u:object_r:efivarfs_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=filesystem permissive=0


Hash: restorecon,efivarfs_t,sysfs_t,filesystem,associate

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

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

Comment 1 Lukas Vrabec 2019-06-19 15:40:56 UTC
Hi, 

Are you able to reproduce it? 

THanks,
Lukas.

Comment 2 dani 2019-06-20 09:13:16 UTC
Yes,

Running restorcon again produces same results:

[root@localhost ~]# restorecon -Rv /
Relabeled /root/.xauth3tLmLu from unconfined_u:object_r:admin_home_t:s0 to unconfined_u:object_r:xauth_home_t:s0
restorecon: Could not set context for /sys/firmware/efi:  Permission denied
Relabeled /run/ebtables.lock from system_u:object_r:firewalld_var_run_t:s0 to system_u:object_r:iptables_var_run_t:s0
Relabeled /run/user/1000/gvfs from unconfined_u:object_r:user_tmp_t:s0 to unconfined_u:object_r:fusefs_t:s0
Relabeled /run/user/1000/keyring from unconfined_u:object_r:user_tmp_t:s0 to unconfined_u:object_r:gkeyringd_tmp_t:s0
Relabeled /run/user/1000/keyring/pkcs11 from unconfined_u:object_r:user_tmp_t:s0 to unconfined_u:object_r:gkeyringd_tmp_t:s0
Relabeled /run/user/1000/keyring/ssh from unconfined_u:object_r:user_tmp_t:s0 to unconfined_u:object_r:gkeyringd_tmp_t:s0
Relabeled /run/user/1000/keyring/control from unconfined_u:object_r:user_tmp_t:s0 to unconfined_u:object_r:gkeyringd_tmp_t:s0

And the full setroublshoot text:
SELinux is preventing restorecon from associate access on the filesystem efi.

*****  Plugin filesystem_associate (99.5 confidence) suggests   **************

If you believe restorecon should be allowed to create efi files
Then you need to use a different command. You are not allowed to preserve the SELinux context on the target file system.
Do
use a command like "cp -p" to preserve all permissions except SELinux context.

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

If you believe that restorecon should be allowed associate access on the efi filesystem 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 'restorecon' --raw | audit2allow -M my-restorecon
# semodule -X 300 -i my-restorecon.pp

Additional Information:
Source Context                system_u:object_r:efivarfs_t:s0
Target Context                system_u:object_r:sysfs_t:s0
Target Objects                efi [ filesystem ]
Source                        restorecon
Source Path                   restorecon
Port                          <Unknown>
Host                          localhost.localdomain
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.3-37.fc30.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain 5.1.11-300.fc30.x86_64
                              #1 SMP Mon Jun 17 19:33:15 UTC 2019 x86_64 x86_64
Alert Count                   2
First Seen                    2019-06-19 09:33:26 IDT
Last Seen                     2019-06-20 12:06:57 IDT
Local ID                      5a0c430b-7771-485d-840a-c8f8d5cf56bb

Raw Audit Messages
type=AVC msg=audit(1561021617.270:287): avc:  denied  { associate } for  pid=4249 comm="restorecon" name="efi" dev="sysfs" ino=6150 scontext=system_u:object_r:efivarfs_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=filesystem permissive=0


Hash: restorecon,efivarfs_t,sysfs_t,filesystem,associate


Regards,
--Dani_L.

Comment 3 Lukas Vrabec 2019-06-20 15:34:06 UTC
commit 3043fa015b6ddde57bc43f5e5531f270caa60634 (HEAD -> rawhide, origin/rawhide)
Author: Lukas Vrabec <lvrabec>
Date:   Thu Jun 20 17:30:09 2019 +0200

    Allow associate efivarfs_t on sysfs_t

Comment 4 Fedora Update System 2019-07-10 12:46:31 UTC
FEDORA-2019-9c513c4cf8 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-9c513c4cf8

Comment 5 Fedora Update System 2019-07-11 00:50:32 UTC
selinux-policy-3.14.3-40.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-9c513c4cf8

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

Comment 7 dani 2019-07-15 05:56:45 UTC
Seems to work correctly now


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