[certificates]: validate that certs are valid for a Gitpod install #13471
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add some rudimentary checks for the certificate - importantly, these are the skateboard not the finished article. These download and decode the certificate secret and perform the following checks:
$DOMAIN
,*.$DOMAIN
and*.ws.$DOMAIN
exist in the secret (the subject alternate names seems to be non-standard, so this is a simplegrep
)notBefore
andnotAfter
timestampsNB it does NOT validate that the certificate's CA is known and installed in the cluster. That's important but it's beyond the 🛹
As with the other KOTS checks, these are perhaps a little rudimentary but they give an indication of whether the provided state is Gitpod-compatible. As there's a time-based test, it is plausible (however unlikely) that this could fail 5 minutes later if the cert expiry then occurs - again, this can be tweaked as a 🚲
IMPORTANT this is not provided as a pre-flight check. As the majority of our users will be using LetsEncrypt and cert-manager to generate their certs, these are not triggered until AFTER the first deployment. This would mean that the pre-flight checks are likely to fail. Instead, this is part of the troubleshooting to provide answers if the installation is not working.
Related Issue(s)
Fixes #11865
How to test
Install via KOTS and go to "troubleshoot" to build a support bundle. This has been checked with both a LetsEncrypt and a self-signed cert built in-cluster. I do not have a valid, publicly-signed cert that's not provided by LetsEncrypt.
To check the edge-cases that KOTS smooths away for us, you can run the script in the image directly
Release Notes
Documentation
Werft options:
If enabled this will build
install/preview
Valid options are
all
,workspace
,webapp
,ide