2015년 5월 1일 금요일

solr admin에 password 추가하기

https://wiki.apache.org/solr/SolrSecurity

여기서 

Common servlet container example

Jetty realm example

이 두개를 따라 하면 된다.

<jetty.xml>
    <Call name="addBean">
      <Arg>
        <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
          <Set name="contexts">
            <Ref id="Contexts" />
          </Set>
          <Call name="setContextAttribute">
            <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
            <Arg>.*/servlet-api-[^/]*\.jar$</Arg>
          </Call>
          
          
          <!-- Add a customize step to the deployment lifecycle -->
          <!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class 
          <Call name="insertLifeCycleNode">
            <Arg>deployed</Arg>
            <Arg>starting</Arg>
            <Arg>customise</Arg>
          </Call>
          <Call name="addLifeCycleBinding">
            <Arg>
              <New class="org.eclipse.jetty.deploy.bindings.DebugBinding">
                <Arg>customise</Arg>
              </New>
            </Arg>
          </Call>
          -->
          
        </New>
      </Arg>
    </Call>
    <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>
    
    <Ref id="DeploymentManager">
      <Call name="addAppProvider">
        <Arg>
          <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
            <Set name="monitoredDirName"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
            <Set name="scanInterval">0</Set>
          </New>
        </Arg>
      </Call>

    </Ref>

<web.xml>
  <welcome-file-list>
    <welcome-file>admin.html</welcome-file>
  </welcome-file-list>

  <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>admin</role-name>
    </auth-constraint>
  </security-constraint>
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Test Realm</realm-name>
  </login-config>
    
</web-app>

<realm.properties>
admin: 12345, admin

암호 부분을 강화하려면..
여기에 있는 방법대로..
$ cd ./lib
$ java -cp jetty-util-8.1.10.v20130312.jar org.eclipse.jetty.util.security.Password admin 12345
12345
OBF:19bv19bx19bz19c119c3
MD5:827ccb0eea8a706c4c34a16891f84e7b
CRYPT:adpliAB3dA.06

<realm.properties>
adminMD5:827ccb0eea8a706c4c34a16891f84e7b, admin


댓글 없음:

댓글 쓰기