-
Notifications
You must be signed in to change notification settings - Fork 1.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
Fix the /kaniko directory permissions in container #2009
Fix the /kaniko directory permissions in container #2009
Conversation
Create /kaniko directory with world permission to allow the creation of sub directories by any user when the executor is run as non root. This can lower the security but shouldn't have any impact in a container. The tar unpack is the only way I found to have a directory with specific permission as the image is created from "scratch" which doesn't have any tool to change the permission otherwise. Fixes GoogleContainerTools#1363
How is kaniko.tar generated? I'm not comfortable having such an opaque file in this repo that we can't regenerate, or generate on-demand. As an alternative to unpacking kaniko.tar into the Also, ideally this kind of change would include some kind of test, or even manual testing instructions, to demonstrate that it works as intended. An automated test is ideal because we can run it on future changes to ensure they don't undo this behavior. |
Yes, sorry, I forgot to add it, it's just an tar from an empty directory. I will add a new commit with the file creation in the makefile.
I'm not an expert in docker, but I've tested it and it doesn't keep the permission. Maybe I've done it wrong.
I didn't find any automated test with the image creation to inspire me :) Do you have a link to an example where I can change the user ? |
Use the Makefile to create the tar file use to create kaniko directory in scratch container. This avoid having a "blackbox" binary file with the empty directory.
For what its worth, I built an image with these changes and can confirm it fixed the specific issue about /kaniko permissions so that one wont see that error message when trying to use a different user when running the container. |
I'm not really happy about this change since it broke every build outside of make:
|
Fixes #1363
Description
Create /kaniko directory with world permission to allow the creation of
sub directories by any user when the executor is run as non root. This
can lower the security but shouldn't have any impact in a container.
The tar unpack is the only way I found to have a directory with specific
permission as the image is created from "scratch" which doesn't have any
tool to change the permission otherwise.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
The container build will fail if there is an issue with the change
The container build will fail if there is an issue with the change
See the contribution guide for more details.
Reviewer Notes
Release Notes