kubeadm icon indicating copy to clipboard operation
kubeadm copied to clipboard

Stop using system-level certificates directories (i.e. /etc/pki, /etc/ssl/certs, and /etc/ca-certificates directories)

Open rcythr opened this issue 5 years ago • 10 comments

I posted in slack the following suggestion; @neolit123 suggested we log an issue to track/discuss it here instead:

Issues #279 , #1367, and #1665 all share a common theme regarding the troublesome /etc/pki, /etc/ssl/certs, and /etc/ca-certificates directories.

I suggested in the sig-cluster-lifecycle slack of moving the ca certificates directory which kubeadm uses to something which kubeadm controls (e.g. /etc/kubernetes/ca-certificates/ or similar) instead of using the system controlled directory. Doing this would immediately allow all of these issues to have straightforward resolutions:

  • The technical aspects of #279 can be resolved via chcon, starting with container_sandbox_t and eventually moving to nicely constrained custom types.
  • #1367 has hostPath entries which can be properly mounted after chown/chmod for a kubernetes user/group.
  • #1665 becomes a no-op to resolve as we no longer need to know where the particular distro in use puts the certificate files, nor whether they're stored alongside private keys.

/assign @randomvariable @neolit123 /area security /kind design

rcythr avatar Jul 29 '19 01:07 rcythr

It sounds good. I don't know enough about this topic to really get my head around the suggestion though.

At the moment you can have a single root CA, even managed outside the cluster, with the root CA published to the system CA certificate store on machines that care about such things.

It sounds like this change still fits in OK with that single root CA approach. I want to check this is currently feasible and will stay feasible:

  • the private key for the root CA is locked away, offline
  • the root CA's certificate is in the system-level CA directory, and kubeadm is not managing this root CA
  • the CA certificates for the etcd CA and the API server CA are inside /etc/kubernetes/pki, pretty much everywhere connected with the cluster.
  • On the API server(s), the private keys for the intermediate API server CAs are also inside /etc/kubernetes/pki/.

The model I have is that if Kubernetes is using a internal CA, and this proposal happens, it's almost the same layout as with an offline root and intermediate CAs, only now the Kubernetes-specific root CA lives in (eg) /etc/kubernetes/ca-certificates/, and kubeadm does manage the root CA.

sftim avatar Jul 29 '19 21:07 sftim

  • the root CA's certificate is in the system-level CA directory, and kubeadm is not managing this root CA

This use case would be impacted as part of this proposed change. With the change, any necessary external CA root certificates would need to be placed in the kubeadm-managed directory (e.g. /etc/kubernetes/ca-certificates/). Using the system-level directory isn't feasible unless kubeadm intends to get into the "distro mess". This is the problem being discussed on #1665 .

rcythr avatar Jul 30 '19 21:07 rcythr

If we do this, we'll start being in the business of managing root certificates for the controller-manager cloud provider client code. Is that something kubeadm or the kubernetes project wants to be responsible for?

In addition, organisations that are using proxies may know how to run the distro appropriate commands to include their organisation root CA, but this would break again for kubernetes.

Let's disambiguate a few things:

At the moment you can have a single root CA, even managed outside the cluster, with the root CA published to the system CA certificate store on machines that care about such things.

#1665 was only about the root CAs for clients of external services. Right now, this is controller manager talking to cloud providers. The out-of-tree cloud providers will eventually need this.

In addition, single CA roots for the entire control plane are not desirable. kubeadm does the right thing by producing independent CAs for etcd, API server, front-proxy etc...

The technical aspects of #279 can be resolved via chcon, starting with container_sandbox_t and eventually moving to nicely constrained custom types.

Distro container-selinux packages should be responsible for allowing containers to mount the relevant root CA cert directories.

randomvariable avatar Jul 31 '19 04:07 randomvariable

If we do this, we'll start being in the business of managing root certificates for the controller-manager cloud provider client code. Is that something kubeadm or the kubernetes project wants to be responsible for?

i think we shouldn't as this falls outside of the "minimal viable cluster" case. kubeadm already manages quite a big number of certificates and we should avoid including more.

In addition, organisations that are using proxies may know how to run the distro appropriate commands to include their organisation root CA, but this would break again for kubernetes.

this can be a problem, yes.

neolit123 avatar Jul 31 '19 12:07 neolit123

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Feb 11 '20 18:02 fejta-bot

/lifecycle frozen

neolit123 avatar Feb 11 '20 18:02 neolit123

@rcythr

i revisited these two issues: https://github.com/kubernetes/kubeadm/issues/1692 https://github.com/kubernetes/kubeadm/issues/1665

currently we are mounting "some" folders in the CP component containers so they can use them. these components are built with golang and we have no control over how it constructs the bundle of system root CAs.

https://golang.org/src/crypto/x509/root_linux.go https://github.com/golang/go/blob/2ebe77a2fda1ee9ff6fd9a3e08933ad1ebaea039/src/crypto/x509/root_unix.go

currently golang does not expose a way to return the folders / files it found (no public methods for that). but if we had these files / folders we could have made kubeadm mount them in the CP static pods.

I suggested in the sig-cluster-lifecycle slack of moving the ca certificates directory which kubeadm uses to something which kubeadm controls (e.g. /etc/kubernetes/ca-certificates/ or similar) instead of using the system controlled directory. Doing this would immediately allow all of these issues to have straightforward resolutions:

so the question here is how to find the paths that will be used for the construction of the root CA bundle and move it to a common location, while avoiding the distro mess and forking golang?

instead of moving these path contents to a common kubeadm maintained location, we might as well just mount them directly. https://github.com/kubernetes/kubeadm/issues/1367 is not an issue since non-root components can still mount root owned paths.

neolit123 avatar May 17 '21 23:05 neolit123

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Aug 16 '21 00:08 k8s-triage-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Nov 21 '21 16:11 k8s-triage-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Feb 21 '22 18:02 k8s-triage-robot

closing as per the discussion above and given nothing actionable was done in the past 5 years. https://github.com/kubernetes/kubeadm/issues/1692#issuecomment-516828118

neolit123 avatar Apr 18 '24 06:04 neolit123