Skip to content

The SSL verification fails even when setValidateCertificates was set to false #209

@ihor-sokoliuk-exa

Description

@ihor-sokoliuk-exa

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:

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions