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

libpod: Apply SELinux KVM label if process contains "kata" in its name #9584

Conversation

fidencio
Copy link

@fidencio fidencio commented Mar 2, 2021

We currently only apply the label when the user calls podman --runtime kata ..., which may not happen in several different cases, including
testing binaries which are not part of the PATH.

In order to avoid forcing the user to pass --security-opt label=type:..., let's follow a similar logic than the one implemented
on the CRI-O side and apply the KVM label to the processes in case the
runtime binary contains "kata" as part of its name.

Fixes: #9582

Signed-off-by: Fabiano Fidêncio [email protected]

We currently only apply the label when the user calls `podman --runtime
kata ...`, which may not happen in several different cases, including
testing binaries which are not part of the PATH.

In order to avoid forcing the user to pass `--security-opt
label=type:...`, let's follow a similar logic than the one implemented
on the CRI-O side and apply the KVM label to the processes in case the
runtime binary contains "kata" as part of its name.

Fixes: containers#9582

Signed-off-by: Fabiano Fidêncio <[email protected]>
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fidencio
To complete the pull request process, please assign rhatdan after the PR has been reviewed.
You can assign the PR to them by writing /assign @rhatdan in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@brianredbeard
Copy link

At a minimum, shouldn't this do a bit more checking than a partial string match?

@fidencio
Copy link
Author

fidencio commented Mar 2, 2021

At a minimum, shouldn't this do a bit more checking than a partial string match?

I'm open to suggestions, @brianredbeard.

By the way, here you can find what's done on CRI-O side:
https://github.com/cri-o/cri-o/blob/091b0208c3a4659ad5f2f66011a7be012d51d775/server/sandbox_run_linux.go#L864-L867

@mheon
Copy link
Member

mheon commented Mar 2, 2021

This seems unnecessary? We added the runtime_supports_kvm config table already for this purpose. Runtimes requiring this should be marked in the config file. Doing it based on a string match instead seems questionable.

@fidencio
Copy link
Author

fidencio commented Mar 3, 2021

This seems unnecessary? We added the runtime_supports_kvm config table already for this purpose. Runtimes requiring this should be marked in the config file. Doing it based on a string match instead seems questionable.

Okay, no biggie.

@rhatdan, we discussed this over the IRC, but seems we better not address this case. At least now it's documented (as in, issue and discussions) that this is not something that was missed and it's the intended behaviour.

@rhatdan
Copy link
Member

rhatdan commented Mar 3, 2021

Should we go the other way though. Basically look at kata paths, and if we get a match then we do the SELinux labels.

# kata = [
#            "/usr/bin/kata-runtime",
#            "/usr/sbin/kata-runtime",
#            "/usr/local/bin/kata-runtime",
#            "/usr/local/sbin/kata-runtime",
#            "/sbin/kata-runtime",
#            "/bin/kata-runtime",
#            "/usr/bin/kata-qemu",
#            "/usr/bin/kata-fc",

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kata: running podman --runtime /path/to/kata/binary doesn't automatically apply the correct SELinux labels
5 participants