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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added capability to conceal trusted certificates #392

Merged
merged 5 commits into from
Oct 13, 2023

Conversation

Hakky54
Copy link
Owner

@Hakky54 Hakky54 commented Oct 12, 2023

No description provided.

@Hakky54
Copy link
Owner Author

Hakky54 commented Oct 12, 2023

@gerardnorton I have made a WIP initial implementation. Can you maybe have a look at it?
What do you think, would this work for your situation? If you want to give it a try locally with your own application you can checkout this branch and build the snapshot locally to try it out. If something is missing we can still add it.

The usage in your situation will be:

@Bean
public SSLFactory sslFactory(@Value("${ssl.keystore-path}") String keyStorePath,
                        @Value("${ssl.keystore-password}") String keyStorePassword,
                        @Value("${ssl.truststore-path}") String trustStorePath,
                        @Value("${ssl.truststore-password}") String trustStorePassword)
                        throws Exception {
    ...
    return SSLFactory.builder()
         .withIdentityMaterial(identityKeystore.toPath(), keyStorePassword.toCharArray())
         .withTrustMaterial(identityTruststore.toPath(),   trustStorePassword.toCharArray())
         .withSwappableIdentityMaterial().withSwappableTrustMaterial()
         .withNeedClientAuthentication(Boolean.TRUE)
         .withConcealedTrustedCertificates() //  <--- this option hides your trusted certificates ca names
         .withProtocols("TLSv1.3", "TLSv1.2")
         .withCiphers("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384")
         .withSessionTimeout(3600).withSessionCacheSize(1024).build();
}

This option is compatible even when using the swappable option.

@gerardnorton
Copy link

gerardnorton commented Oct 13, 2023

Hi.
I have tested version 8.1.8-SNAPSHOT locally and it works perfectly.
I have tried this with java-17-openjdk-amd64 and spring-boot-starter-parent 3.0.4.

:-)

@sonarcloud
Copy link

sonarcloud bot commented Oct 13, 2023

Kudos, SonarCloud Quality Gate passed!聽 聽 Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@Hakky54 Hakky54 merged commit d1f522c into master Oct 13, 2023
11 checks passed
@Hakky54 Hakky54 deleted the feature/add-capability-to-conceal-trusted-certificate branch October 13, 2023 10:33
@Hakky54
Copy link
Owner Author

Hakky54 commented Oct 13, 2023

Awesome, great to hear @gerardnorton I added it also to the documentation, see here: https://github.com/Hakky54/sslcontext-kickstart#hide-trusted-certificate-names-of-a-server

I will release a new version coming week, I will keep you up-to-date.

By the way, I did some testing with a huge collection of trusted certficates within a server and this is the results when the I don't configure the server with the new option:

Screenshot 2023-10-13 at 20 20 51

Amazing to see so much information is presented by the server itself.

@gerardnorton
Copy link

gerardnorton commented Oct 14, 2023

Yes.
But keep in mind that when you disable this, you are also disabling OCSP. This functionality is designed to prevent MITM attacks at the certificate level or for the validation of certificates on the client browser side.
It is only advisable to disable this in some cases, such as when you want to protect the identity of users accessing the APP with MTLS and their DN contains sensitive information.

https://en.wikipedia.org/wiki/Online_Certificate_Status_Protocol

OCSP

:-)

@Hakky54
Copy link
Owner Author

Hakky54 commented Oct 14, 2023

Awesome, thank you for this additional context. By the way if you think the overal documentation can be improved, feel free to submit a PR. It seems like you have in-depth knowledge for these kind of topics.

@Hakky54
Copy link
Owner Author

Hakky54 commented Oct 20, 2023

@gerardnorton This option is now available in version 8.2.0

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

Successfully merging this pull request may close these issues.

Disable "Acceptable client certificate CA names" on MTLS client connect.
2 participants