• jet@hackertalks.com
    link
    fedilink
    English
    arrow-up
    66
    arrow-down
    1
    ·
    6 months ago

    But with one key difference: it’s *not* in fact SUID. Instead it just asks the service manager to invoke a command or shell under the target user’s UID. It allocates a new PTY for that, and then shovels data back and forth from the originating TTY and this PTY. Or in other words: the target command is invoked in an isolated exec context, freshly forked off PID 1, without inheriting any context from the client (well, admittedly, we *do* propagate $TERM, but that’s an explicit exception, i.e. allowlist rather than denylist).

      • anyhow2503@lemmy.world
        link
        fedilink
        arrow-up
        16
        arrow-down
        1
        ·
        6 months ago

        I would fucking hope not. TERM is explicitly passed along as the only exception, which is the only sensible default for temporary privilege elevation in a shell.

      • intrepid@lemmy.ca
        link
        fedilink
        arrow-up
        8
        arrow-down
        2
        ·
        6 months ago

        Sudo also blocks almost all environment variables, with the option to set or copy them on demand. I assume that run0 will have similar facilities to propagate variables on demand.

        PS: This is my technical understanding. Personally, I don’t like systemd eating up all the other utilities.

  • peregus@lemmy.world
    link
    fedilink
    arrow-up
    26
    arrow-down
    4
    ·
    6 months ago

    Dude, just write down a couple of lines in your posts so that people can know what they’re about.

    • Vilian@lemmy.ca
      link
      fedilink
      arrow-up
      19
      arrow-down
      2
      ·
      6 months ago

      OpenBSD’s sudo replacement called “doas”. While it greatly simplifies the tool and removes much of the attack surface, it doesn’t change one key thing: it’s still a SUID binary.

  • OpFARv30@lemmy.ml
    link
    fedilink
    arrow-up
    15
    arrow-down
    1
    ·
    6 months ago

    Yall understand that what actually changed is a symlink? That systemd-run is now linked from run0, and that’s enough to make a SUID-less sudo?

    • NekkoDroid@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      6 months ago

      Basically. systemd-run was already able to do it, all that really changed is the interface for it. The change to run.c in the patch itself was <400LOC, and the entire patch was <1.4k lines with most being docs, tests and utils for coloring the terminal.

  • theshatterstone54@feddit.uk
    link
    fedilink
    arrow-up
    15
    arrow-down
    1
    ·
    6 months ago

    Great. Another thing that makes non-systemd distros even more painful to use. /s I like systemd, but the people that called the OS Systemd/Linux were right, and that name becomes more accurate every day.

  • ghu@lemmy.ml
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    6 months ago

    Does it give alternative to sudo -e (sudoedit) too?

    • Brunacho@scribe.disroot.org
      link
      fedilink
      English
      arrow-up
      4
      ·
      6 months ago

      i had the same question so I went through the source code and, for now, doesn’t seem like it has implemented such option.

    • NekkoDroid@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      6 months ago

      As the other comment said, no. But I’ve had the idea and will to at some point write a edit script (that I can just set EDITOR= to) that would just choose one of the first common editors. That could in theory have a -0 option to run as root (there also probably looking through run0, doas, sudo and su). Not the editor, but doing the editing on a temp file and then copying with root

    • kevincox@lemmy.mlM
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      6 months ago

      Out of the box no. But it would be easy to implement if you don’t need very complex rules. (I don’t actually know how permissions work for sudoedit.)

      • bamboo@lemm.ee
        link
        fedilink
        arrow-up
        3
        ·
        6 months ago

        sudoedit copies a file to a temp directory, invokes $EDITOR with that temp file, and after the editor process exits, it copies the file back to overwrite the original. This way you get your user preferred and configured editor, but it doesn’t have any elevated privileges.

        • kevincox@lemmy.mlM
          link
          fedilink
          arrow-up
          1
          ·
          6 months ago

          Yes, but how do you configure who is allowed to edit which files in /etc/sudoers?