• lemmyvore@feddit.nl
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    17
    ·
    1 year ago

    What is rootless bring brought up so much? It’s a container, it’s isolated from the host anyway, what does it matter what user runs inside? And if something breaks into the container they can trash the app in it and the shared volumes anyway, even if they’re not root.

    • azdle@news.idlestate.org
      link
      fedilink
      English
      arrow-up
      18
      arrow-down
      2
      ·
      edit-2
      1 year ago

      Defense in depth. If something escapes the container it’s limited to only what’s under that user and not the whole system. Having access to the whole system makes it easier for malware to hide/persist itself.

      • lemmyvore@feddit.nl
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        7
        ·
        1 year ago

        Correct me if I’m wrong but containerization is enforced by the kernel, correct? If something escapes you’re pretty much screwed anyway.

        • Atemu@lemmy.ml
          link
          fedilink
          English
          arrow-up
          11
          ·
          1 year ago

          There are many layers involved in preventing escapes from containers.

    • florian@lemmy.world
      link
      fedilink
      English
      arrow-up
      6
      ·
      1 year ago

      It depends on the use case. The most common security issue I have seen with docker is on Linux desktop systems: docker deamon runs as root and user wants to use it to test all kinds of containers. So they make the docker socket accessible to the user, to lazy to use “sudo docker” every time… Having access to the docker socket means having the same permissions as the one running the daemon: root . Your browser effectively now has root permissions. At this point you could just login as root to your desktop.

    • worldofgeese@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      1 year ago

      There’s real usability benefits too. I’ve collected some anecdotes from Reddit:

      Rootless podman is my first choice for using containers now, it works fantastically well in my experience. It’s so much nicer to have all my container related stuff like volumes, configs, the control socket, etc. in my home directory and standard user paths vs. scattered all over the system. Permission issues with bind mounts just totally disappear when you go rootless. It’s so much easier and better than the root privileged daemon.

      and,

      If you are on Linux, there is the fantastic podman option “–userns keep-id” which will make sure the uid inside+the container is the same as your current user uid.+

      and,

      Yeah in my experience with rootless you don’t need to worry about UID shenanigans anymore. Containers can do stuff as root (from their perspective at least) all they want but any files you bind mount into the container are still just owned/modified by your user account on the host system (not a root user bleeding through from the container).

      finally,

      The permissions (rwx) don’t change, but the uid/gid is mapped. E.g. uid 0 is the running user outside the container, by uid 1 will be mapped to 100000 (configurable), and say 5000 inside the container is mapped to 105000. I don’t remember the exact mapping but it works roughly like that.