【问题标题】:solr - basic authenticationsolr - 基本身份验证
【发布时间】:2021-06-17 01:05:51
【问题描述】:

(总初学者问题提醒!) 我正在尝试在此doc 之后在 SOLR 8.3(docker 容器:FROM solr:8.3)上设置基本身份验证:

我已经添加了 /var/solr/data/security.json:

{
"authentication":{ 
   "blockUnknown": true, 
   "class":"solr.BasicAuthPlugin",
   "credentials":{"solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="}, 
   "realm":"My Solr users", 
   "forwardCredentials": false 
},
"authorization":{
   "class":"solr.RuleBasedAuthorizationPlugin",
   "permissions":[{"name":"security-edit",
      "role":"admin"}], 
   "user-role":{"solr":"admin"} 
}}

当我尝试更改默认管理员密码时:

curl --user solr:SolrRocks http://10.x.x.x:8983/solr/admin/authentication -H 'Content-type:application/json' -d '{"set-user": {"solr" : "MyNewSuperSecurePass" }}'

我得到了错误:

  "responseHeader":{
    "status":400,
    "QTime":1},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"No authentication plugin configured",
    "code":400}}

【问题讨论】:

  • 第一件事..您是否重新启动了 solr(在编辑 security.json 之后和调用 api 之前)?此外,您可以从具有最少(不安全)设置的基本 security.json 开始:例如。包含 blockUnknown: false,无凭据,授权块仅提及其类。然后重启 solr 并使用 api 设置用户、设置用户角色和设置权限,并以 set-property: blockUnknown: true 结束。
  • 嗨,埃里克,我做了所有这些。发现问题后,我将发布更新。

标签: solr solr8


【解决方案1】:

我发现只有在容器中运行 solr 时才会出现这种行为。基本上 security.json 文件必须在容器构建时放置。 所以我添加到 Dockerfile 中:

FROM solr:8.3
ENV SOLR_USER="solr" \
    SOLR_GROUP="solr"
USER root
COPY --chown=solr:solr security/security.json /var/solr/data/security.json
USER $SOLR_USER

在此之后,新建容器的行为如文档中所述。

【讨论】:

    猜你喜欢
    • 2013-03-03
    • 1970-01-01
    • 1970-01-01
    • 2018-03-18
    • 2021-06-20
    • 2011-01-28
    • 1970-01-01
    • 1970-01-01
    • 2014-09-03
    相关资源
    最近更新 更多