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

Ability to set SELinux labels for volumes #699

Closed
ncdc opened this issue Jul 30, 2014 · 5 comments
Closed

Ability to set SELinux labels for volumes #699

ncdc opened this issue Jul 30, 2014 · 5 comments
Labels
area/security priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/storage Categorizes an issue or PR as relevant to SIG Storage.

Comments

@ncdc
Copy link
Member

ncdc commented Jul 30, 2014

Users of Linux distributions with SELinux in enforcing mode will likely need to have Kubernetes set the appropriate SELinux label on any volumes created, at least for EmptyDir volumes (directories created on the host system that are then bind mounted into the Docker container). I believe we are currently using svirt_sandbox_file_t but we may want to make the label configurable.

For my particular use case, I was trying to run the docker registry container inside a pod, and I wanted to specify a volume for storing the registry's persistent data (docker images). The registry isn't allowed to write to the volume because SELinux denies it. Here's an example denial:

type=SYSCALL msg=audit(1406642880.633:277689): arch=c000003e syscall=83 success=no exit=-13 a0=1192350 a1=1ff a2=0 a3=7fff485ffbf0 items=0 ppid=7433 pid=11170 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="gunicorn" exe="/usr/bin/python2.7" subj=system_u:system_r:svirt_lxc_net_t:s0:c251,c327 key=(null) type=AVC msg=audit(1406642880.633:277689): avc:  denied  { write } for  pid=11170 comm="gunicorn" name="data" dev="dm-0" ino=2506756 scontext=system_u:system_r:svirt_lxc_net_t:s0:c251,c327 tcontext=system_u:object_r:root_t:s0 tclass=dir

/cc @rhatdan @smarterclayton

@smarterclayton
Copy link
Contributor

Related to #391

@rhatdan
Copy link

rhatdan commented Aug 4, 2014

I think you would want to allow kubernetes also to specify the label to run a container with. I have patches working their way upstream that do

docker run --label-opt type:mycontainer_t --label-opt level:TopSecret

Another patch allows you to mount a volume with a :Z or a :z which tells docker to use the Private label or a shared label for the volume.

@bgrant0607 bgrant0607 added the priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. label Dec 3, 2014
@bgrant0607
Copy link
Member

Related to security contexts: #3910

vishh pushed a commit to vishh/kubernetes that referenced this issue Apr 6, 2016
@bgrant0607 bgrant0607 added sig/storage Categorizes an issue or PR as relevant to SIG Storage. and removed team/cluster (deprecated - do not use) labels Feb 10, 2017
@bgrant0607
Copy link
Member

@pmorie @csrwng Is this done?

@bgrant0607
Copy link
Member

I believe this was done as part of SecurityContext and other SELinux work, such as #17555.

seans3 pushed a commit to seans3/kubernetes that referenced this issue Apr 10, 2019
cynepco3hahue pushed a commit to cynepco3hahue/kubernetes that referenced this issue Apr 25, 2021
Bug 1952333: UPSTREAM: 101306: Additional CVE-2021-3121 fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/storage Categorizes an issue or PR as relevant to SIG Storage.
Projects
None yet
Development

No branches or pull requests

5 participants