-
Notifications
You must be signed in to change notification settings - Fork 559
Description
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
Nodeonly - GNA has access to its own
Leaseonly - GNA has access to the OSC secret of its own worker group only
- GNA can update its own
- 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:
- Add
machine-nameto user data and as a node label in MCM: Introduce a feature to propagate the machine name to user data and as label to the node machine-controller-manager#919 - Update provider specific MCMs:
-
gardener/machine-controller-manager-alicloud: Update pipeline integratio tests to now run tests on a control cluster machine-controller-manager-provider-alicloud#86 -
gardener/machine-controller-manager-aws: [ci:component:github.com/gardener/machine-controller-manager:v0.53.0->v0.54.0] machine-controller-manager-provider-aws#175 -
gardener/machine-controller-manager-azure: [ci:component:github.com/gardener/machine-controller-manager:v0.53.1->v0.54.0] machine-controller-manager-provider-azure#166 -
gardener/machine-controller-manager-gcp: [ci:component:github.com/gardener/machine-controller-manager:v0.53.1->v0.54.0] machine-controller-manager-provider-gcp#129 -
gardener/machine-controller-manager-openstack: update mcm dependency machine-controller-manager-provider-openstack#181 -
ironcore-dev/machine-controller-manager-provider-ironcore: Bump MCM to v0.55.1 ironcore-dev/machine-controller-manager-provider-ironcore#442 -
ironcore-dev/machine-controller-manager-provider-metal: Bump github.com/gardener/machine-controller-manager from 0.53.1 to 0.54.0 ironcore-dev/machine-controller-manager-provider-ironcore-metal#20 -
metal-stack/machine-controller-manager-provider-metal: Revendor MCM v0.54.0. metal-stack/machine-controller-manager-provider-metal#38
-
- Introduce
node-agent-authorizerwebhook ingardener-resource-mananger: [node-agent-authorizer] Introducenode-agent-authorizerwebhook ingardener-resource-manager#10535 - Adapt
CSRApproverofgardener-resource-managerto approve CSRs created bygardener-node-agent: [node-agent-authorizer] auto-approvegardener-node-agentCSRs ingardener-resource-manager#10549 - Implement webhook based authorization in
gardener-node-agent: [node-agent-authorizer] Introduce webhook based authorization togardener-node-agent#10781 - Promote
NodeAgentAuthorizerfeature gate to beta: PromoteNodeAgentAuthorizerfeature gate to beta #11757 - Graduate
NodeAgentAuthorizerfeature gate to GA: GraduateNodeAgentAuthorizerfeature gate to GA #12405 - Remove access token based authorization and drop
NodeAgentAuthorizerfeature gate aftergardener/gardener@v1.123was released: RemoveNodeAgentAuthorizerfeature gate #12576