Configure Basic Authentication for Solr (Standalone Mode)
Basic authentication is automatically configured with the user name and password provided at the time of installation. This section describes how to configure the basic authentication manually, if required.
1. Stop Solr using the following commands:
Windows
<INDEX_SEARCH_HOME>/bin/Index_Search_Server.bat stop
Unix
sh <INDEX_SEARCH_HOME>/bin/Index_Search_Server.sh stop
2. Open the following file:
<INDEX_SEARCH_HOME>/solr/server/etc/webdefault.xml
And edit the content as follows (changes are highlighted):
<security-constraint>
<web-resource-collection>
<web-resource-name>Disable TRACE</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Solr Realm</realm-name>
</login-config>
3. Open the following file:
<INDEX_SEARCH_HOME>/solr/server/etc/jetty.xml
Add the following section at the end before the </Configure> tag:
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Solr Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
</New>
</Arg>
</Call>
4. Generate a password in encrypted format using the following utility provided by Jetty:
a. Open a command prompt and navigate to <INDEX_SEARCH_HOME>/solr/server.
b. Run the following command using the plain text password as your argument:
java -cp lib/jetty-util.jar org.eclipse.jetty.util.security.Password <Username> <Password>
For example, running the following command:
java -cp lib/jetty-util.jar org.eclipse.jetty.util.security.Password solr SolrRocks
Results in the following output:
* 
PTC recommends CRYPT as the most secure encryption option available when using this tool.
5. Create a new file:
<INDEX_SEARCH_HOME>/solr/server/etc/realm.properties
Using the following format, add the encrypted password generated in the previous step:
<Username>: CRYPT:<Encrypted password>,<Role>
For example:
solr: CRYPT:so3oR2FANmQ4Y,admin
6. Start Solr using the following commands:
Windows
<INDEX_SEARCH_HOME>/bin/Index_Search_Server.bat start
Unix
sh <INDEX_SEARCH_HOME>/bin/Index_Search_Server.sh start
7. Open the Solr administrator interface and verify that you are prompted for a username and password:
http://<SOLR_HOSTNAME>:<SOLR_PORT>/solr
Changing the Solr User or Password
When you change the Solr user or password, you must update both the Windchill Index Search client and server.
1. Open a Windchill shell and execute the following commands to change the password or user for the Windchill Index Search client:
xconfmanager -s wt.index.solrAdminUser=<New_User> -t codebase/WEB-INF/conf/index.solrAuth.properties -p
xconfmanager -s wt.index.solrAdminPassword=<New_Password> -t codebase/WEB-INF/conf/index.solrAuth.properties -p
2. Restart Windchill.
3. From a command prompt, navigate to <INDEX_SEARCH_HOME>/bin and execute the following commands to change the password or user for the Windchill Index Search server:
Windows:
xconfmanager -s wt.index.server.solrAdminUser=<New_User> -t config/solrserver.properties -p
xconfmanager -s wt.index.server.solrAdminPassword=<New_Password> -t config/solrserver.properties -p
Unix:
sh xconfmanager -s wt.index.server.solrAdminUser=<New_User> -t config/solrserver.properties -p
sh xconfmanager -s wt.index.server.solrAdminPassword=<New_Password> -t config/solrserver.properties -p
4. Follow the steps outlined above to update <INDEX_SEARCH_HOME>/solr/server/etc/realm.properties.
5. Restart Solr.
¿Fue esto útil?