Skip to content

Toolbox assumes that the container image allows empty passwords #452

Closed

Description

@tudxor

For passwordless sudo to work, toolbox currently deletes root's password in the container when running toolbox init-container.

However, some images, such as the openSUSE toolbox image (registry.opensuse.org/opensuse/toolbox), don't have the nullok option in PAM by default, rendering sudo totally unusable.

There are two ways of solving this:

  1. Require toolbox images to allow null passwords. For openSUSE, this means running pam-config -a --nullok while building the image.

  2. To keep images as "stock" as possible, have toolbox insert a file in /etc/sudoers.d with the content

    %wheel ALL=(ALL) NOPASSWD: ALL
    

    for passwordless sudo.

Activity

  1. debarshiray commented on Aug 21, 2020

    @debarshiray
    Member

    There are two ways of solving this:

    1. Require toolbox images to allow null passwords. For openSUSE,
    

    this means running pam-config -a --nullok while building the image.

    2. To keep images as "stock" as possible, have toolbox insert a file in
    

    /etc/sudoers.d with the content
    %wheel ALL=(ALL) NOPASSWD: ALL

       for passwordless `sudo`.
    

    I would prefer to have this solved in the image itself, instead of adding too many operating system specific quirks in /usr/bin/toolbox.

    People who care about an OS are the ones best placed to test Toolbox on the OS, figure out how to make it work, and, most importantly, maintain it over time. Since they are building the image, they are also implicitly in charge of hosting it in an appropriate registry.

    Therefore, it seems logical to keep all the OS specific quirks in the image itself.

    We could document this requirement about passwordless sudo in the README.md file's Image requirements section.

  2. debarshiray commented on Aug 21, 2020

    @debarshiray
    Member

    Closing.

  3. niklasl commented on May 26, 2022

    @niklasl

    For anyone having problems running sudo on e.g. Tumbleweed in a toolbox on Silverblue and ending up here, I just want to make it clear that the image itself doesn't have to be modified beforehand. As simple one-off workaround (per container) is to use podman cp to get the aforementioned sudoers.d configuration into place in the already created container.

    (This is also in the "unofficial" advice for openSUSE toolbox images, along with identical advice for Arch. While this is reasonably obvious to those acquainted with podman, I wager pointing it out here won't hurt.)

  4. debarshiray commented on Aug 5, 2025

    @debarshiray
    Member

    (This is also in the "unofficial" advice for openSUSE toolbox images, along with identical advice for Arch.

    For the past two years, there's built-in support for Arch Linux in Toolbx based on an image at quay.io/toolbx/arch-toolbox:latest, and that image is already configured for empty sudo(8) passwords.

  5. debarshiray commented on Aug 5, 2025

    @debarshiray
    Member

    I would prefer to have this solved in the image itself, instead of adding too many operating system specific quirks in /usr/bin/toolbox.

    People who care about an OS are the ones best placed to test Toolbox on the OS, figure out how to make it work, and, most importantly, maintain it over time. Since they are building the image, they are also implicitly in charge of hosting it in an appropriate registry.

    Therefore, it seems logical to keep all the OS specific quirks in the image itself.

    Astute readers will notice that Toolbx does do some runtime configurations:

    • ldconfig(8) through /etc/ld.so.conf.d/toolbx-nvidia.conf
    • Kerberos through /etc/krb5.conf.d/kcm_default_ccache
    • PKCS #⁠11 through /etc/pkcs11/modules/p11-kit-trust.module
    • RPM through /usr/lib/rpm/macros.d/macros.toolbox

    These are things that have to be done at runtime because they either depend on how the host is (eg., ldconfig(8), Kerberos and PKCS #⁠11), or the configuration needs to be kept updated over time (eg., RPM).

    In comparison, the configuration for empty passwords for sudo(8) is relatively self-contained. The sudo(8) group (ie., sudo or wheel) is already known within the image, and the image maintainer can decide whether to allow this through PAM(8) or sudoers(5).

    It boils down to a trade-off. The more we do at runtime, the more the chance for runtime failures when starting the container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions