Skip to content
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

Permissions issues when running/building as non-root user #5

Open
jaronsummers opened this issue Sep 7, 2020 · 3 comments
Open

Permissions issues when running/building as non-root user #5

jaronsummers opened this issue Sep 7, 2020 · 3 comments

Comments

@jaronsummers
Copy link

Hello!

As expected, RPM does not like running as non-root, because it mangles a lot of the permissions in the archives.

However, I'm also seeing a related-but-separate issue wherein the permissions on / get set to 0700, making the container unusable for non-root users.

I fixed it by adding subprocess.check_call(["chmod", "0755", dirpath]) at the end of the archive generation process, which seems like it should always be correct because 0755 is the expected mode for /, but I imagine there are edge-cases I am not thinking of.

Are you still maintaining this repo? Are you open to PRs?

There are also some other issues related to the resulting image having incorrect ctime (epoch time 0) that I might look into.

Lastly, do you have any thoughts on how to ensure that the file ownership inside the image layer is correct? I made some very basic attempts at wrapping the cpio commands with fakeroot, but nothing that bore fruit.

@rmohr
Copy link
Owner

rmohr commented Oct 19, 2020

Hi, sorry for the very late reply. Yes. I am maintaining it and we are actively using it. Happy to look at any pr.

@rmohr
Copy link
Owner

rmohr commented Oct 19, 2020

What we do in kubevirt, is building everything in a build container with podman or docker to have everything right. Podman has the advantage of using user namespaces, which means that it is at least secure to build with 'root'.

@rmohr
Copy link
Owner

rmohr commented Oct 19, 2020

I am currently working on an improvement where the files are directly written into tar archives and never extracted to disk. That should in theory keep everything 100% in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants