unikraft / kraftkit

Build and use highly customized and ultra-lightweight unikernel VMs.
https://unikraft.org/docs/cli
BSD 3-Clause "New" or "Revised" License
225 stars 63 forks source link

`kraft net` almost unusable with multiple users #992

Open craciunoiuc opened 10 months ago

craciunoiuc commented 10 months ago

Describe the bug

Trying to use the kraft net subcommands together with kraft run is almost impossible when using multiple users.

In order to create a network interface you need to use sudo, and then you should be able to use it inside kraft run.

But, to use it there, you also need to use sudo for kraft run. This means that the user is changed and the path to the config also becomes changed (effectively using the home of root).

This can prove confusing as people ca run:

  1. sudo kraft run
  2. kraft ps

And then see no output, even though they should.

Steps to reproduce

No response

Expected behavior

No response

Which architectures were you using or does this bug affect?

x86_64, arm, arm64

Which operating system were you using or does this bug affect?

linux/debian, linux/fedora, linux/alpine, linux/arch, linux/other

Relevant log output

No response

craciunoiuc commented 2 months ago

@LucaSeri is it okay if I assign this issue to you? I know you bumped into this recently

I'm not sure how a fix looks like, probably making kraftkit somehow ask for sudo privileges when running just for the bridge creation.

On a successful run, in my head:

  1. kraftkit fetches all info related to bridges and prepares stuff (using user user)
  2. kraftkit invokes the bridge command, or whatever it does (using user root)
  3. kraftkit reports back on the status of the bridge creation and saves info (using user user)

This ensures that info is saved in the store with the correct permissions, and also the creation works as any user. It will of course ask for the root password, but that is to be expected.

Same in the case of kraft run, only exact, problematic operations should be grnted elevation, not everything