Bug 1968163 - Equivalency contexts do not support wildcards or regex (".*" or "[^/]*"), preventing directories from being labeled correctly
Summary: Equivalency contexts do not support wildcards or regex (".*" or "[^/]*"), pre...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: policycoreutils
Version: 37
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Petr Lautrbach
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-06 11:55 UTC by Renaud Métrich
Modified: 2023-12-05 21:01 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-12-05 21:01:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Renaud Métrich 2021-06-06 11:55:00 UTC
Description of problem:

My project stores file system trees undeer /var/myproject/fs/SOMEDIR, with SOMEDIR being the name of the filesystem tree, e.g. /var/myproject/packages/rhel7.1 and /var/myproject/packages/rhel8.1

Since these file system trees will be accessed through a chroot, I want to have the proper label applied.
The easiest way would be to create an equivalency rule from / to /var/myproject/fs/SOMEDIR, as shown below:

1. either "/var/myproject/fs/[^/]* = /"
2. or "/var/myproject/fs/.* = /"

Unfortunately this doesn't work at all, the context remains var_t:

$ matchpathcon -m d /var/myproject/fs/rhel7.1/usr/bin
[...] system_u:object_r:var_t:s0


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

selinux-policy-34.9-1.fc34.noarch


How reproducible:

Always

Steps to Reproduce:
1. Create a directory tree

  # mkdir -p /var/myproject/fs/foo/usr/bin /var/myproject/fs/bar/etc

2. Create the equivalency rule

  # semanage fcontext -a -e / "/var/myproject/fs/.*"

3. Check the contexts

  # matchpathcon /var/myproject/fs/foo/usr/bin /var/myproject/fs/bar/etc
  /var/myproject/fs/foo/usr/bin	system_u:object_r:var_t:s0
  /var/myproject/fs/bar/etc	system_u:object_r:var_t:s0

  # sudo restorecon -rv /var/myproject/fs/foo/usr/bin /var/myproject/fs/bar/etc

Actual results:

No relabel

Expected results:

Relabel

Comment 1 Ben Cotton 2022-05-12 16:24:16 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 2 Ben Cotton 2022-08-09 13:36:44 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 3 Aoife Moloney 2023-11-23 00:05:38 UTC
This message is a reminder that Fedora Linux 37 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 37 on 2023-12-05.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '37'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 37 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 4 Aoife Moloney 2023-12-05 21:01:14 UTC
Fedora Linux 37 entered end-of-life (EOL) status on None.

Fedora Linux 37 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


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