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

remove k3s fcontexts #162

Merged
merged 1 commit into from
Jan 6, 2022
Merged

Conversation

dweomer
Copy link

@dweomer dweomer commented Jan 5, 2022

K3s brings its own embedded userland runtime and dumps it on disk under
/var/lib/rancher/k3s/data/${content_id=-"current"}/ which includes runc,
containerd, and the containerd shims. The initial k3s policy implementation
re-used existing policy types from container-selinux and marked all of
the disgorged userland (binaries and config, alike) as
container_runtime_exec_t which is what runc and the containerd bits
require. Because we ship busybox in this userland, with the shell
applet, this can lead to elevated privileges for any unconfined seuser
(the default for unmodified installations).

To address this problem we have re-written the k3s-selinux policy to
declare and leverage a couple of custom types for the various bits of
"content" that k3s brings. As such, the k3s-specific file-contexts that
were pushed upstream to here with #140 and
recently modified with #156 are no longer
appropriate to be maintained here. This PR removes the k3s-specific
file-context entries for:

  • systemd units
  • k3s binaries under /usr and /usr/local
  • everything under /var/lib/rancher/k3s and /var/run/k3s

Signed-off-by: Jacob Blain Christen jacob@rancher.com

K3s brings its own embedded userland runtime and dumps it on disk under
/var/lib/rancher/k3s/data/${content_id=-"current"}/ which includes runc,
containerd, and the containerd shims. The initial k3s policy implementation
re-used existing policy types from container-selinux and marked all of
the disgorged userland (binaries and config, alike) as
container_runtime_exec_t which is what runc and the containerd bits
require. Because we ship busybox in this userland, with the shell
applet, this can lead to elevated privileges for any unconfined seuser
(the default for unmodified installations).

To address this problem we have re-written the k3s-selinux policy to
declare and leverage a couple of custom types for the various bits of
"content" that k3s brings. As such, the k3s-specific file-contexts that
were pushed upstream to here with containers#140 and
recently modified with containers#156 are no longer
appropriate to be maintained here. This PR removes the k3s-specific
file-context entries for:
- systemd units
- k3s binaries under /usr and /usr/local
- everything under /var/lib/rancher/k3s and /var/run/k3s

Signed-off-by: Jacob Blain Christen <jacob@rancher.com>
@rhatdan
Copy link
Member

rhatdan commented Jan 6, 2022

LGTM

@rhatdan rhatdan merged commit f2a0540 into containers:main Jan 6, 2022
@dweomer
Copy link
Author

dweomer commented Jan 6, 2022

Thank you for the timely merge @rhatdan. Can we get a new tag as soon as makes sense? Thank you!

@rhatdan
Copy link
Member

rhatdan commented Jan 6, 2022

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.

2 participants