Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

SELinux doesn't contain Docker containers #2421

@kh34

Description

@kh34

Issue Report

Bug

I seem to have the same issue as #972

Container Linux Version

CoreOS-stable-1688.5.3-hvm (ami-9e2685e3)

$ cat /etc/os-release
NAME="Container Linux by CoreOS"
ID=coreos
VERSION=1688.5.3
VERSION_ID=1688.5.3
BUILD_ID=2018-04-03-0547
PRETTY_NAME="Container Linux by CoreOS 1688.5.3 (Rhyolite)"
ANSI_COLOR="38;5;75"
HOME_URL="https://coreos.com/"
BUG_REPORT_URL="https://issues.coreos.com"
COREOS_BOARD="amd64-usr"
BUG_REPORT_URL="https://issues.coreos.com"

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:

# docker run -v /etc:/test1 centos:7 sleep 10 &
# ps auxZ |grep sleep
system_u:system_r:kernel_t:s0   root      1434  0.0  0.5 298028 20636 pts/0    Sl   21:09   0:00 /run/torcx/bin/docker run -v /etc:/test1 centos:7 sleep 10
system_u:system_r:kernel_t:s0   root      1463  0.5  0.0   4328   632 ?        Ss   21:09   0:00 sleep 10

Reproduction Steps

  1. Launch ec2 instance using ami-9e2685e3
  2. Run commands above

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions