You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/09/02 00:50:22 UTC
[GitHub] [skywalking] hanahmily commented on a change in pull request #3370:
support es https ssl config.
hanahmily commented on a change in pull request #3370: support es https ssl config.
URL: https://github.com/apache/skywalking/pull/3370#discussion_r319782872
##########
File path: oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ElasticSearchClient.java
##########
@@ -84,30 +95,50 @@
public static final String TYPE = "type";
private final String clusterNodes;
private final String protocol;
+ private final String trustStorePath;
+ private final String trustStorePass;
private final String namespace;
private final String user;
private final String password;
protected RestHighLevelClient client;
- public ElasticSearchClient(String clusterNodes, String protocol, String namespace, String user, String password) {
+ public ElasticSearchClient(String clusterNodes, String protocol, String trustStorePath, String trustStorePass,
+ String namespace, String user, String password) {
this.clusterNodes = clusterNodes;
this.protocol = protocol;
this.namespace = namespace;
this.user = user;
this.password = password;
+ this.trustStorePath = trustStorePath;
+ this.trustStorePass = trustStorePass;
}
- @Override public void connect() throws IOException {
+ @Override
+ public void connect() throws IOException, KeyStoreException, NoSuchAlgorithmException, KeyManagementException, CertificateException {
List<HttpHost> pairsList = parseClusterNodes(clusterNodes);
RestClientBuilder builder;
if (StringUtils.isNotBlank(user) && StringUtils.isNotBlank(password)) {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(user, password));
builder = RestClient.builder(pairsList.toArray(new HttpHost[0]))
.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider));
+
+ if ("https".equals(protocol)) {
Review comment:
`trustStorePaht` may be null in no-self-signed scenario. so we should update this condition.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services