dockerd-rootless.sh: prohibit running as root#42034
Merged
Merged
Conversation
thaJeztah
reviewed
Feb 23, 2021
Member
There was a problem hiding this comment.
Thought I left a comment, but I guess I forgot.
Does this only apply to this part of the code, or to the script as a whole? If it's for the whole script, perhaps something like;
Suggested change
| echo "Must not run as root" | |
| echo "This script must be executed as a non-privileged user" |
(and in that case, I think it would make sense to put it at the top of the script, together with the other checks at the start)
Member
Author
There was a problem hiding this comment.
Updated the error message.
put it at the top of the script, together with the other checks at the start
No. The script "reexecs" itself inside a user namespace, so the UID flips to be zero.
Signed-off-by: Akihiro Suda <[email protected]>
AkihiroSuda
force-pushed
the
prohibit-rootless-as-root
branch
from
February 24, 2021 04:22
7b228ea to
9351e19
Compare
Member
|
@tianon ptal 🤗 |
Member
|
@AkihiroSuda have you seen many users running into this? Did you want this backported? |
Member
Author
|
Yes, backport PR: #42072 |
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.
- What I did
Prohibit running
dockerd-rootless.shas root- How I did it
Added
if [ $(id -u) = 0 ]; then echo "(error)"; exit 1; fi- How to verify it
- A picture of a cute animal (not mandatory but encouraged)
🐧