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

Support containers launched with user namespace #7

Merged
merged 3 commits into from
Oct 11, 2024
Merged

Support containers launched with user namespace #7

merged 3 commits into from
Oct 11, 2024

Conversation

nbdd0121
Copy link
Contributor

@nbdd0121 nbdd0121 commented Oct 3, 2024

By default Docker/k8s run the root user inside the container as the root user of the host. This means that there's syscall filtering and path masking necessary to prevent the root of inside container from escaping. This negatively affects Nix sandboxing inside containers, because syscalls it rely on are blocked.

User namespaces also the root user inside a container to be mapped to a non-root user -- this would make all filtering and masking unnecessary (and is what rootless containers use). When we enable userns, we can then disable filtering/masking without compromising security, and then enable Nix sandbox.

src/util/namespace.rs Outdated Show resolved Hide resolved
src/util/namespace.rs Outdated Show resolved Hide resolved
.cargo/config.toml Outdated Show resolved Hide resolved
Copy link

@pamaury pamaury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ok to me but I don't know enough about the details of namespaces to give some detailed feedback.

@nbdd0121 nbdd0121 merged commit 7059bf7 into main Oct 11, 2024
1 check passed
@nbdd0121 nbdd0121 deleted the userns branch October 11, 2024 11:50
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

Successfully merging this pull request may close these issues.

2 participants