Solr Cloud with Basic Authentication fails - Unaut

2019-06-24 16:54发布

问题:

I have setup SolrCloud using Solr 6.6.0 and Zookeeper 3.4.10. I am trying to setup Basic Authentication as per latest documentation at https://cwiki.apache.org/confluence/display/solr/Basic+Authentication+Plugin

Issue is that the authentication does not work. After setup, I am unable to access Solr Admin console as it does not accept the username/password that was setup.

Below are the Steps with detailed info:

1) Started Zookeeper listening on port 2181

2) Started Solr cloud mode connecting to Zookeeper

 solr start -c -s C:/solr-6.6.0_VM1/server/solr/cores -p 8983 -z 
    "localhost:2181";

3) Created security.json file (as per documentation):

{
"authentication":{    
"blockUnknown": true,    
"class":"solr.BasicAuthPlugin",    
"credentials":{"solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0=    
Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="}    
},    
"authorization":{    
"class":"solr.RuleBasedAuthorizationPlugin",    
"permissions":[{"name":"security-edit",    
"role":"admin"}],    
"user-role":{"solr":"admin"}    
}}    

4) Updated solr.in.cmd to enable authenticaiton on SOLR:

set SOLR_AUTH_TYPE=basic
set SOLR_AUTHENTICATION_OPTS="-Dbasicauth=solr:SolrRocks"

5) **Uploaded security.json file to Zookeeper:*

 server\scripts\cloud-scripts\zkcli -z localhost:2181 -cmd putfile 
    /security.json security.json

6) Restarted SOLR server

7) Opened SOLR Admin console: http://localhost:8983/solr/#/

I was asked username/password. I entered solr/SolrRocks The admin did not accept the password. When I close the login window, it shows "HTTP ERROR 401, Bad credentials"

Any idea why the authentication is not working on Solr? I have tried the steps exactly as documented. Appreciate your help!

Thanks,

Nishant