-
Notifications
You must be signed in to change notification settings - Fork 30
SELinux doesn't contain Docker containers #2421
Comments
I'm currently working to update the SELinux support. The updated support should not allow this. I needed to fixup the kola tests for it. See coreos/mantle#839. For this specific case see the patch BTW, Container Linux runs SELinux in |
I've experienced this issue as well with enforcing mode set. |
How does Tectonic accomplish this then? Or are all tectonic clusters not secured with selinux? |
@andythompson As kh34 mentioned, with the current SELinux policy the docker daemon is running with kernel_t permissions, so it will be able to do anything kernel_t permissions allow regardless of what mode SELinux is in. The updated policy has the docker daemon running with svirt_lxc_file_t, and there is a feature request to update the container related part of the policy to use container-selinux from project atomic. See #2231 (Docker SELinux policy should more closely match upstream). @kh34 If there is something you want to protect I recommend you mount it as read-only; |
@glevand I'm not sure that solution is satisfactory in the context of Kubernetes. According to your solution, I would need to verify that every Kubernetes configuration that is applied to my cluster has the read only option set for the host paths that I want to secure. With SELinux, I should just be able to create a rule and that location will be secured for me. |
Found something related here: #1664. So it seems this once worked. |
Ran into this same issue in 1745.7.0. MCS labels look like they're applied if we're using docker 1.12 by setting /etc/coreos/docker-1.12, but they're not applied with docker 18.03.1-ce (or 17.09 from an earlier test). I saw this on:
From docker version, I get
and running a container I don't see the expected labels:
If I switch to docker 1.12 following the steps mentioned in https://coreos.com/blog/toward-docker-17-in-container-linux, instead it's
and running the same container, I see
@glevand Is it expected right now that selinux labels are applied in coreos with docker 1.12 but not with 17.09-ce+ until the policy fix mentioned above goes in? |
Bump for visibility. This is a crucial security piece for using Docker securely. CC: @ajeddeloh Thanks! |
Thank you for reporting this issue. Unfortunately, we don't think we'll end up addressing it in Container Linux. We're now working on Fedora CoreOS, the successor to Container Linux, and we expect most major development to occur there instead. Meanwhile, Container Linux will be fully maintained into 2020 but won't see many new features. We appreciate your taking the time to report this issue and we're sorry that we won't be able to address it. |
For context: adding additional confinement to the SELinux policy is likely to break existing systems with enforcing enabled, and we're trying to avoid breaking changes at this point in Container Linux's lifecycle. |
Issue Report
Bug
I seem to have the same issue as #972
Container Linux Version
CoreOS-stable-1688.5.3-hvm (ami-9e2685e3)
Environment
What hardware/cloud provider/hypervisor is being used to run Container Linux?
amazon ec2 CoreOS-stable-1688.5.3-hvm (ami-9e2685e3)
Expected Behavior
I expected docker to set the context from /etc/selinux/mcs/contexts/lxc_contexts just as rkt does.
system_u:system_r:svirt_lxc_net_t
Actual Behavior
docker always runs as kernel_t:
Reproduction Steps
Other Information
In the example above with docker, my container can write to the host's /etc directory, which is something I'm trying to prevent.
The text was updated successfully, but these errors were encountered: