Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

SSL/TLS support #73

Closed
JesperTerkelsen opened this issue Nov 2, 2015 · 6 comments
Closed

SSL/TLS support #73

JesperTerkelsen opened this issue Nov 2, 2015 · 6 comments

Comments

@JesperTerkelsen
Copy link

Currently its not possible to use this java client against a consul server with SSL enabled.
Or even specify the https protocol.

@rickfast
Copy link
Owner

rickfast commented Nov 4, 2015

I'll add the ability to provide an SslContext. You can specify https if you supply a raw url as a string.

@rickfast
Copy link
Owner

rickfast commented Nov 4, 2015

Via 1599099 you can do something like this:

SSLContext context = SSLContext.getInstance("TLSv1");
TrustManager[] trustManagerArray = {
    NullX509TrustManager.INSTANCE
};

context.init(null, trustManagerArray, null);

Consul.builder().withUrl("https://your-secure-host:8500").withSslContext(sslContext).build();

@JesperTerkelsen
Copy link
Author

👍 Nice this is just what i need!

@rickfast rickfast closed this as completed Nov 5, 2015
@jadams74
Copy link

Why a Null trust manager here? Doesn't this undo cert verification/validation?

@rickfast
Copy link
Owner

yes, but the point of the comment wasn't to explain how Java SSL contexts work, it was to show how to provide it to the API

@jadams74
Copy link

roger, just hope noone c&p that snippet ;)

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

No branches or pull requests

3 participants