-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman cannot mount volumes with external symlinks #6003
Comments
Create a volume how? |
The work flow is
1) create a container with symlinks
2) set up a podman-compose or podman to mount a named volume with the
directory with symlinks
3) podman tries to populate the named volume by copying the files from the
container
4) and it fails
It appears that there is an internal check that throws an exception when
podman does a copy. I'd suggest changing
that exception into a warning.
The use case is that I have a container but I'd like to persist /etc and
/etc has a symlinks to files in /usr/share
…On Mon, Apr 27, 2020 at 11:55 PM Matthew Heon ***@***.***> wrote:
Create a volume how? podman volume create, mount into a container, add a
symlink in the volume?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6003 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAWGAGLOMUXSPEJZUXYPTF3ROWTI5ANCNFSM4MSA6Q3Q>
.
|
I believe this check it to prevent CVEs, We might be a little more strict then we need to be. |
We're using c/storage's |
Any suggestions on how to fix? I can add a flag to CopyWithTar to avoid the check when copying a volume |
That's definitely one way to do it. I somewhat wonder if we really need all of CopyWithTar for what should be a relatively simple copy. |
Is there any reason why I can't just replace CopyWithTar with a call to shutil? |
This patch uses termie/go-shutil to copy containers rather than tar. The problem with tar is that it does not copy symlinks pointing outside of the volume.
This patch uses internal copy to copy containers rather than tar. The problem with tar is that it does not copy symlinks pointing outside of the volume.
This patch uses internal copy to copy containers rather than tar. The problem with tar is that it does not copy symlinks pointing outside of the volume.
put in a fix in #6279 This turned out to be a very tricky patch to get right. |
A friendly reminder that this issue had no activity for 30 days. |
@joequant What is going on with this one? |
I have a patch that fixes the issue, but it turns out to be quite difficult to get everything right. Unfortunately, the solution for me is to keep using docker until someone else can figure out how to address this issue. |
@baude PTAL |
A friendly reminder that this issue had no activity for 30 days. |
Any update on this issue? |
I imagine that reworking our copyup code to use Buildah's |
@vrothberg did your rework of the copier code fix this issue? |
I don't believe he hit this code - only |
A friendly reminder that this issue had no activity for 30 days. |
@mheon Any chance you can work on this one? |
If it helps for testing, I received this when trying to run |
@rhatdan I can take a look once I'm done with what I'm working on now. |
Fix in #9308 |
The old copy-up implementation was very unhappy with symlinks, which could cause containers to fail to start for unclear reasons when a directory we wanted to copy-up contained one. Rewrite to use the Buildah Copier, which is more recent and should be both safer and less likely to blow up over links. At the same time, fix a deadlock in copy-up for volumes requiring mounting - the Mountpoint() function tried to take the already-acquired volume lock. Fixes containers#6003 Signed-off-by: Matthew Heon <mheon@redhat.com>
The old copy-up implementation was very unhappy with symlinks, which could cause containers to fail to start for unclear reasons when a directory we wanted to copy-up contained one. Rewrite to use the Buildah Copier, which is more recent and should be both safer and less likely to blow up over links. At the same time, fix a deadlock in copy-up for volumes requiring mounting - the Mountpoint() function tried to take the already-acquired volume lock. Fixes containers#6003 Signed-off-by: Matthew Heon <mheon@redhat.com>
/kind bug
Description
Podman volumes with external symlinks does not seem to be mountable
Steps to reproduce the issue:
Create volume with symlink which references files outside of the volume. For example symbolic link to ../foo
Try to mount the volume.
Volume does not mount
Describe the results you received:
Volume fails to mount
Describe the results you expected:
Volume should mount, and when I enter the image, I should see the symbolic link point to the file within the context of the mounted volume. This is the behavior in docker. Also these sorts of symbolic links are very common in directory /etc which points to /usr/share or to other directories outside the volume
Error: unable to start container 34e9c7636cd474d63741b93ecbd0dabfcab44aad263cedac4b4aa65ef93c5460: error copying content from container 34e9c7636cd474d63741b93ecbd0dabfcab44aad263cedac4b4aa65ef93c5460 into volume demo_etc: invalid symlink "/home/joe/.local/share/containers/storage/volumes/demo_etc/_data/httpd/logs" -> "../../var/log/httpd"
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:[joe@big-apple bench]$ podman version
Version: 2.0.0-dev
RemoteAPI Version: 1
Go Version: go1.14.2
OS/Arch: linux/amd64
Package info (e.g. output of
rpm -q podman
orapt list podman
):Additional environment details (AWS, VirtualBox, physical, etc.):
The text was updated successfully, but these errors were encountered: