11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

during initialization.<br />

The authorization plugin is only supported in <strong>Solr</strong>Cloud mode. Also, reloading the plugin isn't supported<br />

at this point and requires a restart of the <strong>Solr</strong> instance (meaning, the JVM should be restarted, not simply<br />

a core reload).<br />

Available Authorization Plugins<br />

<strong>Solr</strong> has one implementation of an authorization plugin:<br />

Rule-Based Authorization Plugin<br />

Basic Authentication Plugin<br />

<strong>Solr</strong> can support Basic authentication for users with the use of the BasicAuthPlugin.<br />

An authorization plugin is also available to configure <strong>Solr</strong> with permissions to perform various activities in the<br />

system. The authorization plugin is described in the section Rule-Based Authorization Plugin.<br />

Enable Basic Authentication<br />

To use Basic authentication, you must first create a security.json file and store it in ZooKeeper. This file and<br />

how to upload it to ZooKeeper is described in detail in the section Enable Plugins with security.json.<br />

For Basic authentication, the security.json file must have an authentication part which defines the class<br />

being used for authentication. Usernames and passwords (as a sha256(password+salt) hash) could be added<br />

when the file is created, or can be added later with the Basic authentication API, described below.<br />

The authorization part is not related to Basic authentication, but is a separate authorization plugin designed<br />

to support fine-grained user access control. For more information, see Rule-Based Authorization Plugin.<br />

An example security.json showing both sections is shown below to show how these plugins can work<br />

together:<br />

{<br />

"authentication":{<br />

"blockUnknown": true,<br />

"class":"solr.BasicAuthPlugin",<br />

"credentials":{"solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0=<br />

Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="}<br />

},<br />

"authorization":{<br />

"class":"solr.RuleBasedAuthorizationPlugin",<br />

"permissions":[{"name":"security-edit",<br />

"role":"admin"}],<br />

"user-role":{"solr":"admin"}<br />

}}<br />

Save the above json to a file called security.json locally. Run the following command to upload it to Zookeeper.<br />

(ensure that the Zookeeper port is correct)<br />

server/scripts/cloud-scripts/zkcli.sh -zkhost localhost:9983 -cmd putfile<br />

/security.json security.json<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

513

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!