2012-05-27 2 views
7

프로덕션 환경에서는 로그인 자격 증명을 묻지 않는 solr 관리자를 갖는 것이 안전하지 않습니다. 어떻게하면 기본적으로 제공되는 solr 관리 페이지를 비활성화 할 수 있습니까? 간단히 말해서 Webapp에 Solr을 사용하여 검색 용어 인덱싱을 수행하면됩니다.solr admin 페이지를 비활성화하는 방법

답변

10

디버깅 목적으로 관리자 페이지를 유지하는 것이 좋습니다. 그것은 많은 경우에 나를 구해주었습니다. HTTP 인증 사용자로만 제한하는 방법은 http://wiki.apache.org/solr/SolrSecurity#Jetty_example입니다. 웹 응용 프로그램을 압축 해제하고 다시 압축해야 할 수 있습니다.

그러나 전체 관리 섹션을 계속 비활성화하려면 $ {SOLR_HOME} /project/solr/conf/solrconfig.xml에서 admin requestHandler를 주석 처리 할 수 ​​있습니다.

2

Solr 웹 응용 프로그램에 보안 제약 조건을 추가하기 만하면 관리자 페이지를 암호로 보호 할 수 있습니다. SOLR 3.6

발췌문 : 당신이 관리 인터페이스는 다음 리소스를 보호해야 SOLR 4에서

<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> 

:

/admin/* 
/admin.html 
+0

를 다시 시작 solrd 이 스 니펫을 추가 하시겠습니까? – tasmaniski

+0

web.xml이 될 것입니다. 부두의 구조에 대해서는 잘 모르겠습니다. – Maddin

-3

가장 쉬운 방법 :

의 iptables -A INPUT -p tcp --dport 8983 -j DROP

iptables -A INPUT -p tcp -s 127.0.0.1 --dport 8983 -j 승인

이 주문입니다!

+0

제가 이것을 시도했을 때, 내 사이트 스크립트는 더 이상 Solr에 액세스 할 수 없었습니다 - 다른 IP 주소와 다른 것들을 시도하는 iptables로 조금 놀았습니다. (아마도 이에 대한 전문 지식이 부족하기 때문에). 나는 아직도 운이없는 쉬운 대답을 찾고 있습니다 ... – JxAxMxIxN

+0

잘못된 순서 때문입니다. 여기에 oneliner가있다 : iptables -A INPUT -p tcp -s localhost --dport 8983 -j ACCEPT && iptables -A INPUT -p tcp --dport 8983 -j DROP && iptables-save> iptables.rules && iptables-restore hlcs

0

sudo는 정력 /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는 서비스가 무엇인지에

관련 문제