• 0 Posts
  • 9 Comments
Joined 12 days ago
cake
Cake day: June 23rd, 2024

help-circle
  • 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 and doasare setuid binaries, a special privileged bit to tell the kernel that this binary is not run as the user starting it, but by 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.

    run0doesn’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 via systemd-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:

    1. user starts binary with setuid (let’s say 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.
    2. sudochecks /etc/sudoers if that user is authorized to perform the requested action and either denies the request, performs it or asks for authentication.
    3. a new process is spawned from it, again inheriting the environment variables that were not cleaned, as you can’t get rid of variables by forking (this is often an issue if you have services that have their secrets configured via environment variables)

    With run0:

    1. user starts run0 binary as a user process. This process inherits the environment variables.
    2. 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.
    3. systemd checks if the user who started the run0 binary is allowed to perform the requested operation and again, either denies the request, performs it or asks for authentication.
    4. a new process is spawned from it, but it will only receive the environment variables that were explicitly requested as there’s no inheritance.

    At least that’s my understanding, I haven’t looked too much into it or used it yet.



  • Laser@feddit.orgtoMemes@sopuli.xyzCheers!
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    German here with similar laws to yours, though wine and beer legal with 16: legal age of 21 is in line with experts’ recommendations regarding brain development, however it’s questionable if this approach achieves the goal. If you want to discourage teenage drinking, make it unappealing, not illegal; but then we might have to acknowledge that we have an industry that heavily profits from a risky substance that puts a huge burden on society (several billion in damages each year) and we might have to regulate some aspects instead of just blaming the unfortunate people who got screwed over.