Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Apache solr admin password

Tags:

I an not very familiar with solr. I have installed solr successfully. It is using jetty webserver. My solr version is 4.10.3. It admin page is not protected by password. Anyone can access it. I want to apply a paaword on solr admin. How I will do it?

like image 467
Hafiz Muhammad Shafiq Avatar asked Jan 20 '15 11:01

Hafiz Muhammad Shafiq


People also ask

What is the password for Solr user?

A user called 'solr' is created with a password 'SolrRocks' The user 'solr' is assigned a role 'admin'

Is it possible to enable authentication in Solr admin console?

Solr can support Basic authentication for users with the use of the BasicAuthPlugin. An authorization plugin is also available to configure Solr with permissions to perform various activities in the system. The authorization plugin is described in the section Rule-Based Authorization Plugin.

How do I access Solr admin?

The path to the Solr Admin UI given above is http://hostname:port/solr , which redirects to http://hostname:port/solr/#/ in the current version. A convenience redirect is also supported, so simply accessing the Admin UI at http://hostname:port/ will also redirect to http://hostname:port/solr/#/ .


1 Answers

Enable authentication in solr admin running with solr 6.1 and jetty

Pre condition:

  1. Solr version 6.1

  2. Solr is running successfully in the system

  3. Solr Admin running through jetty

Process:

1. Edit jetty.xml

Edit the file “server/etc/jetty.xml” Add following before the Configure tag ends

<Call name="addBean">       <Arg>         <New class="org.eclipse.jetty.security.HashLoginService">           <Set name="name">Test Realm</Set>           <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>           <Set name="refreshInterval">0</Set>         </New>       </Arg>     </Call> 

2. Edit webdefault.xml

Edit the file “server/etc/webdefault.xml” Add following before the web-app tag ends

<security-constraint>     <web-resource-collection>       <web-resource-name>Solr authenticated application</web-resource-name>       <url-pattern>/</url-pattern>     </web-resource-collection>     <auth-constraint>       <role-name>core1-role</role-name>     </auth-constraint>   </security-constraint>    <login-config>     <auth-method>BASIC</auth-method>     <realm-name>Test Realm</realm-name>   </login-config> 

Special Note:

Value used in the role-name tag need to be same used in “realm.properties” file

3. Create new file “realm.properties”

Create a file named “realm.properties” in the location “server/etc/” and put the below content

admin: admin123,core1-role 

User Name: admin

Password: admin123

Role name: core1-role

(This need to be same as the name used in role-name tag in server/etc/webdefault.xml” file )

4. Final Step

Restart Solr server

Now access Solr in your browser http://localhost:8983/solr/ You will find the browser is asking for username and password. Enter the username and password.

enter image description here

like image 153
3 revs, 2 users 96% Avatar answered Sep 19 '22 15:09

3 revs, 2 users 96%