Skip to content
This repository has been archived by the owner. It is now read-only.

wrong selinux context for container processes #1664

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

wrong selinux context for container processes #1664

lian opened this issue Nov 15, 2016 · 10 comments

Comments

@lian
Copy link

@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
Copy link
Author

@lian 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
Copy link
Author

@lian lian commented Nov 15, 2016

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

@mjg59
Copy link

@mjg59 mjg59 commented Nov 15, 2016

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

@lian
Copy link
Author

@lian lian commented Nov 15, 2016

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

@mjg59
Copy link

@mjg59 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
Copy link
Author

@lian 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
Copy link
Author

@lian lian commented Nov 17, 2016

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

@mjg59
Copy link

@mjg59 mjg59 commented Nov 29, 2016

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

@lian
Copy link
Author

@lian lian commented Dec 7, 2016

@mjg59 awesome, thanks!

@einyx
Copy link

@einyx 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.