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

Document how to specify a truststore #85

Open
ind1go opened this issue Oct 16, 2020 · 4 comments
Open

Document how to specify a truststore #85

ind1go opened this issue Oct 16, 2020 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@ind1go
Copy link
Member

ind1go commented Oct 16, 2020

The current doc has an all-or-nothing approach to dealing with self-signed or internally-signed certificates - trust everything or add the certificate to your JVM's cacerts.

However, a nice flexible, and secure alternative is to use system properties to specify a specific truststore, without altering the JVM's supplied cacerts.

@ind1go ind1go added the documentation Improvements or additions to documentation label Oct 16, 2020
@ind1go
Copy link
Member Author

ind1go commented Oct 16, 2020

See HttpClientBuilder for the system properties that are used.

@vera-chan
Copy link
Member

@ind1go
Copy link
Member Author

ind1go commented Aug 17, 2022

Just need to verify that it works, first!

@ind1go
Copy link
Member Author

ind1go commented Aug 17, 2022

My findings are these:

The use of the system properties is effective (for example, at a minimum you can use javax.net.ssl.trustStore to specifying the location of a trust store and as long as it matches the default type for that Java version (8 and below: JKS; 9 and above: PKCS) it'll read the certificate(s) out of the trust store and use them for the deployment.

However, it's not all good news. Because this is all part of the Gradle build, the system properties affect all of that process. So say you create a trust store using just the single self-signed certificate you need to get deployment working, you will find that things like the downloading of Gradle plugins (like this plugin itself) and project dependencies will not work. So instead you need to create a trust store that trusts all of those sources as well as your self-signed certificate. The easiest way to do that is probably to copy the JRE's built-in cacerts file and add your self-signed certificate to it.

I think that instead of documenting this method, we may be better creating a mechanism to supply trust store and key store configuration to the plugin directly - and possibly, waiting for a user requirement to do so first.

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

No branches or pull requests

2 participants