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 2039974 - restorecon would relabel /run/stratisd
Summary: restorecon would relabel /run/stratisd
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
low
medium
Target Milestone: rc
: 9.0
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-12 20:02 UTC by Jiri Jaburek
Modified: 2022-05-17 16:12 UTC (History)
3 users (show)

Fixed In Version: selinux-policy-34.1.23-1.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 15:50:10 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1879585 1 medium CLOSED Stratis device paths move from /stratis to /dev/stratis 2023-06-14 10:17:36 UTC
Red Hat Issue Tracker RHELPLAN-107625 0 None None None 2022-01-12 20:08:56 UTC
Red Hat Product Errata RHBA-2022:3918 0 None None None 2022-05-17 15:50:18 UTC

Description Jiri Jaburek 2022-01-12 20:02:22 UTC
Description of problem:

# dnf install stratisd

# systemctl start stratisd

# restorecon -Rvvn /run
Would relabel /run/stratisd from system_u:object_r:stratisd_var_run_t:s0 to system_u:object_r:var_run_t:s0
Would relabel /run/stratisd/keyfiles from system_u:object_r:tmpfs_t:s0 to system_u:object_r:var_run_t:s0


Version-Release number of selected component (if applicable):
RHEL-9.0.0-20220108.3
stratisd-2.4.2-3.el9
selinux-policy-34.1.20-1.el9

Comment 2 Zdenek Pytela 2022-01-12 20:27:53 UTC
Looks stratisd changed runtime files to a directory, this is the current state:

/var/run/stratisd.*             --      gen_context(system_u:object_r:stratisd_var_run_t,s0)

Comment 3 Milos Malik 2022-01-14 11:29:09 UTC
Similar problem is reproducible on RHEL-8. For more information please read https://bugzilla.redhat.com/show_bug.cgi?id=1879585#c7

Comment 5 Zdenek Pytela 2022-01-25 17:41:23 UTC
I've submitted a draft Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/1025

Comment 14 Jiri Jaburek 2022-02-10 20:43:55 UTC
This has started appearing recently again, but with a different context,

# dnf install stratisd

# systemctl start stratisd

# restorecon -nvvR /run
Would relabel /run/stratisd/keyfiles from system_u:object_r:tmpfs_t:s0 to system_u:object_r:stratisd_var_run_t:s0


I'm not sure if the finding is a result of this BZ or if it's unrelated, though.

# rpm -q selinux-policy
selinux-policy-34.1.24-1.el9.noarch

An auditctl watch on /run/stratisd shows:

----
type=PROCTITLE msg=audit(02/10/2022 21:42:42.357:126) : proctitle=/usr/libexec/stratisd --log-level debug 
type=PATH msg=audit(02/10/2022 21:42:42.357:126) : item=1 name=/run/stratisd inode=989 dev=00:19 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:stratisd_var_run_t:s0 nametype=CREATE cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=PATH msg=audit(02/10/2022 21:42:42.357:126) : item=0 name=/run/ inode=1 dev=00:19 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_run_t:s0 nametype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=CWD msg=audit(02/10/2022 21:42:42.357:126) : cwd=/ 
type=SYSCALL msg=audit(02/10/2022 21:42:42.357:126) : arch=x86_64 syscall=mkdir success=yes exit=0 a0=0x55b95dbc1250 a1=0777 a2=0xe a3=0x6 items=2 ppid=1 pid=865 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=stratisd exe=/usr/libexec/stratisd subj=system_u:system_r:stratisd_t:s0 key=foobar 
----
type=PROCTITLE msg=audit(02/10/2022 21:42:42.357:127) : proctitle=/usr/libexec/stratisd --log-level debug 
type=PATH msg=audit(02/10/2022 21:42:42.357:127) : item=1 name=/run/stratisd/keyfiles inode=990 dev=00:19 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:stratisd_var_run_t:s0 nametype=CREATE cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=PATH msg=audit(02/10/2022 21:42:42.357:127) : item=0 name=/run/stratisd/ inode=989 dev=00:19 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:stratisd_var_run_t:s0 nametype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=CWD msg=audit(02/10/2022 21:42:42.357:127) : cwd=/ 
type=SYSCALL msg=audit(02/10/2022 21:42:42.357:127) : arch=x86_64 syscall=mkdir success=yes exit=0 a0=0x55b95dbc1250 a1=0777 a2=0x17 a3=0x6 items=2 ppid=1 pid=865 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=stratisd exe=/usr/libexec/stratisd subj=system_u:system_r:stratisd_t:s0 key=foobar

Comment 15 Milos Malik 2022-02-11 08:34:18 UTC
Here is an excerpt from the https://bugzilla.redhat.com/show_bug.cgi?id=1879585#c7:

* Under /run/stratisd/keyfiles, stratisd will mount other filesystems in a private mount namespace. I'm not entirely sure how this will interact with SELinux.

I'm not sure if SELinux can do much more in this situation, unless stratisd explicitly calls the restorecon command or a similar tool. The location and all objects under it are already covered:

# semanage fcontext -l | grep /run/stratis
/var/run/stratisd(/.*)?                            all files          system_u:object_r:stratisd_var_run_t:s0 
/var/run/stratisd.*                                regular file       system_u:object_r:stratisd_var_run_t:s0 
#

Comment 16 Zdenek Pytela 2022-02-11 12:49:06 UTC
In the current policy version I see:

rhel9# sesearch -T -s stratisd_t -t var_run_t -c dir
...
type_transition stratisd_t var_run_t:dir stratisd_var_run_t;

that is stratisd running in the stratisd_t domain creates directories in /var/run with the type transitioning to stratisd_var_run_t - so I don't understand why /run/stratisd/keyfiles would have tmpfs_t, and I infer from your command /run/stratisd is correct. I am not quite sure what happens next though when the mounts in the private mount namespace take place.

selinux-policy-34.1.24-1.el9.noarch is currently the latest version which should include all necessary rules.

Comment 18 errata-xmlrpc 2022-05-17 15:50:10 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 (new packages: selinux-policy), 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-2022:3918


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