jhunt / k8s-boshrelease

A BOSH Release for deploying Kubernetes clusters
MIT License
13 stars 9 forks source link

Check Validity of provided CA certificate #45

Closed jhunt closed 4 years ago

jhunt commented 4 years ago

Just ran into a case where credhub had an old TLS CA certificate for a test deployment I use everywhere, and that CA had expired. This lead to some obscure breakage in the API server, which was unable to talk to etcd (because it couldn't / wouldn't validate with an expired CA in the chain).

Unfortunately, this manifested as a low-level gnutls error:

gnutls_handshake() failed: Certificate is bad

While true, this error is pretty ambiguous - is the etcd server cert bad? The api's client cert? Turns out it was the CA.

I eventually got past the issue by deleting the (generated) CA certificate so that a subsequent bosh deploy would re-create it (and I'd be good for another year!), but I would really like to see some validation in pre-start (or, if possible, in the job rendering templates via a raise) that checks:

  1. The CA certificate must have the CA:TRUE constraint
  2. The NotBefore validity start date is in the past
  3. The NotAfter validity end date is in the future