Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1672404

Summary: SELinux preventing system_dbusd_t from reading dirs labeled container_file_t
Product: Red Hat Enterprise Linux 7 Reporter: Jonathan Lebon <jlebon>
Component: container-selinuxAssignee: Jindrich Novy <jnovy>
Status: CLOSED NOTABUG QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.6CC: lvrabec, mmalik, plautrba, ssekidde, vmojzis, zpytela
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-06 10:59:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathan Lebon 2019-02-04 21:01:39 UTC
Description of problem:

I'm trying to pass an fd to a dir labeled container_file_t from the rpm-ostree client to the daemon through D-Bus. SELinux blocks it with:

```
Feb 04 19:31:47 localhost.localdomain kernel: type=1400 audit(1549308707.590:9): avc:  denied  { read } for  pid=2973 comm="dbus-daemon" path="/var/lib/containers/storage/overlay/da27c1f519762f83fcf0d0dee24286e047957c5f12a67d436be7e6e4c2674289/merged/srv/repo" dev="overlay" ino=43458 scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:container_file_t:s0:c333,c948 tclass=dir permissive=0
```

This works in f29 at least.

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

```
[root@localhost ~]# rpm-ostree status
State: idle
AutomaticUpdates: disabled
Deployments:
● pivot://registry.svc.ci.openshift.org/rhcos/maipo@sha256:4cf4a15b0232d972d258d852cdb703c8cd75123afb1164c4377890a05f9f95b7
              CustomOrigin: Provisioned from oscontainer
                   Version: 47.301 (2019-02-04T12:48:34Z)
                  Unlocked: development
[root@localhost ~]# rpm -q container-selinux selinux-policy{,-targeted}
container-selinux-2.77-1.el7_6.noarch
selinux-policy-3.13.1-229.el7_6.9.noarch
selinux-policy-targeted-3.13.1-229.el7_6.9.noarch
```

How reproducible:

Always

Steps to Reproduce:
1. podman mount <cnt>
2. build rpm-ostree with https://github.com/projectatomic/rpm-ostree/pull/1732.
2. rpm-ostree rebase /path/to/container/mount:<checksum>

Actual results:

SELinux violation above.

Expected results:

No SELinux violation.

Additional info:

The context for this is https://github.com/projectatomic/rpm-ostree/pull/1732. For RHCOS, we're shipping OS content through a container, and it'd be nice if the client could directly pass the fd rather than having the daemon open the directory itself.

Note on f29 and el8 at least, I see:

```
# sesearch -A -t container_file_t | grep dbus
allow system_dbusd_t container_file_t:dir { getattr ioctl lock open read search };
...
```

So it seems like this was fixed in later versions.

Comment 2 Jonathan Lebon 2019-02-04 21:30:33 UTC
> build rpm-ostree with https://github.com/projectatomic/rpm-ostree/pull/1732

(I realize this is asking a lot for reproducing the issue. If anyone wants a more minimal testcase, I can whip something up that'd be easier to reproduce.)