<環境>
Java:8.45
Splunk SDK:1.4.0
Splunk:6.2.2
原因は、splunk java SDKではhttps接続にSSLv3を使用しているようなのですが、最新のjava8(jre)ではセキュリティの理由によりSSLv3が使用不可となっているためのようです。
出力されるエラー内容は以下。
Exception in thread "main" java.lang.RuntimeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate) at com.splunk.HttpService.send(HttpService.java:371) at com.splunk.Service.send(Service.java:1280) at com.splunk.HttpService.post(HttpService.java:272) at com.splunk.Service.login(Service.java:1111) at com.splunk.Service.login(Service.java:1091) at com.splunk.Service.connect(Service.java:185) at splunk.sample.OneShotSearch.main(OneShotSearch.java:18) Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate) at sun.security.ssl.Handshaker.activate(Unknown Source) at sun.security.ssl.SSLSocketImpl.kickstartHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source) at com.splunk.HttpService.send(HttpService.java:365) ... 6 more
対処方法があるみたいなのでまとめておきます。
- javaのhttps設定を変更する
- プロパティを指定する
1. javaのhttps設定を変更する
javaのセキュリティ設定が最新のJava8では以下に変更されているのが原因。
jar8/lib/security/java.security
jar8/lib/security/java.security
: # Example: # jdk.tls.disabledAlgorithms=MD5, SHA1, DSA, RSA keySize < 2048↓
: # Example: # jdk.tls.disabledAlgorithms=MD5, SHA1, DSA, RSA keySize < 2048 jdk.tls.disabledAlgorithms=SSLv3
そのため、設定行をコメントアウトすることでSSLv3が使用可能となる。
※もちろん、セキュリティは低下する。
: # Example: # jdk.tls.disabledAlgorithms=MD5, SHA1, DSA, RSA keySize < 2048 #jdk.tls.disabledAlgorithms=SSLv3
2. プロパティを指定する
サービスの接続時に指定するServiceArgsにSSL以外のものを指定することでアクセスできます。ServiceArgs loginArgs = new ServiceArgs(); : loginArgs.setSSLSecurityProtocol(SSLSecurityProtocol.TLSv1); : Service service = Service.connect(loginArgs);
とりあえず「SSLSecurityProtocol.TLSv1」を指定しておけば大丈夫です。
※コミュニティを見ると、SDKのソースコードを修正して自分でビスドされている方もいるようですが、今はプロパティ指定で問題ないみたいです。 今後は、デフォルトを「SSL」以外にするか、ドキュメントで説明するよう対応してもらいたいです。。。