You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The SSL verification fails even when setValidateCertificates was set to false #209
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:
Hi @ihor-sokoliuk-exa sorry for the delay in the response, but we have kept the hostname checks for security purpose. So to provide a way to influence the hostname verification will impact the security. We are working on a feature to enable passing a SSL certificate which I think would help with your use-case. Once we have the feature fully developed we will publish a new SDK release. Will update you once we have a new release.
// Disable SSL certificate validation
HttpService.setValidateCertificates(false);
// Disable hostname verification
// This verification does not work with Splunk self-signed certificates
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
return true;
}
});
It turns off all checks for the server certificate, including the self-signed certs and hostname validation.
Add this code snippet before Service.connect(args) call.
Activity
ashah-splunk commentedon Jun 2, 2023
Hi @ihor-sokoliuk-exa sorry for the delay in the response, but we have kept the hostname checks for security purpose. So to provide a way to influence the hostname verification will impact the security. We are working on a feature to enable passing a SSL certificate which I think would help with your use-case. Once we have the feature fully developed we will publish a new SDK release. Will update you once we have a new release.
ihor-sokoliuk-exa commentedon Jun 2, 2023
Hi @ashah-splunk,
Thank you for your reply.
Is it possible to add the flag that turns off the hostname verification for debug purposes?
It often happens, when you need to test your code on a dev env, and security and self-signed certs are not the primary thing you are worried about.
ihor-sokoliuk-exa commentedon Apr 10, 2024
@ashah-splunk There is a solution to that issue.
It turns off all checks for the server certificate, including the self-signed certs and hostname validation.
Add this code snippet before
Service.connect(args)call.