-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Improve support for podman out of the box #4774
Conversation
…specific selinux contexts
Thanks for this patch. |
Hi, thank you for your time. The scope of the PR can be changed. I have put together all the things I know that might need changes to work flawlessly. If there is an issue with approach to a particular change or some change itself, I can rewrite it or drop it. Some of the changes might be even useful for |
Would need to think about these. But is using docker so annoying for you? It's much easier for us to not worry about podman especially since I don't know what it is nor do I use it.
This is a good question. But I'm not sure what the answer is. We could maybe think about making them unprivileged but I don't know if this is a high priority for us. |
Using podman is as simple as installing it from my package manager and it all just works in sane manner. The containers do not require any privileged daemons and run from normal user. As I go through the steps in official installation steps for docker, it would requires for me to install third party repositories, software, modifying my kernel configuration (probably breaking podman) and running (untrusted) daemon on my machine to achieve technically the same. |
Just for the record
always pulls 3 year old images like https://console.cloud.google.com/gcr/images/oss-fuzz/GLOBAL/systemd and replaces local images with them. I removed the "platform" argument from |
I am still keeping track and updating this branch that I use for running the tools with docker successfully even with the recent changes regarding the arm, if I remember right, but looks like I did not push the changes. I will try to do that next week. |
@Jakuje just out of curiosity I wonder why
it seems to be intentional (even though it isn't compatible with
@jonathanmetzman is there any chance this patch can be reconsidered? On Fedora (and some other rpm-based distributions) |
Having experimented with $ id
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
$ getenforce
Enforcing
$ ls -ldZ .
drwxr-xr-x. 16 vagrant vagrant unconfined_u:object_r:user_home_t:s0 4096 Nov 6 19:58 .
$ ls -ldZ build
drwxr-xr-x. 5 vagrant vagrant unconfined_u:object_r:user_home_t:s0 4096 Nov 6 19:56 build
$ ls -ldZ dbus-broker
drwxr-xr-x. 9 vagrant vagrant unconfined_u:object_r:user_home_t:s0 4096 Nov 6 19:55 dbus-broker ( |
AFAIK there is still some change needed to make all use cases working with SELinux. If your files and directories have already updated selinux labels, it will probably look like the changes are not needed, but if not, you still need them. But other option might be using the Running privileged container that has access to the whole of your system might be also blocker for some.
In this I was wrong. I rebased the changes, but implemented some hacks to prefer local images over the remote ones to get the work done and then I forgot about that. Seems like what is described in containers/podman/issues#12682 is the problem we are hitting there. But would this be solved with providing the explicit |
Agreed.
Based on my experiments |
Before I forget I ended up pointing #!/usr/bin/bash
args=()
is_build=false
for a in "$@"; do
if [[ "$a" == "build" ]]; then
is_build=true
elif [[ "$a" =~ ^gcr\.io/oss-fuzz/ && "$is_build" != "true" ]]; then
args+=("--pull=never")
fi
args+=("$a")
done
[ -e /etc/containers/nodocker ] || \
echo "Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg." >&2
exec /usr/bin/podman "${args[@]}" It's ugly but it more or less works even with I still think that it would be great if it was possible to integrate |
As stated in #4763 I am using the helper script with podman for some time, but it does not work out of the box so I had to maintain couple of changes and make sure the correct selinux permissions are in place and containers run as expected.
This PR provides a couple of changes that should make the use of podman as a container engine more usable out of the box, but it will probably require some polishing:
podman
is detected by existence of/bin/podman
-- the simplest I was able to figure out.docker
CLI, but why when we already know it is there.podman
requires the files and directories that are mounted to the container to havecontainer_file_t
SELinux type as a security measure to make sure evil containers do not have access unintended files on the whole local filesystem (if used improperly)build
directory (all the other files created under it inherit this context by itself)podman
having both--privileged
and--cap-add SYS_PTRACE
is invalid (not sure what it should do withdocker
anyway -- maybe worth checkingdocker
docs):podman
very happily run all stuff in non-privileged containers, but the only issue I noticed was inreproduce
subcommand, that Leaksanitizer complains (not sure if it has any functional difference, but it goes away when I add--cap-add SYS_PTRACE
instead, which sounds a better solution):I did no run any comprehensive testsuite of the helper so there might be still some corner cases that will not work. This could be solved by running some tests in CI not only on your default systems, but also in Fedora.