11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

curl http://localhost:8983/solr/techproducts/config -H<br />

'Content-type:application/json' -d '{<br />

"add-runtimelib": { "name":"jarblobname", "version":2 },<br />

"update-runtimelib": { "name":"jarblobname", "version":3 },<br />

"delete-runtimelib": "jarblobname"<br />

}'<br />

The name to use is the name of the blob that you specified when you uploaded your jar to the blob store. You<br />

should also include the version of the jar found in the blob store that you want to use. These details are added to<br />

configoverlay.json.<br />

The default <strong>Solr</strong>ResourceLoader does not have visibility to the jars that have been defined as runtime<br />

libraries. There is a classloader that can access these jars which is made available only to those components<br />

which are specially annotated.<br />

Every pluggable component can have an optional extra attribute called runtimeLib=true, which means that<br />

the components are not loaded at core load time. Instead, they will be loaded on demand. If all the dependent<br />

jars are not available when the component is loaded, an error is thrown.<br />

This example shows creating a ValueSourceParser using a jar that has been loaded to the Blob store.<br />

curl http://localhost:8983/solr/techproducts/config -H<br />

'Content-type:application/json' -d '{<br />

"create-valuesourceparser": {<br />

"name": "nvl",<br />

"runtimeLib": true,<br />

"class": "solr.org.apache.solr.search.function.NvlValueSourceParser,<br />

"nvlFloatValue": 0.0 }<br />

}'<br />

Securing Runtime Libraries<br />

A drawback of this feature is that it could be used to load malicious executable code into the system. However, it<br />

is possible to restrict the system to load only trusted jars using PKI to verify that the executables loaded into the<br />

system are trustworthy.<br />

The following steps will allow you enable security for this feature. The instructions assume you have started all<br />

your <strong>Solr</strong> nodes with the -Denable.runtime.lib=true.<br />

Step 1: Generate an RSA Private Key<br />

The first step is to generate an RSA private key. The example below uses a 512-bit key, but you should use the<br />

strength appropriate to your needs.<br />

$ openssl genrsa -out priv_key.pem 512<br />

Step 2: Output the Public Key<br />

The public portion of the key should be output in DER format so Java can read it.<br />

$ openssl rsa -in priv_key.pem -pubout -outform DER -out pub_key.der<br />

Step 3: Load the Key to ZooKeeper<br />

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

499

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

Saved successfully!

Ooh no, something went wrong!