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

Configure Docker to run with User Namespaces #962

Closed
miradam opened this issue Feb 2, 2017 · 6 comments
Closed

Configure Docker to run with User Namespaces #962

miradam opened this issue Feb 2, 2017 · 6 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. security

Comments

@miradam
Copy link

miradam commented Feb 2, 2017

This is feature request.

There are various attacks possible on Docker and K8s environments. One such category of attacks is related to Linux kernel resource sharing scheme and namespaces.
User Namespaces greatly improve Docker and K8s deployment security mapping 'host' PID to a different 'container' PID. In other words when User Namespaces are in play process PIDs executed within Docker runtime never overlap with Linux host PIDs providing expected separation.
More information:
https://success.docker.com/Datacenter/Apply/Introduction_to_User_Namespaces_in_Docker_Engine

Enabling user namespaces on Ubuntu 16.04:

  • Create PID mapping:
    adduser dockremap
    echo dockremap:500000:65536 > /etc/subuid
    echo dockremap:500000:65536 > /etc/subgid

  • Override default Docker startup options:
    cat << 'EOF' >> /etc/systemd/system/docker.service.d/userns-remap.conf
    [Service]
    ExecStart=
    ExecStart=/usr/bin/dockerd --userns-remap=default -H fd:// $DOCKER_OPTS
    EOF

  • Restart Docker daemon:
    systemctl restart docker.service

  • Verify that mapping is being applied:
    ps xauw | grep dockerd

Environment:
Ubuntu 16.04

@bogdando
Copy link
Contributor

bogdando commented Feb 3, 2017

Good point. We have kubelet and network plugins containers running under the root, so those must be as well reworked to use host usernamespace to be remapped from the host's root.
@holser JFYI ^^ and thanks for that idea!

@The-Loeki
Copy link

The-Loeki commented Jul 21, 2017

This unfortunately is still broken: kubernetes/kubernetes#33508

Apparently there's a feature req going on here: kubernetes/enhancements#127

@adelton
Copy link

adelton commented Nov 14, 2017

@miradam, you might want to change the 'PID' occurrences in your description to 'UID'. ;-)

@ant31 ant31 added this to the 2.7 milestone Aug 15, 2018
@Atoms Atoms added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 21, 2018
@woopstar woopstar removed this from the 2.7 milestone Sep 28, 2018
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 11, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. security
Projects
None yet
Development

No branches or pull requests

9 participants