solr - 基本身份验证
solr - basic authentication
(新手问题总提醒!)
我正在尝试在 SOLR 8.3(docker 容器:FROM solr:8.3)上设置基本身份验证 doc:
我添加了 /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 文件必须在容器构建时放置。
所以我在 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
在此之后,新建容器的行为与文档中描述的一样。
(新手问题总提醒!) 我正在尝试在 SOLR 8.3(docker 容器:FROM solr:8.3)上设置基本身份验证 doc:
我添加了 /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 文件必须在容器构建时放置。 所以我在 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
在此之后,新建容器的行为与文档中描述的一样。