-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Really run as non-root user in docker container #5048
Conversation
@lgierth when youre back, would be great to get your review on this |
Why is it better to run as non-root right away? The advantage of starting as root and then dropping privileges, is that it makes mounting an IPFS_PATH directory easier - no need to fiddle with permissions manually, we can |
As a user of (any) external Docker image, I want to reduce an attack surface. |
As far as I can tell, this patch doesn't prevent that. It only drops to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work. However, I think we should leave the current su-exec
calls in container_daemon
for now in case any users are manually calling start_ipfs
as root.
We shouldn't need the chmod $IPFS_PATH
call in container_daemon
as we:
chmod
the directory in the Dockerfile.- Use a volume.
(going to rebase to give this another test) |
As of now, $ docker pull ipfs/go-ipfs Using default tag: latest latest: Pulling from ipfs/go-ipfs Digest: sha256:31cc5713ef3e3e81bf868cbb56c19de2d15d661743d8b6077804dee26e929ac5 Status: Image is up to date for ipfs/go-ipfs:latest ipfs daemon will start as root user: $ docker run --rm --entrypoint=/bin/sh ipfs/go-ipfs -c whoami root but later on will drop priviledges: $ docker logs ipfs/go-ipfs |head -n 1 Changing user to ipfs With this change applied, ipfs daemon starts as ipfs user right from the begining: $ docker run --rm --entrypoint=/bin/sh ipfs/go-ipfs -c whoami ipfs License: MIT Signed-off-by: Mykola Nikishov <[email protected]>
Hi, this broke my current integrations but I've only noticed after a new release has been tagged. The default entrypoint changed the user after it has
As pointed by @lgierth, I would revert this change. It added zero security while breaking things. In fact, users are now forced to pre-create and relax permissions in the provided volumes, so it probably makes things worse. |
We need to pre-create configuration folders and set write permissions because ipfs/kubo#5048 License: MIT Signed-off-by: Hector Sanjuan <[email protected]>
We need to pre-create configuration folders and set write permissions because ipfs/kubo#5048 License: MIT Signed-off-by: Hector Sanjuan <[email protected]>
We need to pre-create configuration folders and set write permissions because ipfs/kubo#5048 License: MIT Signed-off-by: Hector Sanjuan <[email protected]>
Since the container uses volumes the user the container is running under needs write access to these volumes. This must be configured from the outside and maybe complicated. See ipfs/kubo#6040 and ipfs/kubo#5048
As of now,
ipfs daemon will start as root user:
but later on will drop priviledges:
With this change applied, ipfs daemon starts as ipfs user right from
the begining:
License: MIT
Signed-off-by: Mykola Nikishov [email protected]