Skip to content

Bug: "distroless" local docker build fails #671

@galmasi

Description

@galmasi

Bug description

The keylime agent is capable of building its own docker container, using a distroless image, or fedora, or wolfi. The distroless build option does not work (fails while building)

Root cause

The problem seems to be the last command, creating a keylime user with tss group membership. My interpretation of this bug is that the command fails because there is no /bin/sh to run the command; to not even mention the useradd command which is also not part of distroless.

------
Dockerfile.distroless:99
--------------------
  97 |     
  98 |     # Create a system user 'keylime' to allow dropping privileges
  99 | >>> RUN useradd -s /sbin/nologin -r -G tss keylime
 100 |     
 101 |     # run as root by default
--------------------
ERROR: failed to solve: process "/bin/sh -c useradd -s /sbin/nologin -r -G tss keylime" did not complete successfully: exit code: 1
Error response from daemon: No such image: keylime_agent:latest-distroless

Possible fixes

  1. copy /bin/bash and other commands from a busybox type container image, and use them. Not ideal because we don't actually need any shell in the final container; it's bloat and a security violation.
  2. prepare /etc/passwd and /etc/group files ahead of time and copy them into place in the container. Better than the previous option but leaves open the question of what user and group IDs to use.
  3. forego creation of keylime and tss user and group, since container-local group names and IDs don't really matter.

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