[bitnami/kafka] Multiple CA certificates are not mounted into Truststore when using PEM certs #25400
Labels
kafka
solved
stale
15 days without activity
tech-issues
The user has a technical issue about an application
triage
Triage is needed
Name and Version
kafka:28.0.4
What architecture are you using?
amd64
What steps will reproduce the bug?
Using cert-manager, you will need to create a root and intermediate CA certificate. Something like the following will work:
Then, you'll need to create a certificate for the Kafka Controller+Broker using cert-manager and that new
test-intermediate-ca
as the ClusterIssuer:This will generate a certificate in the
kafka-test
namespace with a keytls.crt
with the leaf certificate followed by the certificate for thetest-intermediate-ca
. Supply this certificate to thetls.existingSecret
key:I've also configured all listeners to use SSL and require client authentication. For example:
Your usage of the
keytool
will not import thattest-intermediate-ca
certificate into truststore. I've found thatkeytool
, while it claims thatkeytool -import -file
can import a certificate or certificate chain, will only import the first certificate it finds in the file supplied. In this case, it will import the leaf certificate into the truststore and completely ignore the intermediate certificate.The result is a failure to launch the Kafka pod due to a malformed truststore.
Are you using any custom parameters or values?
Yes, I create a template file for the cert-manager certificate:
That
kafka
Values section, I add from my own values file:I deploy the Bitnami Kafka chart using the following command:
What is the expected behavior?
When I use a chain of certificates, the intermediate certificates are loaded into the Truststore properly in the named template file
templates/scripts-configmap.yaml
under the functionconfigure_kafka_tls()
.What do you see instead?
An error regarding a malformed truststore preventing the Kafka cluster from starting properly.
Additional information
The usage of
keytool
is misleading based on their description of how thekeytool -import -file
function works. It claims to import a certificate chain if one exists, but it doesn't. It only imports the first certificate it finds in the file provided. I've had to fix this for my usage in other parts of my infrastructure. The workaround is that you must import the certs one by one. I have settled on splitting all certificates in a single certificate file into their certificate files, iterating each of these split files, and one-by-one importing them into the truststore. This way, the entire chain of certificates is included in the truststore. I'd prefer to use PEM certificates, but I have a workaround by using JKS, creating an initContainer that injects the appropriate chain of certificates into the truststore, and then finally mounting these certificates in a local volume to your/mounted-certs
directory.The text was updated successfully, but these errors were encountered: