You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by "Sebastian Nagel (Jira)" <ji...@apache.org> on 2023/07/12 12:08:00 UTC

[jira] [Updated] (NUTCH-2989) Can't have username/pw AND https on elastic-indexer?!

     [ https://issues.apache.org/jira/browse/NUTCH-2989?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian Nagel updated NUTCH-2989:
-----------------------------------
    Affects Version/s: 1.19

> Can't have username/pw AND https on elastic-indexer?!
> -----------------------------------------------------
>
>                 Key: NUTCH-2989
>                 URL: https://issues.apache.org/jira/browse/NUTCH-2989
>             Project: Nutch
>          Issue Type: Task
>    Affects Versions: 1.19
>            Reporter: Tim Allison
>            Priority: Major
>             Fix For: 1.20
>
>
> 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.
> {code:java}
> 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);
>         }
>       }
> {code}
> 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".



--
This message was sent by Atlassian Jira
(v8.20.10#820010)