Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-17258

Equivalency contexts do not support wildcards or path regex, preventing directories from being labeled correctly

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-9.3.0
    • policycoreutils
    • None
    • rhel-sst-security-selinux
    • ssg_security
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • None

      This RFE was filed as BZ 1968163 on Fedora but didn't get traction at all, I'm convinced this would be very helpful on RHEL.

      Goal

      • As an administrator, I would like to create equivalent contexts for custom project directories containing path regex "." or "[^/]" to simplify out-of-tree management

      Use Case 1

      My project stores file system trees under /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
      

      Use Case 2

      RHEL customers using custom trees for their applications, typically under /apps/projectX would also benefit from this and make their lives easier, especially when applications are deployed using symlinks to specific versions, e.g.:

      # ls -l /apps
      [...] myapp-1.1
      [...] myapp-1.2
      [...] myapp-1.3
      [...] myapp -> myapp-1.3
      

      Acceptance Criteria

      A list of verification conditions, successful functional tests, or expected outcomes in order to declare this story/task successfully completed.

      • Create equivalent path to / for /var/myproject/fs/[^/]*, execute restorecon or matchpathcon and confirm /var/myproject/fs/project is labeled with root_t
      • Create equivalent path to / for /var/myproject/fs/.*, execute restorecon or matchpathcon and confirm /var/myproject/fs/project is labeled with root_t

              rhn-engineering-plautrba Petr Lautrbach
              rhn-support-rmetrich Renaud Métrich
              Petr Lautrbach Petr Lautrbach
              SSG Security QE SSG Security QE
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: