我在Glassfish中部署了一个阿帕奇索尔实例,我通过索尔杰使用这个索尔杰代码中的Solr实例。问题是,我想限制对Solr的访问,这样Java代码就可以访问它(代码可以从不同的IP地址运行)。
我的第一个想法是更改已部署的Solr实例的web.xml,以使用基于Glassfish文件的Realms添加基本身份验证,因为我使用它来限制对另一个项目中REST接口的访问。因此,我在Solr web.xml中添加了以下行:
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<description>has to be a USER</description>
<role-name>USERS</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>userauth</realm-name>
</login-config>
<security-role>
<role-name>USERS</role-name>
</security-role>但不知何故,这东西对Solr access不起作用。我没有得到身份验证对话框,这很奇怪,因为它在另一个设置中工作。
一般来说,这种保护Solr实例的方法是一种很好的方法,还是应该尝试另一种方法?在Solr安全页面中,他们讨论用防火墙处理Solr实例。我不是一个Linux管理员,但我认为iptables是一种可能的解决方案,在服务器错误(例如这一个)上有一些很好的答案。
你认为如何?
发布于 2012-01-05 08:55:35
好的,我的解决方案是使用防火墙,而不是以某种方式修改Solr。
https://stackoverflow.com/questions/6369714
复制相似问题