RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1908128 - SELinux is preventing clair from 'write' accesses on the directory /dev/shm.
Summary: SELinux is preventing clair from 'write' accesses on the directory /dev/shm.
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: container-selinux
Version: 8.5
Hardware: x86_64
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Daniel Walsh
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard: abrt_hash:f0ff72442c229d0dfc48163fb32...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-15 21:32 UTC by Khaled Janania
Modified: 2021-06-11 16:39 UTC (History)
17 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-11 13:05:29 UTC
Type: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Khaled Janania 2020-12-15 21:32:48 UTC
Description of problem:
Attempted to use podman to run a clair container.
SELinux is preventing clair from 'write' accesses on the directory /dev/shm.

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

If you want to fix the label. 
/dev/shm default label should be tmpfs_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 /dev/shm

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

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

Additional Information:
Source Context                system_u:system_r:container_t:s0:c419,c542
Target Context                system_u:object_r:tmp_t:s0
Target Objects                /dev/shm [ dir ]
Source                        clair
Source Path                   clair
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-3.14.5-45.fc32.noarch
Local Policy RPM              selinux-policy-targeted-3.14.5-45.fc32.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.9.11-100.fc32.x86_64 #1 SMP Tue
                              Nov 24 19:16:53 UTC 2020 x86_64 x86_64
Alert Count                   2
First Seen                    2020-12-15 16:30:50 EST
Last Seen                     2020-12-15 16:30:50 EST
Local ID                      fdb57832-dc00-4e88-8397-cace6676fbc5

Raw Audit Messages
type=AVC msg=audit(1608067850.250:873): avc:  denied  { write } for  pid=11509 comm="clair" name="/" dev="tmpfs" ino=1 scontext=system_u:system_r:container_t:s0:c419,c542 tcontext=system_u:object_r:tmp_t:s0 tclass=dir permissive=0


Hash: clair,container_t,tmp_t,dir,write

Version-Release number of selected component:
selinux-policy-targeted-3.14.5-45.fc32.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.13.1
hashmarkername: setroubleshoot
kernel:         5.9.11-100.fc32.x86_64
type:           libreport

Comment 1 Zdenek Pytela 2021-01-07 16:49:04 UTC
Switching the component since the process runs in container_t.

Also note the directory has tmp_t, not tmpfs_t type as one would expect.

Comment 3 Daniel Walsh 2021-01-25 15:29:43 UTC
What was the podman command used to start the container?  This looks like the volume inserted into the container needs to be relabeled with the :Z or :z.

Or SELinux needs to be disabled --security-opt label=disabled

Comment 4 Daniel Walsh 2021-06-11 13:05:29 UTC
Since this question was never answered, closing.


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