对于生产环境,使用solr管理员甚至不要求登录凭据是不安全的。如何禁用默认的solr管理页面?我只是想让我的webapp使用Solr进行搜索词索引。
发布于 2012-05-28 02:57:15
为了调试的目的,我强烈建议保留管理页面。在许多情况下,它拯救了我。有几种方法可以将其限制为仅限经过HTTP身份验证的用户使用:http://wiki.apache.org/solr/SolrSecurity#Jetty_example。您可能需要解压缩并重新压缩您的webapp应用程序。
但是,如果您仍然希望禁用整个管理部分,可以注释掉${SOLR_HOME}/ requestHandler /solr/conf/solrconfig.xml中的管理项目。
发布于 2012-11-23 21:45:42
您可以使用密码保护您的管理页面,只需向Solr web应用程序添加安全约束即可。
Solr 3.6的代码片段:
<security-constraint>
<!-- This protects your admin interface and grants access to role Solr-Admin -->
<web-resource-collection>
<web-resource-name>Solr admin</web-resource-name>
<!--url-pattern>/admin/*</url-pattern-->
<url-pattern>/evu/admin/*</url-pattern>
<url-pattern>/webcrawl/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Solr-Admin</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<!-- This protects your admin interface and grants access to roles Solr-Admin and Solr-Updater -->
<web-resource-collection>
<web-resource-name>Solr Update</web-resource-name>
<url-pattern>/update/*</url-pattern>
<url-pattern>/evu/update/*</url-pattern>
<url-pattern>/webcrawl/update/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Solr-Admin</role-name>
<role-name>Solr-Update</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<!-- This one is necessary to show the image on the Solr start page -->
<web-resource-collection>
<web-resource-name>Solr Admin images</web-resource-name>
<url-pattern>*.png</url-pattern>
</web-resource-collection>
<auth-contraint>
<role-name>*</role-name>
</auth-contraint>
</security-constraint>
<security-role>
<description>The role that is required to administer Solr</description>
<role-name>Solr-Admin</role-name>
</security-role>
<security-role>
<description>The role that is required to update the Solr index</description>
<role-name>Solr-Update</role-name>
</security-role>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Solr</realm-name>
</login-config>
</web-app>在Solr 4中,您必须为管理界面保护以下资源:
/admin/*
/admin.html发布于 2016-12-01 17:05:19
sudo vim /opt/solr-4.8.1/example/etc/jetty.xml更改
<!-- This connector is currently being used for Solr because it
showed better performance than nio.SelectChannelConnector
for typical Solr requests. -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.bio.SocketConnector">
<Set name="host">0.0.0.0</Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="lowResourceMaxIdleTime">1500</Set>
<Set name="statsOn">false</Set>
</New>
</Arg>
</Call>至
<!-- This connector is currently being used for Solr because it
showed better performance than nio.SelectChannelConnector
for typical Solr requests. -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.bio.SocketConnector">
<Set name="host">127.0.0.1</Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="lowResourceMaxIdleTime">1500</Set>
<Set name="statsOn">false</Set>
</New>
</Arg>
</Call>然后sudo service solrd重启
https://stackoverflow.com/questions/10776263
复制相似问题