docker-iojs icon indicating copy to clipboard operation
docker-iojs copied to clipboard

Security issue: iojs is run as root

Open mtparet opened this issue 10 years ago • 7 comments

In case of security flaw in the application run and in docker (as it happenned and will happen) cf: http://blog.zeltser.com/post/104976675349/security-risks-and-benefits-of-docker-application http://thenewstack.io/docker-addresses-more-security-issues-and-outlines-plugin-approach/ http://www.slideshare.net/jpetazzo/docker-linux-containers-lxc-and-security https://blog.xenproject.org/2014/06/23/the-docker-exploit-and-the-security-of-containers/

mtparet avatar Feb 07 '15 23:02 mtparet

cf also https://github.com/joyent/docker-node/issues/1

mtparet avatar Feb 07 '15 23:02 mtparet

Something like:

# Use high uid/gid to avoid collisions with the host
RUN groupadd --gid 25000 app && useradd --uid 25000 --gid 25000 --create-home --shell /bin/bash app 

...folowed by this just before CMD:

USER app

...and also modifying onbuild to use e.g. /home/app/src as base.

Does this sound right?

pesho avatar Feb 08 '15 00:02 pesho

Yes sounds right !

mtparet avatar Feb 08 '15 07:02 mtparet

Un-assigning this, in case anyone else wants to give it a try.

pesho avatar Apr 03 '15 21:04 pesho

@pesho I'll give it a shot sometimes next week as I actually need this for a customer. Feel free to assign it to me or simply wait for a PR when it is ready enough.

hmalphettes avatar Apr 04 '15 01:04 hmalphettes

@hmalphettes you have probably read this comment in #26, but just to make sure:

yosifkit commented on Feb 16 I think the hardest part here is that this still doesn't cover the developer that wants to bind mount in their code so that they can edit it on their host machine and see changes as they develop using something like node-supervisor (ex: docker run -it --rm -v /my/code:/usr/src/app my-node). That way they do not have to docker stop, docker build, and docker run for every change.

Starefossen avatar Apr 04 '15 06:04 Starefossen

User namespaces have made it into the experimental release of Docker. https://github.com/docker/docker/pull/12648

retrohacker avatar Oct 14 '15 02:10 retrohacker