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

Mastodon workers running as root in Docker containers #2680

Closed
2 tasks done
q3k opened this issue May 1, 2017 · 1 comment
Closed
2 tasks done

Mastodon workers running as root in Docker containers #2680

q3k opened this issue May 1, 2017 · 1 comment
Labels
fit for beginners Low-hanging fruit security Security issues and fixes, vulnerabilities

Comments

@q3k
Copy link

q3k commented May 1, 2017

The current Dockerfile and docker-compose setup makes the Mastodon workers run as root in containers.

This is ill-advised [1] and unnecessary [2]. Running as root reduced the effort required to escape from the container to the host of the machine.

[1] - http://blog.dscpl.com.au/2015/12/don-run-as-root-inside-of-docker.html
[2] - https://docs.docker.com/engine/security/security/


  • I searched or browsed the repo’s other issues to ensure this is not a duplicate.
  • This bug happens on a tagged release and not on master (If you're a user, don't worry about this).
@Wonderfall
Copy link
Contributor

Wonderfall commented May 19, 2017

I opened a thread about it : https://social.targaryen.house/users/wonderfall/updates/47013
You're absolutely right and we should do something right now, before 1.4 is released. Too many people are using Docker without knowing it doesn't isolate much (by default). That's why, @Gargron, I suggest to add this issue to the 1.4 roadmap. I can PR something but as there are several ways to do it, let's agree on one. Mine below.

So my proposition in particular :

  • Add 2 environment variables to the Dockerfile : UID and GID.
  • Add an entrypoint script :
#!/bin/sh
chown -R $UID:$GID /mastodon
su-exec $UID:$GID tini -- "$@"

This change should be transparent, but we should update the documentation to documentate the environment variables. If you're okay with that, I'll do something without any further waiting.

Gargron added a commit that referenced this issue May 19, 2017
This might create issues for existing users where files in volumes
are owned by the root user and cannot be used by the non-root one.
ClearlyClaire added a commit to ClearlyClaire/mastodon that referenced this issue Mar 15, 2024
* Reduce differences with upstream

* Further reduce pack differences with upstream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fit for beginners Low-hanging fruit security Security issues and fixes, vulnerabilities
Projects
None yet
Development

No branches or pull requests

3 participants