Option to merge the JVM truststore with user-supplied truststore#461
Option to merge the JVM truststore with user-supplied truststore#461thelabdude wants to merge 3 commits intoapache:mainfrom
Conversation
HoustonPutman
left a comment
There was a problem hiding this comment.
Would you be able to add something to the docs about this as well?
Also a changelog entry would be much appreciated 🙂
| // Path on the Solr image to your JVM's truststore to merge with an external truststore. | ||
| // If supplied, Solr will be configured to use the merged truststore. | ||
| // The truststore for the JVM in the default Solr image is: $JAVA_HOME/lib/security/cacerts | ||
| MergeJavaTruststore string `json:"mergeJavaTrustStore,omitempty"` |
There was a problem hiding this comment.
Can we add the // +optional tag for both of these new options? Just for consistency sake
| MergeJavaTruststore string `json:"mergeJavaTrustStore,omitempty"` | ||
|
|
||
| // Password for the Java truststore to merge; defaults to "changeit" | ||
| MergeJavaTruststorePass string `json:"mergeJavaTrustStorePass,omitempty"` |
There was a problem hiding this comment.
Should this be a secret reference? How bad is it to have this in plain text?
There was a problem hiding this comment.
seemed like overkill to me since it's the truststore pass for the JVM which is most likely "changeit" and isn't used by Solr ... that said, we can pull from a secret too ... doubt many would ever use this option.
There was a problem hiding this comment.
ahhh ok, didn't understand it was unusual to change it. Sounds good
controllers/util/solr_tls_util.go
Outdated
| mergeMount := &corev1.VolumeMount{Name: volName, ReadOnly: false, MountPath: mountPath} | ||
| mounts = append(mounts, *mergeMount) | ||
|
|
||
| return &corev1.Container{ |
There was a problem hiding this comment.
Could we possibly use the default initContainer resources?
You can see how it was done in this PR: https://github.com/apache/solr-operator/pull/451/files#diff-653faf42eabedf3285e433f247c993282f035ee70781d151f8c8d68fee2621a3R618-R649
| // Path on the Solr image to your JVM's truststore to merge with an external truststore. | ||
| // If supplied, Solr will be configured to use the merged truststore. | ||
| // The truststore for the JVM in the default Solr image is: $JAVA_HOME/lib/security/cacerts | ||
| MergeJavaTruststore string `json:"mergeJavaTrustStore,omitempty"` |
There was a problem hiding this comment.
Does this work with mountedTLSDir?
There was a problem hiding this comment.
Typically, mountedTLSDir will have a csi driver volume and corresponding mount on the mainContainer, which would get used by the merge initContainer, so the init container would get the truststore file. However, that might cause double creation of the cert for each pod, once for the initContainer and once for the main container, so this would likely put a lot of pressure on the Cert issuer. So probably safer to say this feature is not supported with mountedTLSDir option for now.
There was a problem hiding this comment.
No, nvm all that volumesAndMounts doesn't include vols & mounts for the mountedTLSDir option. So this option is not going to work with mountedTLSDir.
So maybe we just punt on this feature for 0.6 and solve it using an init-db script instead? There's already some code in place for mounting a script into the init-db.
|
I think we should hold off on this solution for 0.6 as now I'm thinking the better approach would be to use the init-db script approach built into the Solr image. The problem with the current solution in this PR is it doesn't work with the |
|
Sounds good Tim. Thanks for putting in the effort on this though! |
Fixes #390 ~ by allowing the JVM cacerts to get merged in with the user-supplied truststore (Let's Encrypt's CA is in the cacerts for modern JVM)
Users can now configure the TLS options to merge the JVM's truststore with the truststore for their certs using:
The path given in
mergeJavaTrustStoreoption must exist on the Solr docker image! Thus, if users customize their Solr image, this path may be different.Behind the scenes, this creates an additional
initContainerthat merges the two truststores together and then points the env var to the "merged" truststore. The actual merging is done withkeytool.For server TLS:
By pointing
SOLR_SSL_TRUST_STOREenv var at the merged truststore, we're ensured that all the other initContainers and liveness probes continue to work (as they just use the env var to resolve this path).Added a few simple unit tests and tested manually in my cluster.
For Prom exporter, the config would be:
Which results in the exporter container getting configed with env var: