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 2099194 - Files in /tmp-inst/ directory (and sub-dirs) are not labeled correctly
Summary: Files in /tmp-inst/ directory (and sub-dirs) are not labeled correctly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: selinux-policy
Version: 9.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 9.2
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 2091979
TreeView+ depends on / blocked
 
Reported: 2022-06-20 09:52 UTC by Renaud Métrich
Modified: 2023-11-07 11:22 UTC (History)
2 users (show)

Fixed In Version: selinux-policy-38.1.15-1.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:52:15 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github fedora-selinux selinux-policy pull 1593 0 None Merged Add none file context for polyinstantiated tmp dirs 2023-02-08 09:47:53 UTC
Red Hat Bugzilla 1919253 0 high CLOSED Invalid context in database for /var/tmp-inst, should be /var/tmp/tmp-inst 2024-03-25 17:57:24 UTC
Red Hat Bugzilla 1924656 1 None None None 2023-05-27 08:47:43 UTC
Red Hat Issue Tracker RHELPLAN-125745 0 None None None 2022-06-20 09:58:06 UTC
Red Hat Product Errata RHBA-2023:6617 0 None None None 2023-11-07 08:52:31 UTC

Description Renaud Métrich 2022-06-20 09:52:10 UTC
Description of problem:

This is a sub-BZ of BZ #2091979.
By default /tmp-inst is the root directory for poly-instantiation. Files under this directory have to be labeled with "<<None>>", similarly to regular /tmp.
But it's currently not the case, files get broken label "default_t" when using *restorecon*/*matchpathcon*:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# matchpathcon /tmp-inst/foo
/tmp-inst/foo	system_u:object_r:default_t:s0
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

We need the following rule to be added in the policy:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
/tmp-inst/.*                                       all files          <<None>>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

*Additionally*, files in /var/tmp/tmp-inst have to be labeled with "<<None>>" as well. This is the case but because of the inheritance on "/var/tmp", not on "/var/tmp/tmp-inst":
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
/var/tmp/.*                                        all files          <<None>>
/var/tmp/tmp-inst                                  directory          system_u:object_r:tmp_t:s0 
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

For clarity, I would recommend adding a rule on "/var/tmp/tmp-inst/.*" (which doesn't exist):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
/var/tmp/tmp-inst/.*                               all files          <<None>>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This would make things more clear when administrators want to setup a different path for poly-instantiation than /var/tmp/tmp-inst, which has to be done through creating an equivalency context.

Version-Release number of selected component (if applicable):

selinux-policy-34.1.29-1.el9_0.noarch

How reproducible:

Always

Steps to Reproduce:
1. Enable poly-instantiation for users (in /etc/security/namespace.conf)
2. Start pam_nameservice service to create the directories
3. Log in as a user
4. Check restorecon on the user

  # restorecon -Frnv /tmp-inst

Actual results:

# restorecon -Frnv /tmp-inst
Would relabel /tmp-inst/system_u:object_r:tmp_t:s0-s0:c0.c1023_user1/ssh-XXXXZqdMQd from unconfined_u:object_r:default_t:s0 to system_u:object_r:default_t:s0
Would relabel /tmp-inst/system_u:object_r:tmp_t:s0-s0:c0.c1023_user1/ssh-XXXXZqdMQd/agent.1024 from unconfined_u:object_r:default_t:s0 to system_u:object_r:default_t:s0

Expected results:

No relabel, stick to "<<None>>"

Comment 1 Zdenek Pytela 2023-02-08 09:48:14 UTC
Commit to backport:
f1458a62d Add none file context for polyinstantiated tmp dirs

Comment 13 errata-xmlrpc 2023-11-07 08:52:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (selinux-policy bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6617


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