-
Notifications
You must be signed in to change notification settings - Fork 121
Description
I have a Splunk server with self-signed certificates. And I am writing a Java Client to fetch logs from the Splunk server using the latest Splunk SDK lib (v1.9.3).
To connect to my test server, I use the next code line to ignore certificate validation:
Service.setValidateCertificates(false);
It works as a charm, there is no more self-signed certificate issue.
But another issue appeared after that.
HTTPS hostname wrong: should be <my splunk server IP>
I see in the Splunk SDK source code it is configured to verify hostnames:
splunk-sdk-java/splunk/src/main/java/com/splunk/HttpService.java
Lines 56 to 65 in 00cd195
| private static final HostnameVerifier HOSTNAME_VERIFIER = new HostnameVerifier() { | |
| public boolean verify(String s, SSLSession sslSession) { | |
| if (s.equals(HOSTNAME) || s.equals(HOSTIP)) { | |
| return true; | |
| } else { | |
| HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier(); | |
| return hv.verify(s, sslSession); | |
| } | |
| } | |
| }; |
Is it right to say that there is no way to influence that with any available public method because of this code line?
| ((HttpsURLConnection) cn).setHostnameVerifier(HOSTNAME_VERIFIER); |
If yes, is it possible to add a new method to the Splunk SDK to bypass the hostname verification?
Thank you!