Skip to content

RunAs unprivileged user #235

Closed
Closed

Description

@vic3lord

Is there a plan to support a non-root user inside base?

Activity

  1. mariusgrigoriu commented on Sep 14, 2018

    @mariusgrigoriu

    I believe it is already supported in the sense that you can run a Distroless-based image as some other user. Is your question that the image should default to a non-root user? If yes, then which UID is safe on all systems?

  2. vic3lord commented on Sep 16, 2018

    @vic3lord
    Author

    @mariusgrigoriu yes, I meant as a default value. I think something above 1000 is safe, unless there's something I am missing.

  3. mariusgrigoriu commented on Sep 17, 2018

    @mariusgrigoriu

    I've seen user accounts in the 5000s for GKE/COS. Other systems and their admins may decide on other UID ranges. Seems like a base image should be able to operate under any UID according to the sys admin's preferences.

  4. dlorenc commented on Sep 17, 2018

    @dlorenc
    Contributor

    I don't think we'll be changing the default of this from 0. Most other official images use 0, and it's easily overrideable in the runtime or in a base image.

  5. chanseokoh commented on Mar 27, 2019

    @chanseokoh
    Member

    Opening for discussion from #306.

    Most other official images use 0,

    I had a similar argument, but @HazCod's argument was that those images keep the root mainly due to the existence of a package manager, which doesn't apply to Distroless.

    In any case, if we do this, not sure if nobody would be a good fit, considering its nature. (Also nobody's home would be set to /nonexistent), so we may need to add a proper new user?

  6. briandealwis commented on Mar 27, 2019

    @briandealwis
    Member

    I'll add that we recommend avoiding running as root in our Best Practices for Operating Containers.

    My only argument against using nobody is that the container user should have a home directory so that there's a place for dotfiles (e.g., ~/.docker/config.json) to be installed.

  7. mattmoor commented on Apr 23, 2019

    @mattmoor
    Contributor

    I'd love to see us at a minimum publish :nonroot images, which consuming projects (e.g. ko, jib, bazel) can opt over to case-by-case.

    cc @jonjohnsonjr Can you TAL?

  8. jonjohnsonjr commented on Apr 26, 2019

    @jonjohnsonjr
    Contributor

    The disastrous python2 -> python3 migration may be our industry's greatest blunder.

  9. pmorie commented on May 23, 2019

    @pmorie

    I second @mattmoor's statements. Specific use case for me is publishing knative images that don't take root privs. Currently it appears that ko will have to inherit this from the base image.

  10. chanseokoh commented on Jun 19, 2019

    @chanseokoh
    Member

    FTR, now the images have a user and a group all named "nonroot".

    /etc/passwd content:

    root:x:0:0:root:/root:/sbin/nologin
    nobody:x:65534:65534:nobody:/nonexistent:/sbin/nologin
    nonroot:x:65532:65532:nonroot:/home/nonroot:/sbin/nologin
    

    /etc/group content:

    root:x:0:
    nobody:x:65534:
    tty:x:5:
    staff:x:50:
    nonroot:x:65532:
    
  11. loosebazooka commented on Jun 19, 2019

    @loosebazooka
    Member

    This doesn't apply to the language builds yet, does it?

  12. chanseokoh commented on Jun 19, 2019

    @chanseokoh
    Member

    @loosebazooka all the images have the nonroot user and group. By default, all the images without the tag :nonroot run as root as usual. It is just that only the images with the :nonroot tag run as the nonroot user by default. And so far, only a small number of repositories introduced the :nonroot tag.

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

Metadata

Metadata

Assignees

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