如何保护solr 6管理页面

时间:2016-08-02 12:55:19

标签: solr

在Ubuntu14上安装Solr6.1并从MySql表导入数据。有人可以指导我如何保护mydomain / ip:8983 / solr from public。

我尝试了https://cwiki.apache.org/confluence/display/solr/Basic+Authentication+Plugin上给出的说明,但添加security.json时,zookeepr连接失败。

2 个答案:

答案 0 :(得分:2)

首先转到webdefault.xml目录中的etc。将以下行放在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是您在user中定义的角色web.xml的密码。然后转到jetty.xml文件夹中的etc文件并查找以下行<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页面时,它会询问您的凭据。提供user1作为用户名,user1pass作为密码,如示例realm.txt文件中所声明的那样。稍后,您可以根据需要更改密码。这是您在Solr中进行http基本身份验证的方法。它100%工作。如果有帮助,请告诉我:)。

答案 1 :(得分:0)

您可以启用SSL。我不确定这是否是所需的安全性 - 您必须提供更多信息。

使用SSL,您至少可以加密SolrCloud与客户端之间的通信,以及Solr节点之间的通信。

启用SSL的链接:https://cwiki.apache.org/confluence/display/solr/Enabling+SSL

相关问题