Skip to content

[20.10 backport] rootless: avoid /run/xtables.lock EACCES on SELinux hosts ; disable overlay2 if running with SELinux ; fix "x509: certificate signed by unknown authority" on openSUSE Tumbleweed #42462

Merged
thaJeztah merged 3 commits intomoby:20.10from
AkihiroSuda:cherrypick-rootless-selinux-42334
Jul 15, 2021

Conversation

@AkihiroSuda
Copy link
Member

@AkihiroSuda AkihiroSuda commented Jun 4, 2021

Backport


#42199 (dockerd-rootless.sh: avoid /run/xtables.lock EACCES on SELinux hosts)

- What I did
Fix #41230

- How I did it

Previously, running dockerd-rootless.sh on SELinux-enabled hosts was failing with can't open lock file /run/xtables.lock: Permission denied error. (issue #41230).

This commit avoids hitting the error by relabeling /run in the RootlessKit child.
The actual /run on the parent is unaffected.

https://github.com/containers/podman/blob/e6fc34b71aa9d876b1218efe90e14f8b912b0603/libpod/networking_linux.go#L396-L401

- How to verify it

  • Install Rootless Docker to Fedora 34, without disabling SELinux
  • Make sure the daemon starts up without can't open lock file /run/xtables.lock: Permission denied error

- Description for the changelog

dockerd-rootless.sh: avoid can't open lock file /run/xtables.lock: Permission denied errorSELinux hosts

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


#42334 (rootless: disable overlay2 if running with SELinux)

- What I did

Close #42333 (rootless+overlay2 (kernel 5.11)+SELinux: mkdir /home/<USER>/.local/share/docker/overlay2/<CID>-init/merged/dev: permission denied. )

- How I did it
Disable overlay2 when $_DOCKERD_ROOTLESS_SELINUX is set.

We can't rely on go-selinux.GetEnabled() because RootlessKit doesn't mount /sys/fs/selinux in the child: rootless-containers/rootlesskit#94

- How to verify it

  • Install to Fedora 34
  • Make sure docker info shows fuse-overlayfs as the default storage driver on rootless, while retaining overlay2 on rootful
  • Make sure docker run hello-world works on rootless

- Description for the changelog

rootless: disable overlay2 if running with SELinux
- A picture of a cute animal (not mandatory but encouraged)
🐧


#42457 (rootless: fix "x509: certificate signed by unknown authority" on openSUSE Tumbleweed)

- What I did
Fix "x509: certificate signed by unknown authority" error on openSUSE Tumbleweed.

openSUSE Tumbleweed was facing this error, as /etc/ssl/ca-bundle.pem is provided as a symlink to ../../var/lib/ca-certificates/ca-bundle.pem, which was not supported by rootlesskit --copy-up=/etc .

See rootless-containers/rootlesskit#225

- How I did it

By bind-mounting /etc/ssl from the parent namespace into the child.

- How to verify it
Run docker --context=rootless pull hello-world on an openSUSE Tumbleweed host.

- Description for the changelog

rootless: fix "x509: certificate signed by unknown authority" on openSUSE Tumbleweed

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

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

Previously, running dockerd-rootless.sh on SELinux-enabled hosts
was failing with "can't open lock file /run/xtables.lock: Permission denied" error.
(issue 41230).

This commit avoids hitting the error by relabeling /run in the RootlessKit child.
The actual /run on the parent is unaffected.

https://github.com/containers/podman/blob/e6fc34b71aa9d876b1218efe90e14f8b912b0603/libpod/networking_linux.go#L396-L401

Tested on Fedora 34

Signed-off-by: Akihiro Suda <[email protected]>
(cherry picked from commit cdaf82b)
Signed-off-by: Akihiro Suda <[email protected]>
Kernel 5.11 introduced support for rootless overlayfs, but incompatible with SELinux.

On the other hand, fuse-overlayfs is compatible.

Close issue 42333

Signed-off-by: Akihiro Suda <[email protected]>
(cherry picked from commit 4300a52)
Signed-off-by: Akihiro Suda <[email protected]>
…SUSE Tumbleweed

openSUSE Tumbleweed was facing "x509: certificate signed by unknown authority" error,
as `/etc/ssl/ca-bundle.pem` is provided as a symlink to `../../var/lib/ca-certificates/ca-bundle.pem`,
which was not supported by `rootlesskit --copy-up=/etc` .

See rootless-containers/rootlesskit issues 225

Signed-off-by: Akihiro Suda <[email protected]>
(cherry picked from commit 8610d8c)
Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda AkihiroSuda force-pushed the cherrypick-rootless-selinux-42334 branch from 60a9a80 to b9cf7b7 Compare July 6, 2021 09:57
@AkihiroSuda AkihiroSuda changed the title [20.10 backport] rootless: avoid /run/xtables.lock EACCES on SELinux hosts ; disable overlay2 if running with SELinux [20.10 backport] rootless: avoid /run/xtables.lock EACCES on SELinux hosts ; disable overlay2 if running with SELinux ; fix "x509: certificate signed by unknown authority" on openSUSE Tumbleweed Jul 6, 2021
@AkihiroSuda
Copy link
Member Author

@tonistiigi PTAL

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

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

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.

4 participants