Skip to content
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

2 way ssl: self signed certificate in truststore #12148

Closed
dyutiman opened this issue Aug 7, 2024 · 5 comments
Closed

2 way ssl: self signed certificate in truststore #12148

dyutiman opened this issue Aug 7, 2024 · 5 comments

Comments

@dyutiman
Copy link

dyutiman commented Aug 7, 2024

Jetty Version: 11.0.17

Java 11

We were trying to achive 2 way SSL and configured the keystore, truststore and the certificate alias in SslContextFactory.Client. We also set ValidateCerts to true.

What we observe is if the self signed client certificate is not present in the truststore, Jetty is throwing error "unable to find valid certification path to requested target". And this is happening even before any commnucation is started with the backend.

It is unconventional to require a client to import its own certificate into its truststore. The trsutstore should have server's certificates from the backends.

If we set ValidateCerts to false then this issue goes away. So I just wanted to confirm this Jetty behavior that why it expects client to have its own certificate in the truststore.

  • thanks
@joakime
Copy link
Contributor

joakime commented Aug 7, 2024

Jetty 11 is now at EOSL (End of Service/Support Life), you should be using a supported version of Jetty now, which is Jetty 12 as of today.

@sbordet
Copy link
Contributor

sbordet commented Aug 7, 2024

What we observe is if the self signed client certificate is not present in the truststore, Jetty is throwing error "unable to find valid certification path to requested target". And this is happening even before any commnucation is started with the backend.

This is what validateCerts=true is doing: it validates the certificates, and obviously for self-signed certificates the validation fails.

Why did you set it to true?

@dyutiman
Copy link
Author

dyutiman commented Aug 9, 2024

At first we have a connection object and the same connection is used to get the SSL configuration for Jetty. If the hostname verifier in the connection object is set to DefaultHostnameVerifier, only then we set the validateCerts=true in Jetty's SSL configuration.

So, the validateCerts=true is used to validate the client certificate only? What is the effect if we set it to false?

@sbordet
Copy link
Contributor

sbordet commented Aug 10, 2024

validateCerts validates the local certificates in the KeyStore at startup, for example that they are not expired, that they have not been revoked, that their certificate chain is valid, etc.

Validation of the peer certificates is performed elsewhere, and at a different time than startup.

@dyutiman
Copy link
Author

Thanks @sbordet for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants