Skip to content

Limit permissions of gardener-node-agent instances to required objects #10505

@oliver-goetz

Description

@oliver-goetz

How to categorize this issue?

/area security
/kind enhancement

What would you like to be added:
At the moment gardener-node-agent on every node share their service account (gardener-node-agent) and so also the same permissions.
This means that gardener-node-agents have to many permissions, because they could update Nodes and Leases which belong to different GNAs and they can read OperatingSystemConfig secrets of all worker groups.
The permissions could be reduced way without the necessity to update the core functionality of GNA.

🎯 Goals

  • Each GNA has its own user
  • Reduce permissions of GNA instances
    • GNA can update its own Node only
    • GNA has access to its own Lease only
    • GNA has access to the OSC secret of its own worker group only
  • The feature should be switched on and off without the necessity to role the shoot nodes.

Implementation:

Usernames for GNA
Each instance of gardener-node-agent is using the name of its machine as username.
It cannot use the name of the node, because it is created by kubelet which is deployed by GNA.
It should not use the hostname, because we encountered cases where the hostname changed while GNA was running.
At the moment GNA does not know the name of its machine yet. That's why this feature needs an adapted machine-controller-manager and all provider specific implementations.

node-agent-authorizer webhook
For more granular permissions we cannot rely on the RBAC based authorization only, but could use a Webhook based approach similar to the the SeedAuthorizer we already implemented. The implementation of this NodeAgentAuthorizer could be simpler as there is no need for a dependency graph in this use case.
The webhook is implemented in gardener-resource-manager because it already serves multiple webhooks for shoots.

Certificate based authentication
Certificates and Certificate Signing Requests (CSR) are used to authenticate each GNA individually at the shoot kube-apiserver. The same concept is already used by gardenlet to authenticate at garden-apiserver.

GNA creates CSRs which are automatically approved under these conditions.

  • a machine with the name of the GNA user must exist
  • when a bootstrap token is used: there must not be a node for this machine
  • when a GNA certificate is used: the requesting user and the common name of the certificate must be equal, so GNA is only allowed to renew its on certificate.

There is already a controller in GRM which approves CSRs for kubelet server certificates. This could be adapted for this use-case.

Tasks:

Metadata

Metadata

Assignees

Labels

area/securitySecurity relatedkind/enhancementEnhancement, improvement, extensionlifecycle/activeIndicates that an issue or PR is actively being worked on by a contributor.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions