Let HTTPS work correctly
This commit is contained in:
parent
00d663f594
commit
13636dcfef
|
@ -33,10 +33,6 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.TrustManager;
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
@ -87,34 +83,6 @@ public class PluginManager {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.outputMode = outputMode;
|
this.outputMode = outputMode;
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
|
|
||||||
TrustManager[] trustAllCerts = new TrustManager[]{
|
|
||||||
new X509TrustManager() {
|
|
||||||
@Override
|
|
||||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkClientTrusted(
|
|
||||||
java.security.cert.X509Certificate[] certs, String authType) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkServerTrusted(
|
|
||||||
java.security.cert.X509Certificate[] certs, String authType) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Install the all-trusting trust manager
|
|
||||||
try {
|
|
||||||
SSLContext sc = SSLContext.getInstance("SSL");
|
|
||||||
sc.init(null, trustAllCerts, new java.security.SecureRandom());
|
|
||||||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new ElasticsearchException("Failed to install all-trusting trust manager", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downloadAndExtract(String name) throws IOException {
|
public void downloadAndExtract(String name) throws IOException {
|
||||||
|
|
|
@ -68,9 +68,6 @@ grant {
|
||||||
// needed by ImmutableSettings
|
// needed by ImmutableSettings
|
||||||
permission java.lang.RuntimePermission "getenv.*";
|
permission java.lang.RuntimePermission "getenv.*";
|
||||||
|
|
||||||
// needed by PluginManager
|
|
||||||
permission java.lang.RuntimePermission "setFactory";
|
|
||||||
|
|
||||||
// needed by LuceneTestCase/TestRuleLimitSysouts
|
// needed by LuceneTestCase/TestRuleLimitSysouts
|
||||||
permission java.lang.RuntimePermission "setIO";
|
permission java.lang.RuntimePermission "setIO";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue