Skip to content

CKS: all clusters of an account or project share one API key pair, with every permission of its user, that cannot be rotated #14909

In review

Description

@bhouse-nexthop

Problem

Every CKS cluster of an account or project uses the same API key pair:

Owner Key pair the cluster gets
Account The latest key pair of the user <account>-kubeadmin, inside the owner's account, so with all the owner's rights
Project The latest key pair of the project's service account kubeadmin-<project>, with the "Project Kubernetes Service Role"

The key pair is stored in kube-system/cloudstack-secret of every cluster of that owner and is never rotated. So:

  • Anyone who can read secrets in kube-system of one cluster can change the load balancer, firewall and network ACL rules of every other cluster of the same owner, take public IPs, and scale those clusters. For an account-owned cluster, they get all the rights of the owner.
  • The keys reach the control node on the SSH command line (deploy-cloudstack-secret -k <api key> -s <secret key>), visible in the process list, and are written to /tmp/cloud-config.
  • deploy-cloudstack-secret creates the secret only if it does not exist, so the keys cannot be replaced.

Key pairs with their own rules exist on main since #9504, but CKS does not use them.

Expected

  • Each cluster has its own key pair, limited to the APIs that its CloudStack components call: the CloudStack Kubernetes provider (cloud controller manager), the cluster autoscaler, and the CloudStack CSI driver when the cluster has CSI enabled.
  • The keys never go on a command line.
  • An API to replace a cluster's key pair, and deleting the cluster deletes its key pair.

Versions

main (24.0.0), KVM; any hypervisor and storage.

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