-
Notifications
You must be signed in to change notification settings - Fork 684
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
Drop unnecessary privileges in node #2323
Comments
@eskimor @bkchr What do you think about this proposal? In order to avoid false positives we would need a new flag for containers and CI. I considered simply dropping privileges instead, but that would require having a user ID to switch to. Looking at prior art like |
|
I had a brief look into |
Appreciate the info! I wonder if |
Just looked into a couple of docker overlay images in my Podman setup. |
I did a bit of research which just confirmed what you said: the best practice is to set the suid bit, let the process set up a new user specific to the process, and then drop privileges to that user. I am just hesitant about the suid bit because it is a change in how the binary is run and could be perceived as scary/insecure. We would need @bkchr to give this approach the green light. This seems like the best approach, but we'd still need a CLI flag to disable this step in case it's not possible on some nonstandard configuration. |
Not only that. Right now, it is possible to So the main question is, do we really need the suid bit? What could we do with it that we cannot do without it? To enable audit monitoring at least, but that's an auxiliary feature and is not worth requiring suid by itself. What else could we achieve? |
I remember some programs just exit immediately and refuse to run when they detect root privileges. |
@ggwpez Yeah, the concern is Docker or other containers. We'd need a new flag:
Indeed this is a simple solution to the problem. But, following the best practice (suid, setting up a new user, and changing to it) seems better in the long-run. It would let us do more things at start-up. |
The node could drop privileges if it finds out it is running as root, it's a good security measure by itself.
Originally posted by @s0me0ne-unkn0wn in #1685 (comment)
Preliminary Design
Pseudo-code
TODO: Check for admin on Windows?
Open questions
There doesn't seem to be a reliable way to check is_container (and I doubt this could be made future-proof). Should there be some new flag such as
--is-container
or--allow-root
?Alternatives
There was an idea of starting the node with root privileges (using a suid bit), then doing some things at startup requiring root, and finally dropping the privileges. This still needs to be discussed because it carries some risk. It would need to be audited at the very least.
This design went a different route: we detect privileges, instead of unconditionally dropping them. This seemed more useful right now because privileges probably indicates some issue with how a validator is running the node, that we can communicate to them
Dropping privileges can still be done in the future if the need arises; see here.
Related
"Consider starting node with root privileges": #2324
The text was updated successfully, but these errors were encountered: