-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Ssl Bundle InsecureTrustManagerFactory Configuration #38920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you need to work with self-signed certificates or for testing purposes, consider using an InsecureTrustManagerFactory. This involves creating a custom SSLContext with an InsecureTrustManager and setting it as the default for your HTTPS connections. For the Custom manager Factory you have the scenarios where you have specific truststore requirements, create a custom SSLContext with a TrustManagerFactory initialized with your custom truststore. Ensure that you load your truststore appropriately and initialize the SSLContext with the custom trust manager. |
@Nikunj2788 ask is how to do the same via Ssl Bundles. Thanks |
@syedyusufh if you're interacting with a server that uses a self-signed certificate, have you considered trusting that certificate alone on the client-side? That, I think, would be the SSL bundle way of doing things. If you want the client to trust all self-signed certificates or to skip hostname verification, that should be done with client-specific configuration and not through SSL bundles. |
@wilkinsona thanks for your comments. My understanding is that Ssl Bundle manages the trustStore, trustStrategy, etc as part of the Ssl Bundle configuration via In other words, how can I construct a full beneficial Ssl Bundle of my underlying JKS with trustStore, trustStrategy programmatically? Thanks |
I don't think I understand why you need both. You can configure an SSL bundle that trusts the server's unsigned certificates or you can configure whatever HTTP client you're using to use an insecure trust manager. Doing one of these negates the need for the other, does it not? |
Let us please consider the below sample from Spring.io Blog on how to setup SSL for
How do we now configure the underlying (
|
I agree with Andy's statement above:
Disabling hostname verification is a very dangerous thing to do. It might be useful for testing sometimes, but I don't think Spring Boot should do anything more to make this easy to do so that user's don't mistakenly disable verification in production applications.
One option would be to keep your code that sets up the |
Hi @scottfrederick thanks for your inputs. Like any enterprise we have both modern and legacy systems, so the custom
Spring Boot framework today provides options to configure your own
Can we get the Ssl Bundle benefit of dynamic reloading of Ssl Context if the framework managed Thanks |
@syedyusufh I'm afraid it's still not completely clear what you're trying to accomplish. It seems that you are mostly concerned with configuring SSL for client connections. Reloading of SSL material with SSL bundles is only supported for server-side connections when using Tomcat or Netty as an embedded web server, so your questions about reloading the SSL context would not apply to your client connections. I think we would make more progress on this discussion if we had a small code sample of what you are doing now. Can you provide a complete minimal application that demonstrates your use case, and share it with us by pushing it to a separate repository on GitHub or by zipping it and attaching it to this issue? That would make it much easier for us to see if there's anything we can add to our APIs for custom configuration of client connections. |
I got it now. Sorry, I was with the impression Kindly consider allowing an option to customize the Thanks |
@syedyusufh i'm a bit late to the party, but i had a similar situation i think where i needed to connect to a https server. It wasn't possible to customize the SSLBundle trustmanagers / trustmanagerfactory so i ended up using the SSLBundle only to load the keys from the files. I didn't use it to build my RestTemplate and initialized the SSLContext with the SSLBundle's KeyManager[]. So, instead of:
i did:
with SSLUtils:
|
I am still of the opinion that Spring Boot should not have a built-in ability to disable hostname verification or otherwise configure insecure connections. Users can do this now by creating their own client connections as has been mentioned above and demonstrated by @guybedo. We could make it simpler to customize a connection that has been created by Spring Boot, which is also suggested more generally in #39035. I'll close this issue as a duplicate. |
How do we configure the Ssl Bundle to use InsecureTrustManagerFactory or custom TrustManagerFactory or skip hostname verification? Couldn't find these details in the documentation. Thanks
The text was updated successfully, but these errors were encountered: