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

[WIP] Make vtpm run as a non-root user #3060

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shjala
Copy link
Contributor

@shjala shjala commented Feb 23, 2023

I'm trying to make vtpm run with a non-root user, I have tried the USER configuration in docker file and also in the docker-compose file, but for some reason unknown to me it is not respected, and no matter what it gets executed as root user in run-time.

This is a hacky way to make it run as a non-root user and be functional.

any alternative solution?

@shjala
Copy link
Contributor Author

shjala commented Feb 23, 2023

@rouming

@shjala shjala marked this pull request as draft February 23, 2023 14:47
Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
@@ -70,6 +70,17 @@ FROM scratch

COPY --from=build /out/ /
COPY init.sh /usr/bin/

# HACK BEGIN
Copy link
Contributor

Choose a reason for hiding this comment

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

@deitch do you have an example of Linuxkit containers running with a particular user and group id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ping @deitch

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@christoph-zededa looks like that is to use/create a user namespace, and not a user. Let me ping @deitch offline.

Copy link
Contributor

Choose a reason for hiding this comment

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

I will take a look. Sorry for not responding earlier; GitHub alert overload makes me miss a few things.

Copy link
Contributor

Choose a reason for hiding this comment

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

There was some logic we added a while back to collect containerd logs, in case it is containerd itself that is having an issue. That often scrolls by on console without a chance to see it. I will see if I can find it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yes, here it is. vtpm is under services: and not onboot:, right? So containerd is running it.

See if this helps, build an image with modified containerd logging and see if that gives anything.

Copy link
Contributor Author

@shjala shjala Apr 4, 2023

Choose a reason for hiding this comment

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

I moved it up to the onboot, now eve just freeze trying to execute it (without any onscreen log), I'm not acquainted with linuxkit, but tried to export it and load in docker and this happens:

make IMAGE=lfedge/eve-vtpm:8979f64dd03931c6a6453b7b30ba61e2ad69ef28-dirty-95d5ec3 cache-export-docker-load
docker run -it lfedge/eve-vtpm:8979f64dd03931c6a6453b7b30ba61e2ad69ef28-dirty-95d5ec3

and :

docker ps
CONTAINER ID   IMAGE                                                                    COMMAND                  CREATED              STATUS              PORTS     NAMES
37af2d2fb908   lfedge/eve-vtpm:8979f64dd03931c6a6453b7b30ba61e2ad69ef28-dirty-95d5ec3   "/usr/bin/init.sh"       About a minute ago   Up About a minute             blissful_newton
f859888a7475   moby/buildkit:v0.11.0-rc2                                                "buildkitd --allow-i…"   10 days ago          Up 10 days                    linuxkit-builder

then :

docker exec -it lfedge/eve-vtpm:8979f64dd03931c6a6453b7b30ba61e2ad69ef28-dirty-95d5ec3 /bin/sh
Error response from daemon: No such container: lfedge/eve-vtpm:8979f64dd03931c6a6453b7b30ba61e2ad69ef28-dirty-95d5ec3

I'm out of ideas.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's your image. Your container ID is 37af2d2fb908

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you try the containerd logging?

@eriknordmark
Copy link
Contributor

@shjala with apparmor in place, are you still pursuing this PR? If so we need to pull in @deitch to figure out the issues.

@shjala
Copy link
Contributor Author

shjala commented Jul 12, 2023

@eriknordmark yes I would like to have both DAC and MAC properly in place, I will try once more and then ask Avi if unsuccessful.

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.

None yet

4 participants