Reduce need for privileged mode a bit more#46
Merged
Conversation
Currently the general advise is to just use privileged mode with docker/compose. From a security point of view this is obviously undesirable. One reason why privileged mode is needed, is because some packages [0] incorrectly set permissions on their (`-rwxr-x--- 501:staff package.json`) file. One would rightfully argue, that this doesn't matter, because docker runs as root and thus all permissions are granted anyway. However when working with volumes, this is no longer true, the docker user is mapped to some random UID and within our container we now get a permission denied error, because our remapped root user no longer has access. While we obviously should aim to fix this error upstream wherever possible, this could take years. Meanwhile lets put the root user into the `staff` group, which seems to be the permissions set by these misbehaving packages. Obviously this will break again once upstream or debian changes the mapping/permission at a later time. [0]: https://community.platformio.org/t/incorrect-permissions-for-several-packages-on-package-json/41733 Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Contributor
Author
|
As per esphome/esphome#7098 I put the usermod into its own layer; which violates the best docker practises, but is what is preferred by upstream. |
Contributor
Author
|
Pipeline breakage is due to outdated hardcoded dependency version. Not sure if you want to be that strict with your dependencies, as you need to keep them strictly up-to-date. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the general advise is to just use privileged mode with docker/compose. From a security point of view this is obviously undesirable.
One reason why privileged mode is needed, is because some packages 0 incorrectly set permissions on their (
-rwxr-x--- 501:staff package.json) file. One would rightfully argue, that this doesn't matter, because docker runs as root and thus all permissions are granted anyway. However when working with volumes, this is no longer true, the docker user is mapped to some random UID and within our container we now get a permission denied error, because our remapped root user no longer has access.While we obviously should aim to fix this error upstream wherever possible, this could take years. Meanwhile lets put the root user into the
staffgroup, which seems to be the permissions set by these misbehaving packages. Obviously this will break again once upstream or debian changes the mapping/permission at a later time.