Skip to content

CKS: private registry credentials are written to the node logs, and special characters break node setup #14917

Backlog

Description

@bhouse-nexthop

Problem

When a CKS cluster is created with a private registry (dockerregistryurl, dockerregistryusername,
dockerregistrypassword):

  1. Every worker and control node runs /opt/bin/setup-containerd from its cloud-config as
    bash -x /opt/bin/setup-containerd. The trace prints each line of the script with its values filled in, so the
    registry user name and password (in plain text, and as the base64 auth string) are written to
    /var/log/cloud-init-output.log on every node.
  2. The registry URL, user name and password are put into the cloud-config by plain text substitution. A double quote,
    backslash, $ or newline in them breaks the generated script or the YAML. The control node template is rendered
    by cloud-init as a Jinja template, so {{, {% or {# in any of these values makes the rendering fail; cloud-init
    then drops the whole cloud-config and the control node is never set up.

/opt/bin/setup-containerd is also mode 0755, and the containerd config it writes the credentials into is 0644.

Steps to reproduce

  1. Create a CKS cluster with a private registry.
  2. On a worker node, sudo grep -c auth /var/log/cloud-init-output.log finds the traced lines with the base64 auth
    string (username/password in plain text on 4.22).
  3. With {{ in the password, the control node does not come up.

Expected

No registry credential in the node logs or in files other users can read, and any character in the registry values
gets to containerd unchanged.

Activity

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