在Ubuntu14上安装了Solr6.1,并从MySql表中导入数据。有没有人能指导我如何保护mydomain/ip:8983/solr不被公开。
我尝试了在https://cwiki.apache.org/confluence/display/solr/Basic+Authentication+Plugin上给出的指令,但在添加security.json时zookeepr连接失败。
发布于 2016-08-03 04:10:22
首先,转到etc目录中的webdefault.xml。在你的web.xml中添加以下几行代码。
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>samplerealm</realm-name>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure resources</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>在etc文件夹中,创建一个samplerealm.txt文件并将以下内容添加到文件user1: user1pass,user中。这里,user1是您的用户名,user1pass是您刚才在web.xml中定义的角色user的密码。之后,转到etc文件夹中的jetty.xml文件,在该行下面查找以下行<Configure id="Server" class="org.eclipse.jetty.server.Server">,粘贴以下代码:
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">samplerealm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/samplerealm.txt</Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>
</Call>之后,停止并重新启动Solr服务器。当您现在访问solr页面时,它会要求您提供凭据。按照示例realm.txt文件中的声明,提供user1作为用户名,user1pass作为密码。稍后,您可以根据需要更改密码。这就是在Solr中执行http基本身份验证的方法。它100%有效。如果有帮助,请告诉我:)
发布于 2016-08-02 21:09:23
您可以启用SSL。我不确定这是否是所需的安全性-您必须提供更多信息。
使用SSL,您至少能够加密SolrCloud和客户端之间的通信,以及Solr节点之间的通信。
启用SSL的链接:https://cwiki.apache.org/confluence/display/solr/Enabling+SSL
https://stackoverflow.com/questions/38721049
复制相似问题