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

wrong selinux context for container processes #1664

Closed
lian opened this Issue Nov 15, 2016 · 10 comments

Comments

Projects
None yet
4 participants
@lian

lian commented Nov 15, 2016

Issue Report

Bug

container processes don't get their own selinux context anymore.

CoreOS Version

$ cat /etc/os-release
NAME=CoreOS
ID=coreos
VERSION=1185.3.0
VERSION_ID=1185.3.0
BUILD_ID=2016-11-01-0605
PRETTY_NAME="CoreOS 1185.3.0 (MoreOS)"
ANSI_COLOR="1;32"
HOME_URL="https://coreos.com/"
BUG_REPORT_URL="https://github.com/coreos/bugs/issues"

tested on latest alpha too. same issue

Environment

EC2 AMI and coreos_production_iso_image.iso

Expected Behavior

running at least one container ps -eZ shows system_u:system_r:svirt_lxc_net_t:... for container processes.

Actual Behavior

running at least one container ps -eZ is all system_u:system_r:kernel_t:s0

Other Information

/var/lib/docker/containers/*/configv2.json field ProcessLabel shows the expected system_u:system_r:svirt_lxc_net_t:.... seems container processes don't have that context assigned properly

@lian

This comment has been minimized.

lian commented Nov 15, 2016

more debugging/understanding..

docker:
cat /var/lib/docker/containers/*/config.v2.json contains the right ProcessLabel = system_u:system_r:svirt_lxc_net_t:s0:...

runc:
cat /run/docker/libcontainerd/*/config.json contains the right selinuxLabel = system_u:system_r:svirt_lxc_net_t:s0:...

docker run:
docker run -it --rm=true alpine:3.3 sh -c "top" fails with ps -eZ |grep top = system_u:system_r:kernel_t:s0

runc exec: (forcing process label)
runc exec --process-label system_u:system_r:svirt_lxc_net_t:s0:c689 <docker-run-id> sh -c "top" fails with ps -eZ |grep top = system_u:system_r:kernel_t:s0

@lian

This comment has been minimized.

lian commented Nov 15, 2016

cat /etc/selinux/mcs/contexts/lxc_contexts contains process = "system_u:system_r:svirt_lxc_net_t:s0"

@mjg59

This comment has been minimized.

mjg59 commented Nov 15, 2016

Does this work with rkt? Are you seeing any avc denials in the logs?

@lian

This comment has been minimized.

lian commented Nov 15, 2016

@mjg59 haven't tried rkt. no avc in auditd logs. are you able to reproduce it?

@mjg59

This comment has been minimized.

mjg59 commented Nov 15, 2016

Currently working on something else, so it'll take me a little while to bring up a test environment

@lian

This comment has been minimized.

lian commented Nov 15, 2016

glad for any help or pointers. security wise, aren't able roll all our production machines to this potentially broken selinux runc containers.

@lian

This comment has been minimized.

lian commented Nov 17, 2016

@mjg59 were you able to confirm the issue by now? and have any thoughts on fixing or workaround?

@mjg59

This comment has been minimized.

mjg59 commented Nov 29, 2016

Should be fixed in coreos/coreos-overlay@6ecf3a4

@lian

This comment has been minimized.

lian commented Dec 7, 2016

@mjg59 awesome, thanks!

@einyx

This comment has been minimized.

einyx commented Aug 8, 2018

This is happening still on latest stable and alpha releases

@einyx einyx unassigned mjg59 Aug 8, 2018

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