Use SystemCertPool for OpenShift OAuth token exchange#900
Open
rubenvp8510 wants to merge 1 commit intoobservatorium:mainfrom
Open
Use SystemCertPool for OpenShift OAuth token exchange#900rubenvp8510 wants to merge 1 commit intoobservatorium:mainfrom
rubenvp8510 wants to merge 1 commit intoobservatorium:mainfrom
Conversation
The OAuth HTTP client used x509.NewCertPool() which creates an empty certificate pool, then only adds the Kubernetes service account CA. This excludes all system-trusted CAs (Let's Encrypt, DigiCert, etc.). On regular OpenShift this works by coincidence because the ingress CA is part of the service account CA bundle. On HyperShift/HostedCluster environments (e.g. ROSA) the OAuth endpoint uses a publicly-trusted certificate (Let's Encrypt) that is not in the SA CA bundle, causing "x509: certificate signed by unknown authority" errors during the OAuth callback token exchange. Switch to x509.SystemCertPool() so that system-trusted CAs are included alongside the service account CA. Falls back to an empty pool if SystemCertPool() is unavailable. Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
8261ae9 to
faee945
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The OAuth HTTP client used x509.NewCertPool() which creates an empty certificate pool, then only adds the Kubernetes service account CA. This excludes all system-trusted CAs (Let's Encrypt, DigiCert, etc.).
On regular OpenShift this works by coincidence because the ingress CA is part of the service account CA bundle. On HyperShift/HostedCluster environments (e.g. ROSA) the OAuth endpoint uses a publicly-trusted certificate (Let's Encrypt) that is not in the SA CA bundle, causing "x509: certificate signed by unknown authority" errors during the OAuth callback token exchange.
Switch to x509.SystemCertPool() so that system-trusted CAs are included alongside the service account CA. Falls back to an empty pool if SystemCertPool() is unavailable.