spring-cloud / spring-cloud-config

External configuration (server and client) for Spring Cloud
Apache License 2.0
1.96k stars 1.29k forks source link

"KeyStoreException: Keystore not specified" when only truststore is configured in config client configuration. #2514

Closed KrishnaST closed 1 month ago

KrishnaST commented 1 month ago

I have TLS enabled eureka server. Microservice is trying to fetch configuration from config server throws "KeyStoreException: Keystore not specified" when only truststore is configured. should be able to trust server certificate by truststore configuration. There is no mutual authentication.

Following is micro-service configuration image

It seems that there is no way to configure truststore without configuring the keystore even when mutual authentication is not required.

org.springframework.cloud.configuration.SSLContextFactory
image

Spring Config Client Version : 4.1.3

ryanjbaxter commented 1 month ago

Is that because builder.loadKeyMaterial throws an exception and we never call builder.loadTrustMaterial? Can you provide a sample to reproduce the error?

KrishnaST commented 1 month ago

Yes, call to loadKeyMaterial will throws a KeystoreException and the execution will never reach the loadTrust.

Here is a minimal sample to reproduce the error and log. config-client-log.log

https://github.com/KrishnaST/Config-Client-TLS-Issue