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.
Description of problem:
I would like to be able to specify selinux options for volumes based on hostdirs. Currently I can only select read only or readwrite, it is missing the z and Z options.
From podman-run manpage:
To change a label in the container context, you can add either of two suffixes :z or :Z to the volume mount. These suffixes tell Podman to relabel file objects on the shared volumes. The z option tells Podman that two
containers share the volume content. As a result, Podman labels the content with a shared content label. Shared volume labels allow all containers to read/write content. The Z option tells Podman to label the content with a
private unshared label. Only the current container can use a private volume.
There was a bug against cockpit-docker but it was never finished:
https://github.com/cockpit-project/cockpit/issues/7181https://github.com/cockpit-project/cockpit/pull/9416
Version-Release number of selected component (if applicable):
cockpit-podman-11-1.module+el8.1.1+5259+bcdd613a.
How reproducible:
Create container from cockpit dashboard, only options you can select are readonly or readwrite
Actual results:
Unable to set z/Z option for a hostdir volume
Expected results:
Able to set z/Z option for a hostdir volume
Test with cockpit-podman-28.1-1.module+el8.4.0+10073+30e5ea69.noarch and seems the Z/z flag is not work as expected:
Create a container with share/private from cockpit-podman website, and check the container with inspect in the host. And the Mode Z/z is not set as expect:
# podman inspect romantic_elgamal --format "{{.Mounts}}"
[{bind /mnt/mytest /mnt [rbind] true rprivate}]
@ypu , this is not the correct way to test that. Mode z/Z has *no influence* on the mount, it is a file system property on the host on the bind mounted directory. E.g.
$ mkdir data
$ ls -ldZ data
drwxr-xr-x. 2 martin martin unconfined_u:object_r:user_tmp_t:s0 40 23. Feb 06:30 data
$ podman run -it -v ./data:/data:z registry.fedoraproject.org/fedora sleep infinity
$ ls -lZd data
drwxr-xr-x. 2 martin martin system_u:object_r:container_file_t:s0 40 23. Feb 06:30 data
^^ see how the z changed the type of the directory to container_file_t
$ podman inspect sharp_babbage --format "{{.Mounts}}"
[{bind /tmp/data /data [nosuid nodev rbind] true rprivate}]
The real test is whether you can access the directory inside the container with SELinux enabled:
$ podman exec sharp_babbage touch /data/hello.txt
$ ls -l data/hello.txt
-rw-r--r--. 1 martin martin 0 23. Feb 06:34 data/hello.txt
Without z/Z this would not work.
Hi Martin,
Thanks a lot for the information. I used to use a named volume with -v and the lable is shows in the Mounts. But you are right it is different from the directory mount. And double checked with cockpit-podman and both private and shared mode works as expected. So set this to verified.
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 (Moderate: container-tools:rhel8 security, 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/RHSA-2021:1796
Description of problem: I would like to be able to specify selinux options for volumes based on hostdirs. Currently I can only select read only or readwrite, it is missing the z and Z options. From podman-run manpage: To change a label in the container context, you can add either of two suffixes :z or :Z to the volume mount. These suffixes tell Podman to relabel file objects on the shared volumes. The z option tells Podman that two containers share the volume content. As a result, Podman labels the content with a shared content label. Shared volume labels allow all containers to read/write content. The Z option tells Podman to label the content with a private unshared label. Only the current container can use a private volume. There was a bug against cockpit-docker but it was never finished: https://github.com/cockpit-project/cockpit/issues/7181 https://github.com/cockpit-project/cockpit/pull/9416 Version-Release number of selected component (if applicable): cockpit-podman-11-1.module+el8.1.1+5259+bcdd613a. How reproducible: Create container from cockpit dashboard, only options you can select are readonly or readwrite Actual results: Unable to set z/Z option for a hostdir volume Expected results: Able to set z/Z option for a hostdir volume