Uploaded image for project: 'Nutch'
  1. Nutch
  2. NUTCH-2989

Can't have username/pw AND https on elastic-indexer?!

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.19
    • 1.20
    • indexer, plugin
    • None

    Description

      While working on NUTCH-2920, I copied+pasted the elastic indexer. As part of that process, I noticed that basic auth doesn't work with https.

      if (auth) {
              restClientBuilder
                  .setHttpClientConfigCallback(new HttpClientConfigCallback() {
                    @Override
                    public HttpAsyncClientBuilder customizeHttpClient(
                        HttpAsyncClientBuilder arg0) {
                      return arg0.setDefaultCredentialsProvider(credentialsProvider);
                    }
                  });
            }
      
            // In case of HTTPS, set the client up for ignoring problems with self-signed
            // certificates and stuff
            if ("https".equals(scheme)) {
              try {
                SSLContextBuilder sslBuilder = SSLContexts.custom();
                sslBuilder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
                final SSLContext sslContext = sslBuilder.build();
      
                restClientBuilder.setHttpClientConfigCallback(new HttpClientConfigCallback() {
                  @Override
                  public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
                    // ignore issues with self-signed certificates
                    httpClientBuilder.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE);
                    return httpClientBuilder.setSSLContext(sslContext);
                  }
                });
              } catch (Exception e) {
                LOG.error("Error setting up SSLContext because: " + e.getMessage(), e);
              }
            }
      

      On NUTCH-2920, I fixed this for the opensearch-indexer by adding another if (auth) statement under the https branch.

      If this is an actual issue, I'm happy to open a PR. If I've misunderstood the code or the design, please close as "not a problem".

      Attachments

        Issue Links

          Activity

            People

              tallison Tim Allison
              tallison Tim Allison
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: