Repository navigation
[Backport release-1.6] feat(keycloak): let the KMS proxy trust a private Vault CA - #3981
Merged
Kirill Ilin (sircthulhu) merged 3 commits intoAug 28, 2026
Merged
Conversation
The proxy could only reach a Vault whose certificate chains to a publicly trusted root, so a Vault fronted by an internal load balancer with a self-signed certificate was unreachable over HTTPS. Allow the CA to be supplied inline (caBundle, the chart renders the Secret) or as a pre-seeded Secret (caSecretName), mounted and exposed as SSL_CERT_FILE. That redirects only the system trust store, which nothing but the Vault client consults — the database leg verifies against its own CA pool. Assisted-By: Claude AI Signed-off-by: Kirill Ilin <[email protected]> (cherry picked from commit 3531553)
The volume and mount that consume the Vault CA sit at pod level, outside the vault-transit env block, while $vaultCASecret was seeded from caSecretName regardless of the backend. With kms.backend=static and caSecretName set, the Deployment mounted a Secret the chart never renders, so the proxy — the single choke point for all Keycloak DB traffic — would sit in ContainerCreating. Gate both CA keys, and the mutual-exclusion check between them, on vault-transit, so the whole vault.* subtree behaves the same way under static: ignored. Project only ca.crt from a pre-seeded Secret, which keeps a cert-manager tls.key out of the container and turns a bundle stored under another key into a mount failure rather than an opaque TLS error later. Assisted-By: Claude <[email protected]> Signed-off-by: Kirill Ilin <[email protected]> (cherry picked from commit 98ef541)
…ation SSL_CERT_FILE alone does not narrow trust. crypto/x509 replaces only its file list and then scans SSL_CERT_DIR unconditionally, and the pinned proxy image ships /etc/ssl/certs/ca-certificates.crt, so the connection guarding the KEK trusted the private CA plus every public root — a mis-issued certificate for the Vault hostname was still accepted. Set SSL_CERT_DIR to the mount as well, which collapses the pool to the CA the operator configured. An unvalidated caBundle failed open on top of that: a non-PEM value is dropped silently by AppendCertsFromPEM, leaving the proxy on the image's roots with no error at all. Reject it at render time, the way backend and auth already are. Rotating an inline caBundle had no effect either. The pod template did not change, so no new pods, and crypto/x509 memoizes the pool per process — the upgrade reported success while the old CA stayed in use until some later restart. Derive a checksum/vault-ca annotation from the bundle so the rollout happens with the change. Also add vault.caSecretKey: the projected key was hardcoded to ca.crt, and a bundle stored under another name (a cert-manager Certificate from an ACME issuer emits no ca.crt at all) wedged the pod at mount time with no way to correct it from values. Drop the claim that the database leg verifies against its own CA pool: the chart never sets KKP_BACKEND_CA_FILE, so that leg is plaintext today, as the note 30 lines above already says. The conclusion holds — it never consults the system trust store — but for the other reason. Assisted-By: Claude <[email protected]> Signed-off-by: Kirill Ilin <[email protected]> (cherry picked from commit 517e33f)
1 of 11 tasks
Kirill Ilin (sircthulhu)
approved these changes
Aug 28, 2026
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.
Description
Backport of #3874 to
release-1.6.