this post was submitted on 03 Jul 2024
115 points (92.0% liked)
Linux
47988 readers
1231 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This just sounds like a a solution in search of a problem.
sudo has more than 220k lines of code, I can definitely see the use of a simpler alternative.
Don't doas already fill that gap ?
run0 is just an alias for a part of systemd, so installing doas too would be useless bloat. Another thing to note is that doas is just smaller sudo, you still wouldn't use 99 % of its features.
edit: also from my totally surface level understanding both sudo and doas "elevate your privileges" which is supposedly unnecessary attack surface. run0 does it in a better way which I do not understand.
sudo
anddoas
are setuid binaries, a special privileged bit to tell the kernel that this binary is not run as the user starting it, but as the owner. A lot of care has to be incorporated into these to make sure you don't escalate your privileges as the default interface is very limited, being a single bit.Another issue with this approach is that since you're running this from your shell, the process will by default inherit all environment variables, which can be convenient, but also annoying (since a privileged process might write into your $HOME) or upright dangerous.
run0
doesn't use that mechanism.systemd
is, being a service manager at its core, something launching binaries in specialized environments, e.g. it will start an nginx process under the nginx user with a private tmp, protecting the system from writes by that service, maybe restrict it to a given address family etc. So the infrastructure to launch processes – even for users viasystemd-run
– is already there.run0
just goes one step further and implements an interface to request to start elevated (or rather with permissions different from their own) processes from a user's shell.Classic solutions do it like this:
sudo
) that runs with root (because that's the owner of the binary) privileges in their shell. Since this is a child process of their shell, it inherits all environment variables by default.sudo
checks/etc/sudoers
if that user is authorized to perform the requested action and either denies the request, performs it or asks for authentication.With
run0
:run0
binary as a user process. This process inherits the environment variables.run0
forwards the user's request via interface to the running systemd process (pid 1 I guess). That process however does not inherit any variables by default, since it was started outside the user's shell.run0
binary is allowed to perform the requested operation and again, either denies the request, performs it or asks for authentication.At least that's my understanding, I haven't looked too much into it or used it yet.
the pid1 part is wrong, only the systemd-init run in pid1, in it's own process, own binary etc, it's sole purpose is being an init system, after that it start the rest of the system, including the others systemd binaries
the rest is perfect thanks!, in the lennart he made a comparation with ssh were you "forward the commad to run as root", i think it's a good analogy
it does that in a "ssh like" that i read in the blog, they foward your commands, they don't elevate your user, they also use polkit for security intead of sudoers
Not if no one uses it.
No one will use this either
The original problem was to automagically prompt the user for password, if he tried to run some systemd executable without the wheel privileges. At some point they decided to reuse the code for [a command that allows you to run stuff as root] replacement because sudo is too bloated and vulnerable.