You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@manifoldcf.apache.org by "Jörn Franke (Jira)" <ji...@apache.org> on 2020/01/02 21:00:09 UTC

[jira] [Commented] (CONNECTORS-1629) Support Solr Kerberos Authentication

    [ https://issues.apache.org/jira/browse/CONNECTORS-1629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17007079#comment-17007079 ] 

Jörn Franke commented on CONNECTORS-1629:
-----------------------------------------

Hi,

 

I have some results. My test environment is RHEL, but it should work under Windows with no issues (In fact i have a similar application Windows in Java using a similar configuration to connet to a Kerberos Solr). I used Apache Manifold 2.15 (JDK8 Coretto, you might need for Oracle JDK unlimited strength policies) together with a Kerberos enabled Solr 8.3 with Zookeeper 3.5 as well Kerberos enabled.

 

You need jetty-client-9.4.25.v20191220.jar (maybe a slightly older 9.4.x version will do as well, the current manifold version not). Reason is that you will get otherwise a java.lang.ClassNotFoundException: org.eclipse.jetty.client.util.SPNEGOAuthentication error.

I was not exactly sure how to add this jar to the finally generated distribution of ManifoldCF so i copied it in collector-lib and added it to the classpath.

 

Then, I did the following modifications (you will notice they slightly differ from the one documented in the Solr reference guide):

[https://github.com/apache/manifoldcf/blob/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java]

 

[..]

Krb5HttpClientBuilder krbBuild = new Krb5HttpClientBuilder();
 SolrHttpClientBuilder kb = krbBuild.getBuilder();
 HttpClientUtil.setHttpClientBuilder(kb);

[..]

I had to also deactivate the ModifiedLbSolrClient otherwise you get an auth error. I believe the reason is that the default SPNEGO Protocol for HTTP Kerberos always returns 401 not auth and THEN you are supposed to do the Kerberos authentication, which is what SolrJ does:

[..]

 CloudSolrClient cloudSolrServer = new CloudSolrClient.Builder()
 .withZkHost(zookeeperHosts)
 //.withLBHttpSolrClient(new ModifiedLBHttpSolrClient(HttpClientUtil.createClient(null), allowCompression))
 .build();

[..]

I dont know what the exact implications are, but for me it worked out fine. CloudSolrClient does automatic loadbalancing based on the hosts found in Zookeepr and thus the LBHttpSolrClient will not matter much, but I dont know what the intention of the ModifiedLBHttpSolrClient was/is - let me know and i will reinvestigate.

 

Then, you need to create a jaas-client.conf file, e.g. the following works:

 
jaas-client.conf:
Client {
 com.sun.security.auth.module.Krb5LoginModule required
 useKeyTab=true
 keyTab="/path/to/keytab"
 storeKey=true
 useTicketCache=false
 debug=true
 principal="principal@DOMAIN";
};

 

Finally, you need to add to options.env.unix or options.env.win:

-Djava.security.auth.login.config=/path/to/jaas-client.conf

Furthemore, I propose to have a configuration item or at least in the Manifold documentation how to activate Kerberos.

 

I am happy to contribute this as well as a Github pull request or similar.

 

Please let me also know what you think about the approach. I think it is worth to follow as many Enterprises use Kerberos.

best regards

 

> Support Solr Kerberos Authentication
> ------------------------------------
>
>                 Key: CONNECTORS-1629
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-1629
>             Project: ManifoldCF
>          Issue Type: Improvement
>          Components: Solr 7.x component
>    Affects Versions: ManifoldCF 2.14
>            Reporter: Jörn Franke
>            Priority: Major
>
> Several enterprise deployments of Solr are leveraging SolrCloud Kerberos authentication.
> The integration seems to be rather simple and the goal of this Jira is to evaluate the possential needed step to eventually contribute the Kerberos integration to the ManifoldCF project.
> The following steps would be needed:
>  * One can pass the JVM parameter java.security.auth.login.config to the ManifoldCF JVM using -Djava.security.auth.login.config=/path/to/jaas.confg in which Kerberos authentication details, such as keytab and principal that has the right access to Solr is configured
>  * A small adaption to the SolrCloudClient that is used within Manifold needs to be done to enable Kerberos authentication: HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
> Should this be integrated in Manifold, one may want to consider one input field in the configuration in the UI where one can select / flow which user defined in the Jaas conf (you can define multiple one) should be chosen. By default one may simply select "client" or "SolrJClient" if Jaas.conf is present in the System properties. This does not mean the user needs to be named like this, but the configuration entry referencing any user should be named like this.
> Having a confiugration allows to have a different users per flow. This might also be needed in case you have multiple Solr clusters. 
> Related discussion [http://mail-archives.apache.org/mod_mbox/manifoldcf-user/201912.mbox/browser]
> SolrJ Kerberos integration: [https://lucene.apache.org/solr/guide/8_3/kerberos-authentication-plugin.html#using-solrj-with-a-kerberized-solr]
> Jaas conf documentation: [https://docs.oracle.com/javase/8/docs/technotes/guides/security/jgss/tutorials/LoginConfigFile.html]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)