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 2113941 - podman did not set selinux labels to symbolic links
Summary: podman did not set selinux labels to symbolic links
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: podman
Version: 8.6
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jindrich Novy
QA Contact: Alex Jia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-02 11:28 UTC by dominik.holler
Modified: 2023-09-18 04:43 UTC (History)
10 users (show)

Fixed In Version: podman-4.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-08 09:16:44 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github containers podman pull 13689 0 None closed build(deps): bump github.com/opencontainers/selinux from 1.10.0 to 1.10.1 2022-08-18 06:04:28 UTC
Red Hat Issue Tracker RHELPLAN-129888 0 None None None 2022-08-02 11:30:57 UTC
Red Hat Product Errata RHSA-2022:7457 0 None None None 2022-11-08 09:17:17 UTC

Description dominik.holler 2022-08-02 11:28:12 UTC
Description of problem:
Running a command like 
`podman run -p 22:22 --name rsync6e -m 512m -h rsync   --uidmap 0:100000:500000   -v $RSYNC_BASE/home:/home:Z,ro   -v $RSYNC_BASE/etc/ssh/:/etc/ssh:Z,ro  -v $RSYNC_DATA:/mnt/data2:Z rsync6 `
as root,  the files in $RSYNC_DATA got relabeld as expected, except symbol links, e.g.:
```
[root@ship ~]# ls -lZ /srv/rsync/data/bak/xxx/Programme/xxx/jre/lib/i386/client/                                                               
total 18916                                                                                                                   
-r--r--r--. 87 101001 101001 system_u:object_r:container_file_t:s0:c277,c298 14008320 Sep 15  2011 classes.jsa                                                                                                    
lrwxrwxrwx. 87 101001 101001 system_u:object_r:container_file_t:s0:c527,c785       13 Sep 15  2011 libjsig.so -> ../libjsig.so                                                                                 
-rwxr-xr-x. 87 101001 101001 system_u:object_r:container_file_t:s0:c277,c298  5355014 Mar 25  2008 libjvm.so
-rw-r--r--. 87 101001 101001 system_u:object_r:container_file_t:s0:c277,c298     1423 Mar 25  2008 Xusage.txt 
```
and from inside the container:
```
root@rsync:/mnt/data2/bak/xxx# ls -lsh /mnt/data2/bak/xxx/Programme/xxx/jre/lib/i386/client/                                                                                                         
ls: cannot access '/mnt/data2/bak/xxx/Programme/xxx/jre/lib/i386/client/libjsig.so': Permission denied                                                                                                 
total 19M
4.0K -rw-r--r--. 87 xxx xxx 1.4K Mar 25  2008 Xusage.txt
 14M -r--r--r--. 87 xxx xxx  14M Sep 15  2011 classes.jsa
   ? l??????????  ? ?       ?          ?            ? libjsig.so
5.2M -rwxr-xr-x. 87 xxx xxx 5.2M Mar 25  2008 libjvm.so

```

Version-Release number of selected component (if applicable):
podman-4.0.2-6.module+el8.6.0+14877+f643d2d6.x86_64


How reproducible:
only happend a single time


Actual results:
The container has no permissions to access symbolic links.

Expected results:
The container has permissions to access symbolic links.

Additional info:
Setting the context manually worked as expected:
` chcon -R  system_u:object_r:container_file_t:s0:c277,c298 /srv/rsync/data/bak`
No relevant information in journalctl

Comment 1 Daniel Walsh 2022-08-02 12:22:00 UTC
This is fixed in podman 4.1

Comment 3 Tom Sweeney 2022-08-02 18:52:35 UTC
Assigning to Jindrich for any further BZ/packaging needs

Comment 5 Daniel Walsh 2022-08-17 18:39:29 UTC
https://github.com/opencontainers/selinux/pull/173
Which was released in v1.10.1

Which should have come into Podman here:

https://github.com/containers/podman/pull/13689

Comment 6 Tom Sweeney 2022-08-18 21:05:24 UTC
@jnovy Can this BZ be moved into ON_QA state?  This was fixed in Podman 4.1.0 and beyond, maybe a bit earlier.

Comment 9 Alex Jia 2022-08-19 09:52:06 UTC
I can reproduce this bug on podman-4.0.2-6.module+el8.6.0+14877+f643d2d6.x86_64
and verified it on podman 4.1.

Reproducer

[root@sweetpig-11 ~]# podman run -it -v /foo/data:/mnt/data:Z rhel7 ls -lZ /mnt/data
ls: cannot access /mnt/data/ls: Permission denied
?---------  ?    ?                                     ls
-rw-r--r--. root root system_u:object_r:container_file_t:s0:c539,c772 test.txt

[root@sweetpig-11 ~]# rpm -q podman runc
podman-4.0.2-6.module+el8.6.0+14877+f643d2d6.x86_64
runc-1.0.3-2.module+el8.6.0+14877+f643d2d6.x86_64

On 8.6

[root@sweetpig-11 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.6 (Ootpa)

[root@sweetpig-11 ~]# rpm -q podman runc
podman-4.1.1-2.module+el8.6.0+15917+093ca6f8.x86_64
runc-1.1.3-2.module+el8.6.0+15917+093ca6f8.x86_64

[root@sweetpig-11 ~]# podman run -it -v /foo/data:/mnt/data:Z rhel7 ls -lZ /mnt/data
lrwxrwxrwx. root root system_u:object_r:container_file_t:s0:c481,c637 ls -> /usr/bin/ls
-rw-r--r--. root root system_u:object_r:container_file_t:s0:c481,c637 test.txt

[root@sweetpig-11 ~]# podman run -it -v /foo/data:/mnt/data:Z rhel7 /mnt/data/ls
bin  boot  dev	etc  home  lib	lib64  media  mnt  opt	proc  root  run  sbin  srv  sys  tmp  usr  var

[root@sweetpig-11 ~]# podman run -it -v /foo/data:/mnt/data:Z rhel7 cat /mnt/data/test.txt
test

On 8.7

[root@ibm-x3650m4-01-vm-16 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.7 Beta (Ootpa)

[root@ibm-x3650m4-01-vm-16 ~]# rpm -q podman runc
podman-4.1.1-6.module+el8.7.0+15895+a6753917.x86_64
runc-1.1.3-2.module+el8.7.0+15895+a6753917.x86_64

[root@ibm-x3650m4-01-vm-16 ~]# podman run -it -v /foo/data:/mnt/data:Z rhel7 ls -lZ /mnt/data
lrwxrwxrwx. root root system_u:object_r:container_file_t:s0:c535,c760 ls -> /usr/bin/ls
-rw-r--r--. root root system_u:object_r:container_file_t:s0:c535,c760 test.txt

[root@ibm-x3650m4-01-vm-16 ~]# podman run -it -v /foo/data:/mnt/data:Z rhel7 /mnt/data/ls
bin  boot  dev	etc  home  lib	lib64  media  mnt  opt	proc  root  run  sbin  srv  sys  tmp  usr  var

[root@ibm-x3650m4-01-vm-16 ~]# podman run -it -v /foo/data:/mnt/data:Z rhel7 cat /mnt/data/test.txt
test

Comment 11 errata-xmlrpc 2022-11-08 09:16:44 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 (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-2022:7457

Comment 12 Red Hat Bugzilla 2023-09-18 04:43:38 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


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