Skip to content

update RootlessKit to 2.0.2#47504

Merged
thaJeztah merged 4 commits intomoby:masterfrom
AkihiroSuda:rootlesskit-2.0.2
Mar 6, 2024
Merged

update RootlessKit to 2.0.2#47504
thaJeztah merged 4 commits intomoby:masterfrom
AkihiroSuda:rootlesskit-2.0.2

Conversation

@AkihiroSuda
Copy link
Member

@AkihiroSuda AkihiroSuda commented Mar 5, 2024

- What I did

Fix #47480 (except docs) via:

- How I did it
Updated RootlessKit
rootless-containers/rootlesskit@v2.0.1...v2.0.2

- How to verify it

dockerd-rootless-setuptool.sh will print the following error if the apparmor constraint is not satisfied

WARN[0000] [rootlesskit:parent] This error might have happened because /proc/sys/kernel/apparmor_restrict_unprivileged_userns is set to 1  error="fork/exec /proc/self/exe: permission denied"
WARN[0000] [rootlesskit:parent] Hint: try running the following commands:


########## BEGIN ##########
cat <<EOT | sudo tee "/etc/apparmor.d/home.suda.bin.rootlesskit"
# ref: https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces
abi <abi/4.0>,
include <tunables/global>

/home/suda/bin/rootlesskit flags=(unconfined) {
  userns,

  # Site-specific additions and overrides. See local/README for details.
  include if exists <local/home.suda.bin.rootlesskit>
}
EOT
sudo systemctl restart apparmor.service
########## END ##########
 
[rootlesskit:parent] error: failed to start the child: fork/exec /proc/self/exe: permission denied

- Description for the changelog

update RootlessKit to [v2.0.2](https://github.com/rootless-containers/rootlesskit/releases/tag/v2.0.2)

- A picture of a cute animal (not mandatory but encouraged)

🐧

golang/sys@v0.16.0...v0.18.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
rootless-containers/rootlesskit@v2.0.1...v2.0.2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
RootlessKit will print hints if something is still unsatisfied.

e.g., `kernel.apparmor_restrict_unprivileged_userns` constraint
rootless-containers/rootlesskit@33c3e7c

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@thaJeztah
Copy link
Member

Curious;

  • should we also consider adding some of these (rootless-specific) checks to contrib/check-config.sh? (if apparmor is available, also check for the apparmor_restrict_unprivileged_userns feature?
  • Somewhat orthogonal; I notice the only place we use the rootlesskit vendoring is to include information to docker info, but we also (have to) do a bunch of local work to collect additional information;

    moby/daemon/info_unix.go

    Lines 264 to 313 in 460b4ae

    switch rlInfo.NetworkDriver.Driver {
    case "slirp4netns":
    err = func() error {
    rv, err := exec.CommandContext(ctx, "slirp4netns", "--version").Output()
    if err != nil {
    if errdefs.IsContext(err) {
    return err
    }
    log.G(ctx).WithError(err).Warn("Failed to retrieve slirp4netns version")
    return nil
    }
    _, ver, commit, err := parseRuntimeVersion(string(rv))
    if err != nil {
    log.G(ctx).WithError(err).Warn("Failed to parse slirp4netns version")
    return nil
    }
    v.Components = append(v.Components, types.ComponentVersion{
    Name: "slirp4netns",
    Version: ver,
    Details: map[string]string{
    "GitCommit": commit,
    },
    })
    return nil
    }()
    if err != nil {
    return err
    }
    case "vpnkit":
    err = func() error {
    out, err := exec.CommandContext(ctx, "vpnkit", "--version").Output()
    if err != nil {
    if errdefs.IsContext(err) {
    return err
    }
    log.G(ctx).WithError(err).Warn("Failed to retrieve vpnkit version")
    return nil
    }
    v.Components = append(v.Components, types.ComponentVersion{
    Name: "vpnkit",
    Version: strings.TrimSpace(strings.TrimSpace(string(out))),
    })
    return nil
    }()
    if err != nil {
    return err
    }
    }
    return nil
    wondering if those are parts that should eventually be handled by rootlesskit (and returned by the Info it returns) 🤔

@thaJeztah
Copy link
Member

☝️ TBH; still a bit looking at the best direction to take there; the rootlesskit case is a bit "weird" because it's rootlesskit running the engine, and the engine itself doesn't "call" rootlesskit here. Still somewhat wondering what it would take to integrate the rootlesskit functionality in the daemon itself.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Member

cc @vvoland (for back porting); I THINK we only need the last two commits (vendoring changes are effectively a "no-op" from a rootlesskit perspective.

@thaJeztah thaJeztah merged commit 4046928 into moby:master Mar 6, 2024
@AkihiroSuda
Copy link
Member Author

should we also consider adding some of these (rootless-specific) checks to contrib/check-config.sh? (if apparmor is available, also check for the apparmor_restrict_unprivileged_userns feature?

Ideally yes, but it could be complicated

Somewhat orthogonal; I notice the only place we use the rootlesskit vendoring is to include information to docker info, but we also (have to) do a bunch of local work to collect additional information;

Yes 👍, eventually

Still somewhat wondering what it would take to integrate the rootlesskit functionality in the daemon itself.

We may consider this, but it may rather result in more complicated code base

I THINK we only need the last two commits (vendoring changes are effectively a "no-op" from a rootlesskit perspective.

Yes

@vvoland
Copy link
Contributor

vvoland commented Mar 6, 2024

Opened a v25 backport.
Also wanted to open backports for v23/v24, but they're still on rootlesskit v1.:

moby/Dockerfile

Line 348 in c593074

ARG ROOTLESSKIT_VERSION=v1.1.1

@thaJeztah
Copy link
Member

Three's a pending one for v23.0, but it's "on hold";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rootless (non-dpkg): update docs and dockerd-rootless-setuptool.sh check for Ubuntu 24.04 (kernel.apparmor_restrict_unprivileged_userns)

3 participants